From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650347716417255.33594322206955; Mon, 18 Apr 2022 22:55:16 -0700 (PDT) Received: from localhost ([::1]:34896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggpX-0004AC-0t for importer@patchew.org; Tue, 19 Apr 2022 01:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglg-000131-Bt for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:16 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:43712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggle-0004Mf-FJ for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:16 -0400 Received: by mail-wm1-x329.google.com with SMTP id n40-20020a05600c3ba800b0038ff1939b16so758228wms.2 for ; Mon, 18 Apr 2022 22:51:14 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4wl/18eQd19gP5MbPbPK6bIwSnFheqPxeEG+35PYvUE=; b=Hx9AmFCsiU6VJOJcYCENl2iEn1jo3cfpsGdTab7YJEWgGexBvdvNwKZ6Dmxiue8ICm 63WP8qzF/KXOeHo2YRiLUY1OBuBDo89VzKXOqaECWuFcvLaUfTSwCYxwj3Bzzs0FYWee jK3qRiv5prtyzfaWY+N6Ir2avID48IOsptz9HNBLLK3nGPRmIQ+1ek2+9bY1NNJHouxD 74fgBLkrajRMVwdJVfdDqfXkhvxTXKadXQgwA+hqW5OXDj/tXfE1b3gewF4txZxrzl08 FlYP9JUIcGyjJRSqe2Dnxz83HaoQ/LkRM/7yvuhWzEO1+fau6dtm6flJdmI3gqmvJ3IY YE8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4wl/18eQd19gP5MbPbPK6bIwSnFheqPxeEG+35PYvUE=; b=NdaRyX9oKasgu/CBOGt0w33F+ecqRfbFiVUDrMg/H7S/Rcl4qoz8JQu3OTsvFVpJO1 zbEtKJrCD+t4O4Uvekehizo3s2suiCo6RgFTthrjlO1w3aUQERsRuwd+Ws3PfHgbvtLR N8jbo9XWicpuIHAfIXDEPrJxqFEVOAKbfMfYokBdz9495PPpC1LBcJZqBK+f+bvuOKCA FUJnLwvH4HQUeFdf9h4YGHc8XQoi6ogHx0QCfL9atXgiFxMsNHFz6mIGDcCeXvwCAM01 EI0MdsdxsUXwY9JU7ZwX0n3P0UELQf0nBHlp+6KM1oDbBNv8mNfUkLT9RJGjX+dOsN2f CdWw== X-Gm-Message-State: AOAM533U4lBW96jpd8jPr2AyUQgOwm9wGL3guy+hL9HUqKcm2K5gEwAP cfBnXkkElZqUSBN2NP4wQGbzr7NsSxJ24A== X-Google-Smtp-Source: ABdhPJzqAqA3BGT4jnqOYlziLrfmnku66JGSDh4+G/l/9R/4McAkByj/JirhXWT+H1L+N8DqDKMZKA== X-Received: by 2002:a1c:f30b:0:b0:37b:b5de:c804 with SMTP id q11-20020a1cf30b000000b0037bb5dec804mr18151723wmq.166.1650347472274; Mon, 18 Apr 2022 22:51:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/53] qapi, target/i386/sev: Add cpu0-id to query-sev-capabilities Date: Tue, 19 Apr 2022 07:50:17 +0200 Message-Id: <20220419055109.142788-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::329; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Dov Murik , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650347718266100003 From: Dov Murik Add a new field 'cpu0-id' to the response of query-sev-capabilities QMP command. The value of the field is the base64-encoded unique ID of CPU0 (socket 0), which can be used to retrieve the signed CEK of the CPU from AMD's Key Distribution Service (KDS). Signed-off-by: Dov Murik Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20220228093014.882288-1-dovmurik@linux.ibm.com> Signed-off-by: Paolo Bonzini --- qapi/misc-target.json | 4 ++++ target/i386/sev.c | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 036c5e4a91..bc9355b595 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -144,6 +144,8 @@ # # @cert-chain: PDH certificate chain (base64 encoded) # +# @cpu0-id: Unique ID of CPU0 (base64 encoded) (since 7.0) +# # @cbitpos: C-bit location in page table entry # # @reduced-phys-bits: Number of physical Address bit reduction when SEV is @@ -154,6 +156,7 @@ { 'struct': 'SevCapability', 'data': { 'pdh': 'str', 'cert-chain': 'str', + 'cpu0-id': 'str', 'cbitpos': 'int', 'reduced-phys-bits': 'int'}, 'if': 'TARGET_I386' } @@ -172,6 +175,7 @@ # # -> { "execute": "query-sev-capabilities" } # <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE", +# "cpu0-id": "2lvmGwo+...61iEinw=3D=3D", # "cbitpos": 47, "reduced-phys-bits": 5}} # ## diff --git a/target/i386/sev.c b/target/i386/sev.c index 025ff7a6f8..32f7dbac4e 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -531,12 +531,46 @@ e_free: return 1; } =20 +static int sev_get_cpu0_id(int fd, guchar **id, size_t *id_len, Error **er= rp) +{ + guchar *id_data; + struct sev_user_data_get_id2 get_id2 =3D {}; + int err, r; + + /* query the ID length */ + r =3D sev_platform_ioctl(fd, SEV_GET_ID2, &get_id2, &err); + if (r < 0 && err !=3D SEV_RET_INVALID_LEN) { + error_setg(errp, "SEV: Failed to get ID ret=3D%d fw_err=3D%d (%s)", + r, err, fw_error_to_str(err)); + return 1; + } + + id_data =3D g_new(guchar, get_id2.length); + get_id2.address =3D (unsigned long)id_data; + + r =3D sev_platform_ioctl(fd, SEV_GET_ID2, &get_id2, &err); + if (r < 0) { + error_setg(errp, "SEV: Failed to get ID ret=3D%d fw_err=3D%d (%s)", + r, err, fw_error_to_str(err)); + goto err; + } + + *id =3D id_data; + *id_len =3D get_id2.length; + return 0; + +err: + g_free(id_data); + return 1; +} + static SevCapability *sev_get_capabilities(Error **errp) { SevCapability *cap =3D NULL; guchar *pdh_data =3D NULL; guchar *cert_chain_data =3D NULL; - size_t pdh_len =3D 0, cert_chain_len =3D 0; + guchar *cpu0_id_data =3D NULL; + size_t pdh_len =3D 0, cert_chain_len =3D 0, cpu0_id_len =3D 0; uint32_t ebx; int fd; =20 @@ -561,9 +595,14 @@ static SevCapability *sev_get_capabilities(Error **err= p) goto out; } =20 + if (sev_get_cpu0_id(fd, &cpu0_id_data, &cpu0_id_len, errp)) { + goto out; + } + cap =3D g_new0(SevCapability, 1); cap->pdh =3D g_base64_encode(pdh_data, pdh_len); cap->cert_chain =3D g_base64_encode(cert_chain_data, cert_chain_len); + cap->cpu0_id =3D g_base64_encode(cpu0_id_data, cpu0_id_len); =20 host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL); cap->cbitpos =3D ebx & 0x3f; @@ -575,6 +614,7 @@ static SevCapability *sev_get_capabilities(Error **errp) cap->reduced_phys_bits =3D 1; =20 out: + g_free(cpu0_id_data); g_free(pdh_data); g_free(cert_chain_data); close(fd); --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348056423627.2548732898449; Mon, 18 Apr 2022 23:00:56 -0700 (PDT) Received: from localhost ([::1]:43442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggv1-0001ey-0j for importer@patchew.org; Tue, 19 Apr 2022 02:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglg-00013A-Fr for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:16 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:45972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggle-0004Mn-GZ for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:16 -0400 Received: by mail-wm1-x336.google.com with SMTP id 123-20020a1c1981000000b0038b3616a71aso753262wmz.4 for ; Mon, 18 Apr 2022 22:51:14 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n4cZ/5yYlF+5qg8dpUFnjdhAuVIYXjGBqkXlY12xX7o=; b=JWbkofRswE+jBVKsdsxgOEDZPQgpvtpeBcQQtTG4/Kan82GGyo5XG7/HDqln/cq3gm Q6K6TgE6iuJPoIUuqh7ypBuhwibHYdi+o2gO9APyM/RkUft1x8fE17hKOFnZcGe4izLa NmAefA+YmkJExr5IAGQbd2L9spdBPzLRaynZTmNOGRKxmosWdwvrgcfVN7TBkgp0qYEW KrOtFaYpSVxp1NlrTVwwK21U8KqXcuF6lqkEPltqliRSDLyoKsB72AccJXw4R/dP8MUB KMjgPTf5Y8nLa18IChW8gHuGHXBNMX34yqWvLkpS1dD8kTPZSg/H9Btb6vgKZvdV+ADA 5zXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=n4cZ/5yYlF+5qg8dpUFnjdhAuVIYXjGBqkXlY12xX7o=; b=Sf5ye0iSpNnKyCfDUsZfPh8Y8PdSCW50l8qzL9Ft7jGXNPcBH3QSp+wQQqL6FCYO8m sI4wrdLgOUsRCPUViqGDBPsbc6yrok/x0fvJj1GWKFswpuHb0Ba4UZMxPcCLp7KGPg/H it6tcwq8teNp+jvA0TuopwM//bgSb3cydXtb+ionqDJiBU6gT8qc3aeFjSLeiHvb2Wzl 6AiSVt2XRav707jBOvmesaoGQsd3LLOWFCOvdvD+VbQwExZnO1EGdBAtAaHxyiHzJC8e +iSkeVvdx/By728bfypaBZmgmYyLj94htWAFROFBpGx6iKRAmonbJ2L6aobUaAN3wDut e1dQ== X-Gm-Message-State: AOAM5332KIU4icnRGyHFfNkGqW6pJRDq1vdZcdnYGprcMcNPYdSMljxM +BBOMRfUFWGFDUIg2OrcWA/IQ5wSPghDog== X-Google-Smtp-Source: ABdhPJwBPbMpPA3IZ71JGRTMg1Rfnnq35xsXHmUYcPGywWIVH/V44rINGU50Fn1u3RLLPm52QWeRSQ== X-Received: by 2002:a7b:cbc9:0:b0:390:4f85:cef1 with SMTP id n9-20020a7bcbc9000000b003904f85cef1mr14149196wmi.154.1650347473108; Mon, 18 Apr 2022 22:51:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/53] qtest: replace gettimeofday with GTimer Date: Tue, 19 Apr 2022 07:50:18 +0200 Message-Id: <20220419055109.142788-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::336; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348058518100001 From: Marc-Andr=C3=A9 Lureau glib provides a convenience helper to measure elapsed time. It isn't subject to wall-clock time changes. Note that this changes the initial OPENED time, which used to print the current time. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Laurent Vivier Message-Id: <20220307070401.171986-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- softmmu/qtest.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/softmmu/qtest.c b/softmmu/qtest.c index cc586233a9..010d11513d 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -58,12 +58,12 @@ static FILE *qtest_log_fp; static QTest *qtest; static GString *inbuf; static int irq_levels[MAX_IRQ]; -static qemu_timeval start_time; +static GTimer *timer; static bool qtest_opened; static void (*qtest_server_send)(void*, const char*); static void *qtest_server_send_opaque; =20 -#define FMT_timeval "%ld.%06ld" +#define FMT_timeval "%.06f" =20 /** * DOC: QTest Protocol @@ -264,28 +264,13 @@ static int hex2nib(char ch) } } =20 -static void qtest_get_time(qemu_timeval *tv) -{ - qemu_gettimeofday(tv); - tv->tv_sec -=3D start_time.tv_sec; - tv->tv_usec -=3D start_time.tv_usec; - if (tv->tv_usec < 0) { - tv->tv_usec +=3D 1000000; - tv->tv_sec -=3D 1; - } -} - static void qtest_send_prefix(CharBackend *chr) { - qemu_timeval tv; - if (!qtest_log_fp || !qtest_opened) { return; } =20 - qtest_get_time(&tv); - fprintf(qtest_log_fp, "[S +" FMT_timeval "] ", - (long) tv.tv_sec, (long) tv.tv_usec); + fprintf(qtest_log_fp, "[S +" FMT_timeval "] ", g_timer_elapsed(timer, = NULL)); } =20 static void G_GNUC_PRINTF(1, 2) qtest_log_send(const char *fmt, ...) @@ -386,12 +371,9 @@ static void qtest_process_command(CharBackend *chr, gc= har **words) command =3D words[0]; =20 if (qtest_log_fp) { - qemu_timeval tv; int i; =20 - qtest_get_time(&tv); - fprintf(qtest_log_fp, "[R +" FMT_timeval "]", - (long) tv.tv_sec, (long) tv.tv_usec); + fprintf(qtest_log_fp, "[R +" FMT_timeval "]", g_timer_elapsed(time= r, NULL)); for (i =3D 0; words[i]; i++) { fprintf(qtest_log_fp, " %s", words[i]); } @@ -846,21 +828,20 @@ static void qtest_event(void *opaque, QEMUChrEvent ev= ent) for (i =3D 0; i < ARRAY_SIZE(irq_levels); i++) { irq_levels[i] =3D 0; } - qemu_gettimeofday(&start_time); + + g_clear_pointer(&timer, g_timer_destroy); + timer =3D g_timer_new(); qtest_opened =3D true; if (qtest_log_fp) { - fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n", - (long) start_time.tv_sec, (long) start_time.tv_usec); + fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n", g_timer_= elapsed(timer, NULL)); } break; case CHR_EVENT_CLOSED: qtest_opened =3D false; if (qtest_log_fp) { - qemu_timeval tv; - qtest_get_time(&tv); - fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n", - (long) tv.tv_sec, (long) tv.tv_usec); + fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n", g_timer= _elapsed(timer, NULL)); } + g_clear_pointer(&timer, g_timer_destroy); break; default: break; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348011010459.0584661400726; Mon, 18 Apr 2022 23:00:11 -0700 (PDT) Received: from localhost ([::1]:43106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngguH-0001RC-Kx for importer@patchew.org; Tue, 19 Apr 2022 02:00:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggll-00014D-0k for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:21 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:41524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglf-0004Mx-7x for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:16 -0400 Received: by mail-wr1-x432.google.com with SMTP id e21so20910477wrc.8 for ; Mon, 18 Apr 2022 22:51:14 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8n7YayO6LjazF33AzTer7fETugLn5e3eb7rT2O0tPOk=; b=EdJwcLwxoUCobNmf8bWK3jnDdBIe2idRq3Ll1H8HyrUJGkSLlEPxy0EeMRf0ZZ1a+B 3L+bJhMx3aIzaGBM83/hd27AmwcOWmkQqvazYBLo9CvEnp3x8wpszPU7B0sOKV70vsU3 oZCMows528jTtmrEc0d+cJDhSZV3Q+2CvhRgQyItpARoCqGMU/w/4JoZ3rIYoGGTRxHi rvUwxBSW573Ny0RvA8UiDWBpJ9Fi2Z8PHS3OmXKsdeMClvDHpHOTcBo4pMJgnRDVmgIW TVU/jJUg6wHN3shWPIUbRuB5w8wiI6+c0fmzxMspFIeOd0uQSaAO0shE1WEPOw1CqQgo tTcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8n7YayO6LjazF33AzTer7fETugLn5e3eb7rT2O0tPOk=; b=W0pCLPD+q4wiSHXkx2EFhgZLxFhG7BBue/CU7xTD6TJn7bFSVQXw5m9h4/0nPxZFKG hZiPahnKNfS7K4PsVa0RICAMBzAhsQb7JvU7TSe9ZSAnKOD9oGSNhVmDlR5IS76BTvsd U6ltKq0gNAXPxsKxgNTQ9ba9cfUpHTK+KRKvGBOIWxAoK7RB7eS4ofdFX9NcSclkexI/ XgmtCNlnYwhJDxGUp1HDmXa2MvRYSCTK2VYWuwcDmilM7VM5QxC2jyrMkyqRpbhlU4Ck tHW+7iO0VD6c+NqYxZWuJwNcgmIEvFLLzDFClISsBYFyrwUXyhLu6Ixh+QjhQ9ywALLt +fuw== X-Gm-Message-State: AOAM530+6joaDJoMx8PSofIOuv3mxx9fk9J1Di8OlQQ5Qhgjy+d1KCLp TY9LYNYoRNpbUs9QTUJycR+YsVPmuay6BQ== X-Google-Smtp-Source: ABdhPJy3tEsc4eCvWdLMJwCyCqSK7NPfxkzQMvkNUtaqdyLgVonyRNZ1Gq0xBCO/QWK7QSZJqIrJ9w== X-Received: by 2002:a05:6000:1002:b0:207:a28a:c86a with SMTP id a2-20020a056000100200b00207a28ac86amr10349321wrx.361.1650347473844; Mon, 18 Apr 2022 22:51:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/53] qga: replace qemu_gettimeofday() with g_get_real_time() Date: Tue, 19 Apr 2022 07:50:19 +0200 Message-Id: <20220419055109.142788-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::432; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Thomas Huth , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348012320100001 From: Marc-Andr=C3=A9 Lureau GLib g_get_real_time() is an alternative to gettimeofday() which allows to simplify our code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Laurent Vivier Reviewed-by: Thomas Huth Message-Id: <20220307070401.171986-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- qga/commands-posix.c | 14 -------------- qga/commands-win32.c | 19 ------------------- qga/commands.c | 5 +++++ 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 75dbaab68e..1e7b4656ed 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -136,20 +136,6 @@ void qmp_guest_shutdown(bool has_mode, const char *mod= e, Error **errp) /* succeeded */ } =20 -int64_t qmp_guest_get_time(Error **errp) -{ - int ret; - qemu_timeval tq; - - ret =3D qemu_gettimeofday(&tq); - if (ret < 0) { - error_setg_errno(errp, errno, "Failed to get time"); - return -1; - } - - return tq.tv_sec * 1000000000LL + tq.tv_usec * 1000; -} - void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) { int ret; diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 3c428213db..15b451f0a4 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -1751,25 +1751,6 @@ static int64_t filetime_to_ns(const FILETIME *tf) - W32_FT_OFFSET) * 100; } =20 -int64_t qmp_guest_get_time(Error **errp) -{ - SYSTEMTIME ts =3D {0}; - FILETIME tf; - - GetSystemTime(&ts); - if (ts.wYear < 1601 || ts.wYear > 30827) { - error_setg(errp, "Failed to get time"); - return -1; - } - - if (!SystemTimeToFileTime(&ts, &tf)) { - error_setg(errp, "Failed to convert system time: %d", (int)GetLast= Error()); - return -1; - } - - return filetime_to_ns(&tf); -} - void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) { Error *local_err =3D NULL; diff --git a/qga/commands.c b/qga/commands.c index 72e6022207..4e9ce25b2e 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -585,3 +585,8 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, bool= has_count, =20 return read_data; } + +int64_t qmp_guest_get_time(Error **errp) +{ + return g_get_real_time() * 1000; +} --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650347715000837.631645312603; Mon, 18 Apr 2022 22:55:15 -0700 (PDT) Received: from localhost ([::1]:34824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggpV-000465-GB for importer@patchew.org; Tue, 19 Apr 2022 01:55:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggll-00014G-0r for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:21 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:43718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglf-0004NC-VS for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:17 -0400 Received: by mail-wm1-x32f.google.com with SMTP id n40-20020a05600c3ba800b0038ff1939b16so758269wms.2 for ; Mon, 18 Apr 2022 22:51:15 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t+3LdBJV/rZeTy+qN4yAh7U4LPW5rzRkkDNQUskmZd8=; b=CUmuXuzsuQtMVg7gAhaID5sfGi+mF3CWvtKkBZQXeccQV8U8NNxxDNO+lEGqFyX2uo olOxyzDdxN4PlcaIoSHxnTqf9CVCgYAYruALaIU5nXrKlznm83JYIZgF2xCeEXjLooMO OdeLJ9s2429+ReBn++3z6mEaSvcU9TvBEUZHGKW4XPS5MmvHAHezYLngxQCp7wUZmE4y RVPya4WR9DVRxLPS5acNlkHQIYhXgbTzmR1xzg91deWMSxLF1g/SsoMOxjTrwEof67Mq T6EySpkp8LuFgXj2mOUWAlt/gs7UGQZQpw47HNDvhjRV9ycqSdW/+u0JWh7q/MuKB5FP 45gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=t+3LdBJV/rZeTy+qN4yAh7U4LPW5rzRkkDNQUskmZd8=; b=sm6lJJDUMDYV9JSbL1j95HC1rzxngx6+gOql4qHLMLNPeV5nLbdjrBBLR+6Fn/kfTZ KZ3qRgZPpzlepLYJwikiM1VGGH9OlPNG1vLj/eNTcw3La4qU+q0UcKx/1MZcvN/vwjyO WI89eU5I3xP/kMndfCEsTjIl1fWBVHfOkg75Yw6xdFJEhpLDA2TIx2FCIzQXEUpUq6ys xVE0gCEP9F1LLuMg1nYR3Xtfov2QkQsHSXqNcPdDiL0dGrkDfpsaezgyd1wPfTtre1D7 iCPsg7yYxfrwJbYo5JgA9kvoSyy9TCKBeT1De/VHVYuyJ5YtFnuHE+jAcwdo3ID9Ljoc oGbA== X-Gm-Message-State: AOAM532LRNaG4Fsn5PDtkMJiiF42upM0BPLgvl91YUmT0cCWbfxrA6d7 iG8qbLq0VtPlOqg1ED9d9M5LymXMPcG7gA== X-Google-Smtp-Source: ABdhPJynoheNT/yq9K3ovgIQ3vFUVB2o5MSQwF84989QNH3qeL+/Ziohfmyi0zw2BJKaoG+YNWFgOw== X-Received: by 2002:a1c:cc01:0:b0:37b:dcc8:7dfd with SMTP id h1-20020a1ccc01000000b0037bdcc87dfdmr14418074wmb.134.1650347474548; Mon, 18 Apr 2022 22:51:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/53] Replace qemu_gettimeofday() with g_get_real_time() Date: Tue, 19 Apr 2022 07:50:20 +0200 Message-Id: <20220419055109.142788-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650347716630100001 From: Marc-Andr=C3=A9 Lureau GLib g_get_real_time() is an alternative to gettimeofday() which allows to simplify our code. For semihosting, a few bits are lost on POSIX host, but this shouldn't be a big concern. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Laurent Vivier Message-Id: <20220307070401.171986-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- blockdev.c | 8 ++++---- hw/rtc/m41t80.c | 6 +++--- hw/virtio/virtio-balloon.c | 9 +-------- qapi/qmp-event.c | 9 +++------ qemu-img.c | 8 ++++---- target/m68k/m68k-semi.c | 22 ++++++++++------------ target/nios2/nios2-semi.c | 23 ++++++++++------------- 7 files changed, 35 insertions(+), 50 deletions(-) diff --git a/blockdev.c b/blockdev.c index e46e831212..9230888e34 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1258,7 +1258,7 @@ static void internal_snapshot_prepare(BlkActionState = *common, BlockDriverState *bs; QEMUSnapshotInfo old_sn, *sn; bool ret; - qemu_timeval tv; + int64_t rt; BlockdevSnapshotInternal *internal; InternalSnapshotState *state; AioContext *aio_context; @@ -1328,9 +1328,9 @@ static void internal_snapshot_prepare(BlkActionState = *common, /* 3. take the snapshot */ sn =3D &state->sn; pstrcpy(sn->name, sizeof(sn->name), name); - qemu_gettimeofday(&tv); - sn->date_sec =3D tv.tv_sec; - sn->date_nsec =3D tv.tv_usec * 1000; + rt =3D g_get_real_time(); + sn->date_sec =3D rt / G_USEC_PER_SEC; + sn->date_nsec =3D (rt % G_USEC_PER_SEC) * 1000; sn->vm_clock_nsec =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (replay_mode !=3D REPLAY_MODE_NONE) { sn->icount =3D replay_get_current_icount(); diff --git a/hw/rtc/m41t80.c b/hw/rtc/m41t80.c index a00971a67e..e045c864bb 100644 --- a/hw/rtc/m41t80.c +++ b/hw/rtc/m41t80.c @@ -47,7 +47,7 @@ static uint8_t m41t80_recv(I2CSlave *i2c) { M41t80State *s =3D M41T80(i2c); struct tm now; - qemu_timeval tv; + int64_t rt; =20 if (s->addr < 0) { s->addr =3D 0; @@ -57,8 +57,8 @@ static uint8_t m41t80_recv(I2CSlave *i2c) } switch (s->addr++) { case 0: - qemu_gettimeofday(&tv); - return to_bcd(tv.tv_usec / 10000); + rt =3D g_get_real_time(); + return to_bcd((rt % G_USEC_PER_SEC) / 10000); case 1: return to_bcd(now.tm_sec); case 2: diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 163d244eb4..8f1b38ef5c 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -452,7 +452,6 @@ static void virtio_balloon_receive_stats(VirtIODevice *= vdev, VirtQueue *vq) VirtQueueElement *elem; VirtIOBalloonStat stat; size_t offset =3D 0; - qemu_timeval tv; =20 elem =3D virtqueue_pop(vq, sizeof(VirtQueueElement)); if (!elem) { @@ -484,13 +483,7 @@ static void virtio_balloon_receive_stats(VirtIODevice = *vdev, VirtQueue *vq) s->stats[tag] =3D val; } s->stats_vq_offset =3D offset; - - if (qemu_gettimeofday(&tv) < 0) { - warn_report("%s: failed to get time of day", __func__); - goto out; - } - - s->stats_last_update =3D tv.tv_sec; + s->stats_last_update =3D g_get_real_time() / G_USEC_PER_SEC; =20 out: if (balloon_stats_enabled(s)) { diff --git a/qapi/qmp-event.c b/qapi/qmp-event.c index 19d3cd0038..0fe0d0a5a6 100644 --- a/qapi/qmp-event.c +++ b/qapi/qmp-event.c @@ -20,15 +20,12 @@ =20 static void timestamp_put(QDict *qdict) { - int err; QDict *ts; - qemu_timeval tv; + int64_t rt =3D g_get_real_time(); =20 - err =3D qemu_gettimeofday(&tv); - /* Put -1 to indicate failure of getting host time */ ts =3D qdict_from_jsonf_nofail("{ 'seconds': %lld, 'microseconds': %ll= d }", - err < 0 ? -1LL : (long long)tv.tv_sec, - err < 0 ? -1LL : (long long)tv.tv_usec); + (long long)rt / G_USEC_PER_SEC, + (long long)rt % G_USEC_PER_SEC); qdict_put(qdict, "timestamp", ts); } =20 diff --git a/qemu-img.c b/qemu-img.c index 1caddfb23a..cf63db7655 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -3305,11 +3305,11 @@ static int img_snapshot(int argc, char **argv) char *filename, *snapshot_name =3D NULL; int c, ret =3D 0, bdrv_oflags; int action =3D 0; - qemu_timeval tv; bool quiet =3D false; Error *err =3D NULL; bool image_opts =3D false; bool force_share =3D false; + int64_t rt; =20 bdrv_oflags =3D BDRV_O_RDWR; /* Parse commandline parameters */ @@ -3406,9 +3406,9 @@ static int img_snapshot(int argc, char **argv) memset(&sn, 0, sizeof(sn)); pstrcpy(sn.name, sizeof(sn.name), snapshot_name); =20 - qemu_gettimeofday(&tv); - sn.date_sec =3D tv.tv_sec; - sn.date_nsec =3D tv.tv_usec * 1000; + rt =3D g_get_real_time(); + sn.date_sec =3D rt / G_USEC_PER_SEC; + sn.date_nsec =3D (rt % G_USEC_PER_SEC) * 1000; =20 ret =3D bdrv_snapshot_create(bs, &sn); if (ret) { diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index c5c164e096..37343d47e2 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -378,19 +378,17 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) arg0, arg1); return; } else { - qemu_timeval tv; struct gdb_timeval *p; - result =3D qemu_gettimeofday(&tv); - if (result =3D=3D 0) { - if (!(p =3D lock_user(VERIFY_WRITE, - arg0, sizeof(struct gdb_timeval), 0)))= { - /* FIXME - check error code? */ - result =3D -1; - } else { - p->tv_sec =3D cpu_to_be32(tv.tv_sec); - p->tv_usec =3D cpu_to_be64(tv.tv_usec); - unlock_user(p, arg0, sizeof(struct gdb_timeval)); - } + int64_t rt =3D g_get_real_time(); + p =3D lock_user(VERIFY_WRITE, arg0, sizeof(struct gdb_timeval)= , 0); + if (!p) { + /* FIXME - check error code? */ + result =3D -1; + } else { + result =3D 0; + p->tv_sec =3D cpu_to_be32(rt / G_USEC_PER_SEC); + p->tv_usec =3D cpu_to_be64(rt % G_USEC_PER_SEC); + unlock_user(p, arg0, sizeof(struct gdb_timeval)); } } break; diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index 5a7ad0c710..3decf6924c 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -400,20 +400,17 @@ void do_nios2_semihosting(CPUNios2State *env) arg0, 0); return; } else { - qemu_timeval tv; struct gdb_timeval *p; - result =3D qemu_gettimeofday(&tv); - if (result =3D=3D 0) { - p =3D lock_user(VERIFY_WRITE, arg0, sizeof(struct gdb_time= val), - 0); - if (!p) { - result =3D -1; - errno =3D EFAULT; - } else { - p->tv_sec =3D cpu_to_be32(tv.tv_sec); - p->tv_usec =3D cpu_to_be64(tv.tv_usec); - unlock_user(p, arg0, sizeof(struct gdb_timeval)); - } + int64_t rt =3D g_get_real_time(); + p =3D lock_user(VERIFY_WRITE, arg0, sizeof(struct gdb_timeval)= , 0); + if (!p) { + result =3D -1; + errno =3D EFAULT; + } else { + result =3D 0; + p->tv_sec =3D cpu_to_be32(rt / G_USEC_PER_SEC); + p->tv_usec =3D cpu_to_be64(rt % G_USEC_PER_SEC); + unlock_user(p, arg0, sizeof(struct gdb_timeval)); } } break; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650347716933944.2243155538426; Mon, 18 Apr 2022 22:55:16 -0700 (PDT) Received: from localhost ([::1]:35008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggpX-0004EO-SW for importer@patchew.org; Tue, 19 Apr 2022 01:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggll-00014H-0p for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:21 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:37706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglg-0004NL-Jo for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:17 -0400 Received: by mail-wr1-x435.google.com with SMTP id t1so20933108wra.4 for ; Mon, 18 Apr 2022 22:51:16 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mPuqrCMV9aD2M+alYk9Azn6BTL3OZnvdkF5lNEL9Dco=; b=Uv1FeH5S7RPw4D2XeuCtPhtHmui6emsO2LPqJcRkdEfqWZEvhbdzz9cy1pvoxfMG7+ bIjXsp9adBTQvYA3oHMpjr8oJdZCi/8o4nStHeHMz7v5wNNuYP4tK1XBmALV8Z5x51p5 C1JItGwSa2xEZ37J/QFZOMpiszSPSbFnnUOJxsx1l/Kx9ej7UikrqPBJcwUaidJVqXxQ HlyVMCw2hWuMuisK2i/1UuHNqabuWZTcvG7S/CNE7dQbDWF9A5eh0q5n6gMDbclwC7Pj ZTcTPnJs/B/sMrnlm0xsMbHpU2oJNZ+ep7Fd8gerfsZ/bmzTo3t0KsbtS8sxvG2wZ/mC 6FAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mPuqrCMV9aD2M+alYk9Azn6BTL3OZnvdkF5lNEL9Dco=; b=k/ImS7ZPziZGSVouD7h06HC2RvYCxZmGzei0wzesRXxO0LaciPEDlKpHYRtjoAquP/ flOUw20rEAWWuSxK5tbM9/q1KS/EdxBPYdDA4AJVJoPDJK47iRVYT3Fmx+CzKouZSQDm wl0uJKyqi9+nvnq96N+USUaVmtM3u2llMJST2paGO+tzuFxkLShLOYuCYOatgXMnqrYP QSvI/clvG0bb7w+QjxPMIhHTIVFKm+uBGH2e8K5eOYE4dw/Q5EYllq3iF/tdwkK07txb mBjtdEntnC6DIPKj040e6Thf5MVQhzv9YEFj9lsdp05RLyk/oE1ZpNVwQrcv1zHFV7tC d/YQ== X-Gm-Message-State: AOAM530rDw7wZI8PvKp4CbLIroIwdJI8WH2I1gLwhzvJHWSnlQrZ9KX/ +YhkMRkZUt+L8ZLj+oT8dJ9sPBuJj7WRyw== X-Google-Smtp-Source: ABdhPJzGHUEiXXxV7nsvPd0cqdj/jdpiJC/Yg6nnSyhM0yhzb9DPgpBsAvxS41oYNQdKQVrK2hqvCw== X-Received: by 2002:a5d:6487:0:b0:20a:a600:c512 with SMTP id o7-20020a5d6487000000b0020aa600c512mr1476295wri.560.1650347475221; Mon, 18 Apr 2022 22:51:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/53] oslib: drop qemu_gettimeofday() Date: Tue, 19 Apr 2022 07:50:21 +0200 Message-Id: <20220419055109.142788-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , Laurent Vivier , Stefan Weil Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650347718411100005 From: Marc-Andr=C3=A9 Lureau No longer used after the previous patches. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Laurent Vivier Reviewed-by: Stefan Weil Reviewed-by: Richard Henderson Message-Id: <20220307070401.171986-6-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/sysemu/os-posix.h | 3 --- include/sysemu/os-win32.h | 6 ------ util/oslib-win32.c | 20 -------------------- 3 files changed, 29 deletions(-) diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index dd64fb401d..23bd45457d 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -52,9 +52,6 @@ int os_mlock(void); #define closesocket(s) close(s) #define ioctlsocket(s, r, v) ioctl(s, r, v) =20 -typedef struct timeval qemu_timeval; -#define qemu_gettimeofday(tp) gettimeofday(tp, NULL) - int os_set_daemonize(bool d); bool is_daemonized(void); =20 diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index 770752222a..1351d1d29e 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -71,12 +71,6 @@ int getpagesize(void); # define EPROTONOSUPPORT EINVAL #endif =20 -typedef struct { - long tv_sec; - long tv_usec; -} qemu_timeval; -int qemu_gettimeofday(qemu_timeval *tp); - static inline int os_set_daemonize(bool d) { if (d) { diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 4b1ce0be4b..f139c069ae 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -230,26 +230,6 @@ void qemu_set_cloexec(int fd) { } =20 -/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */ -#define _W32_FT_OFFSET (116444736000000000ULL) - -int qemu_gettimeofday(qemu_timeval *tp) -{ - union { - unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - if(tp) { - GetSystemTimeAsFileTime (&_now.ft); - tp->tv_usec=3D(long)((_now.ns100 / 10ULL) % 1000000ULL ); - tp->tv_sec=3D (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL); - } - /* Always return 0 as per Open Group Base Specifications Issue 6. - Do not set errno on error. */ - return 0; -} - int qemu_get_thread_id(void) { return GetCurrentThreadId(); --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348059084441.91560612243825; Mon, 18 Apr 2022 23:00:59 -0700 (PDT) Received: from localhost ([::1]:43584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggv4-0001lt-30 for importer@patchew.org; Tue, 19 Apr 2022 02:00:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglm-00015u-4j for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:22 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglk-0004Ng-Lc for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:21 -0400 Received: by mail-wr1-x42f.google.com with SMTP id bv16so3773308wrb.9 for ; Mon, 18 Apr 2022 22:51:17 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EXWN0NPJeSTfBvuDOtzTDGQVHiiTkyUdgw6vbV3xhLg=; b=OGC6pqsT6ils2/M+32ODqHBWblLeHBe5J4vfClzTM1nikGc2kLJ3HUErJp3Xr/8IVT 2txzRkBIosVf4S7WTUepXlgQ6U06cEEVv5mAVTbC6lJ7XUkaD7uxLfTLGD+bxYgZRN7m 4xK/zcvNQMi7IWcUQyWkVUhhRj6pugl4ZSndu31f0+RWf+a9QuAzMRV19eDc8FdcycSq vNnVf/AtFaU7VBJpTHeBv2MjHRHRYwZq2M2Z7AD0lmw3KEK6DJG5s7XRqaIzEs2ySUAR e4/ZyLupKLro1cTeReZZHWhBMPXxCkzlcoWb74R7bAVuCPFQYHUBgl0Cnh1AxX9E4ltM K18A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EXWN0NPJeSTfBvuDOtzTDGQVHiiTkyUdgw6vbV3xhLg=; b=dYIpAFEI8v5U9RJsB+4r8EykHvdZelfVArfOxM/0XPMvU9LSYzcpLbAO0PEljY/FV7 CgejGiYLzQhlLclfGGeReslBGVjblkCzgPTOC3+3VAgs9dRRliwcGDcYXUyWD7IHmbqE eThKnLOgJ44cJIvx6UG7wvpVFmbcPkbU+spGRjeEnp8smYDDGxolOV/65uAC6ZaRe0JH 7M0Ch0xbKEsxgMmcQ6QFuqS0WrDW4K9/zmbKzrOwo1ftGTIDUHmLaLZj1HGWMa/CR8z2 G0nl+NlabdT9Yg23UbfFeXabbBubcKu3zaO4zY1H1X9+nXiG/5ZPTg5571XJ5wWH+Pgx 39+Q== X-Gm-Message-State: AOAM531G4APBr+iEkiNG5+FfdP2lL6IWCqUjLFGfTkSdtWwGUfQEYEdr FxrnExUInWB5NUDuThqIyLzJMDSLx0+T3Q== X-Google-Smtp-Source: ABdhPJzDYHDUDoGNaJTGg1KF7DxeV3z2boJlLDf6eo8oRCL+kVL5zYcmV0kdkB4wQUDk90HfqVyPzw== X-Received: by 2002:adf:e194:0:b0:207:b4c9:31c6 with SMTP id az20-20020adfe194000000b00207b4c931c6mr10302227wrb.102.1650347476134; Mon, 18 Apr 2022 22:51:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/53] meson: use chardev_ss dependencies Date: Tue, 19 Apr 2022 07:50:22 +0200 Message-Id: <20220419055109.142788-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348060520100005 From: Marc-Andr=C3=A9 Lureau chardev subsystem/library doesn't use gnutls. Use the dedicated chardev_ss.dependencies() instead. Looking at history, it was added in commit 3eacf70bb5a83e ("meson: Propagate gnutls dependency") because crypto/tlscreds.h included GnuTLS. This was cleaned-up later by commit 678bcc3c2cf222 ("crypto: Make QCryptoTLSCreds* structures private"). Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 861de93c4f..6e4a3d6326 100644 --- a/meson.build +++ b/meson.build @@ -3091,7 +3091,7 @@ qmp =3D declare_dependency(link_whole: [libqmp]) =20 libchardev =3D static_library('chardev', chardev_ss.sources() + genh, name_suffix: 'fa', - dependencies: [gnutls], + dependencies: chardev_ss.dependencies(), build_by_default: false) =20 chardev =3D declare_dependency(link_whole: libchardev) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349286128962.217190089311; Mon, 18 Apr 2022 23:21:26 -0700 (PDT) Received: from localhost ([::1]:40444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghEq-0002fj-MO for importer@patchew.org; Tue, 19 Apr 2022 02:21:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggln-00017p-Lu for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:44964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglk-0004Nu-Oh for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:23 -0400 Received: by mail-wr1-x42b.google.com with SMTP id b19so20892854wrh.11 for ; Mon, 18 Apr 2022 22:51:17 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EDEwZcar5ORv8ksYrfaNq2fJBsxyVQXuyRjJVQkoz+k=; b=guKZU4fq1ncPJZjVVeOeUoMXnLWBHUslw8v1M+cs/MXVwo7O0kUW7TXsMKxlFMWM6Y 6WuQ8Vbdv3iZZSmhRPNiu2WOOp2KdQPc8R1nXS5b00N7aMJPwsgNZGWr7YsxxKPpuf3P R0BxADgG/gBdizhsrPONx+G/yX8SPF7NpcQxTyS8WRMoCw0979h9oq5fja9XrF3p5i/2 iEhiRYKFGJohbrc7LIpdf8K0BiwAfDDj7HzLpRo97WQzFydhFT7tMA09qDzaBFXYZfyd sgvmEJJroNA0/SUszobfZjNTpKCVQcqAJIbfNnHh7h/8pXaJY02/PqESHpz7CFJHGsFr 0l1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EDEwZcar5ORv8ksYrfaNq2fJBsxyVQXuyRjJVQkoz+k=; b=V0uK91bqa+nGEtUUMacYCyoNdRuLmEYOEYDoRyRSA6yRv6czbxTXVecNaiF5y1eL8i CuyLrk34sTYUXmwTkGVFODvOm8uit2QSmg8WR7eOjZ+fXcCMl8KM9zgUEpPRjA5FeOLv sFdSlcbHfSMYZtx/I/ZT8ogViuNudpZdXDU4oh7eXAYtzpiJb1sIR1SknnrJkTaBZtPH jAMmgGB+Wf/ycvm4C/ND8Fs9QWKMeNXrXccqqRiO0vmdZoqkBo/e/n403pysYWyDQ4db 1ppjWbsP4IckBqTwZub/ENZex/67yjowQtXdvC0lo4uRzcQzyPRo48L7g2KXKUc0fQ9J pY5w== X-Gm-Message-State: AOAM531sCFbA7Oi6H8vcxeJio8qmu4ix/D9JnW6BBQ4+uDytEBSBxpC/ yMn/hQSOT9JqekhY0Q2PhKZ5cDFxOhuOSA== X-Google-Smtp-Source: ABdhPJzA5HfS0YHOhf3ESBm1Jx1GwQ3vhrKE1mI/RnJIeU1+Clmh+1kJVBwDpkJnI/6GpcxeJyGHGg== X-Received: by 2002:a05:6000:2c8:b0:20a:9587:76c1 with SMTP id o8-20020a05600002c800b0020a958776c1mr6204902wry.335.1650347476950; Mon, 18 Apr 2022 22:51:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/53] meson: add util dependency for oslib-posix on freebsd Date: Tue, 19 Apr 2022 07:50:23 +0200 Message-Id: <20220419055109.142788-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349288287100001 From: Marc-Andr=C3=A9 Lureau kinfo_getproc() requires it. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- util/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/meson.build b/util/meson.build index f6ee74ad0c..bb0b010662 100644 --- a/util/meson.build +++ b/util/meson.build @@ -11,7 +11,11 @@ util_ss.add(when: linux_io_uring, if_true: files('fdmon-= io_uring.c')) util_ss.add(when: 'CONFIG_POSIX', if_true: files('compatfd.c')) util_ss.add(when: 'CONFIG_POSIX', if_true: files('event_notifier-posix.c')) util_ss.add(when: 'CONFIG_POSIX', if_true: files('mmap-alloc.c')) -util_ss.add(when: 'CONFIG_POSIX', if_true: files('oslib-posix.c')) +freebsd_dep =3D [] +if targetos =3D=3D 'freebsd' + freebsd_dep =3D util +endif +util_ss.add(when: 'CONFIG_POSIX', if_true: [files('oslib-posix.c'), freebs= d_dep]) util_ss.add(when: 'CONFIG_POSIX', if_true: [files('qemu-openpty.c'), util]) util_ss.add(when: 'CONFIG_POSIX', if_true: files('qemu-thread-posix.c')) util_ss.add(when: 'CONFIG_POSIX', if_true: files('memfd.c')) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348416439184.42802169008553; Mon, 18 Apr 2022 23:06:56 -0700 (PDT) Received: from localhost ([::1]:52176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh0o-0007mM-RL for importer@patchew.org; Tue, 19 Apr 2022 02:06:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggln-00017Z-Dt for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:55971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglk-0004Nz-Oe for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:23 -0400 Received: by mail-wm1-x330.google.com with SMTP id x3so9912972wmj.5 for ; Mon, 18 Apr 2022 22:51:18 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eZK2rqC2vWrEFFlHJZT8Otsp8kMdYCdYpi/DFD/DLZA=; b=MX5BNpRH/VZiB3Un+vQZWsMT/h+5dTr7FMJSBdAQvyNULLoJwGKmIpi8YcV2wM3SuZ 2W8WrSv/LRIMZ3hRa6ZRFOh+jj4GLroj8kiWPVuIFBvdA9FWRF99dfuhjbJSXI6eWdM6 9kfV7y9aCDKHyrY9iLjEe8i320hBxlH285Hp/8+2u7Rlc/52qKexxGRqwas9g3PxX2a4 0v0aRMXmWfcjzBYH1/6KqK7qL5In0Ogz0qCXGeRl+5xbpzdESYOK/o6NoijtzKcPaV9y JkRDeDjPc2uNcuuQS0uX21djax0MYA96ne7ifAWyz4foEPIM3GXJ70TuZoDNpZNaOfcu Y40g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eZK2rqC2vWrEFFlHJZT8Otsp8kMdYCdYpi/DFD/DLZA=; b=Xvq9ouEMN90hDT4OJ0OxFAEY/aC3hoNf+YrqhqwaIg74uiQis4bmxgguTRcGm3XO+M R8EUECsbcmzVPW7mwU+2slA3UMVhzjG0T1HVWwoxUPXD8+ypkX7K6f1EVSer63dyQqo6 BlM6Z7EcWiXVKGbHz7cYKYAkDkLczwMor0bYgCWqV5/GRSBhGUoALUv0+x+R4d85kCNo BsvPxXxayXfFLe3gEb4PxnYMP63D8G5NwDsGSN1DeEo00KAduzQKb70RWW5HHCMDdIZE Ad8OBTiwdFfIFsiKpJ/NCo1bT0dNJO38wCGziTcof2QZohTRtggGCLHR4eNaJRNj5nWY pbeA== X-Gm-Message-State: AOAM531ORzQHucx8vqUT9v8egpJjx8ua3FkFEcdJL5iwnTOtKYgsioZD yW9OHViuzuHpl17ycYh4DaHpNdJO+BLrlQ== X-Google-Smtp-Source: ABdhPJw5V+yohFLETdkGcqrfUBztQpYdOHSUeENx9Sa/8njjWccc/ZxprmZd9nVtj107jLvW0FOYww== X-Received: by 2002:a1c:7415:0:b0:38e:bbbf:52d9 with SMTP id p21-20020a1c7415000000b0038ebbbf52d9mr18201369wmc.104.1650347477488; Mon, 18 Apr 2022 22:51:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/53] meson: remove unneeded py3 Date: Tue, 19 Apr 2022 07:50:24 +0200 Message-Id: <20220419055109.142788-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::330; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348418228100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 1d05109eb4..4f691e8465 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,5 +1,3 @@ -py3 =3D import('python').find_installation() - subdir('bench') subdir('qemu-iotests') =20 --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348378550533.2096609238428; Mon, 18 Apr 2022 23:06:18 -0700 (PDT) Received: from localhost ([::1]:51578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh0C-0007NH-VV for importer@patchew.org; Tue, 19 Apr 2022 02:06:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggln-00017m-JI for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:45925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglk-0004O4-Oo for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:23 -0400 Received: by mail-wr1-x429.google.com with SMTP id w4so20897514wrg.12 for ; Mon, 18 Apr 2022 22:51:19 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KpYzn9e+2BJl3AATGH97VY+zEiMHNod8tqPkyqs6h/g=; b=MWrw5R/trAxDPY2RDZj6nHet1VXOPKp2eBOcsHsLJcbWinNfzv8AAR7q4zChZTBGVm OdXLx3InkGru0TqgO/ivzPip4RpNT5I7qoo+kiyadlikZbTNi0rkxL0dUj+rw0x8bn92 wjRzYZiCy6cLBdJvZ4jOJxkA4vmhKkjMftuPZVS9LsCXYelFq/uDwvS1a0ew3kA12+Op euMTubwfD6Ij014yvrjiDH1ROP0sjZkvZGLn98yszI7i+6CO+gSI4pS5jKxHt6kwrStt /Ouuyzdkc+uuU0Vm8il3N00oFqcRrck4vNDckLBCDdETn+1E07rVpHyjAq+nmqbk8zHM qElg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KpYzn9e+2BJl3AATGH97VY+zEiMHNod8tqPkyqs6h/g=; b=RgcUWaokp6qa0Yokdya2SXdnGXngyURu6ZIQttUUSoZbZ+utc7pyDlJGrKZLyAfiTp e3Ynw+EbTRBlKLHg2u1N62qKWAri4iCaZYBuW8XxORqp/gpxledgiPmWIoEBe1YOX10J VvMQqlULmDsv3vy3vucYXZJwtvZXE1jxPzLi/kMLFTUby5WVHLe505zWI7rqxJ2ln9wp /qaCYhY90uFPqEfDOVqveZ+9hPTxH/72P02g0rDZpDs+SNY9RBqxxEDs6h4wfzwXGiY5 tnBg8b8hRp/bKLi6ro0UwwDi5obE2Qpf8J6dAC06ZskGPytb3SELoJOgiXFcoCt8JaVU z2gA== X-Gm-Message-State: AOAM531kYS3BFG8TCJKpGypY9K5AA3yF+oOpKgLOWdbdd3UWKFmtP0TI B52lRG5FYFtERaqhnt1QP5clLPO71uVvyA== X-Google-Smtp-Source: ABdhPJz/JBZNp1S94rm5O/DMm/KYABs45i3UNbsO//hwMtAIYgDflA6Lq7vPoSONek93PYAGLNtfTw== X-Received: by 2002:a5d:6f0c:0:b0:20a:7db1:3408 with SMTP id ay12-20020a5d6f0c000000b0020a7db13408mr10381790wrb.267.1650347478181; Mon, 18 Apr 2022 22:51:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/53] meson: remove test-qdev-global-props dependency on testqapi Date: Tue, 19 Apr 2022 07:50:25 +0200 Message-Id: <20220419055109.142788-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::429; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348380351100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/unit/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 96b295263e..026e39f520 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -148,7 +148,7 @@ if have_system endif =20 tests +=3D { - 'test-qdev-global-props': [qom, hwcore, testqapi] + 'test-qdev-global-props': [qom, hwcore] } endif endif --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348896361463.75875475869225; Mon, 18 Apr 2022 23:14:56 -0700 (PDT) Received: from localhost ([::1]:60040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh8Y-00051S-7D for importer@patchew.org; Tue, 19 Apr 2022 02:14:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglo-00017q-6T for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:40576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglk-0004O9-Ow for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:23 -0400 Received: by mail-wm1-x32d.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso775027wme.5 for ; Mon, 18 Apr 2022 22:51:19 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TWxbtXPu+1/+uxFsKOOb95XBhCbVBGurTpR36AxoHwQ=; b=EUjvGJjc6oDrSAl2wpYQV2tjO4Y2R/0ilPj4cNrVY0+erusofALsAABxgT0IG/Tk6p JnaRdeoaXlL0JfotXxOd/JjQ+OpD0zPuIzhvP6HjGoChdOaNMe+7dSxHBaSVkUxFqAVD ofZk9wsx0QgCiLE9FvkDXohpmwUHsgd0gpnTdZK4XRghintncLIa44dZpXuNou8GGYPu bXkOB9jLjtzWJ+TAmt+6w4Gi9jOKBZaoEz6uWx3c5kux1bwjgA+plFb7N4BaMQAM38By rglSykU6l+o6fbnOw12IVEdOgR01cHZqglXH8m5jmXKOs3H14d49NtqY0Zve1VxNbeiS ZK8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TWxbtXPu+1/+uxFsKOOb95XBhCbVBGurTpR36AxoHwQ=; b=Vjb/3Fv8pRqz4IeBqGplaj5cT4fmdIcG1/bPy9YMZRbz24IDKWrP7NLljv2KqUDEX5 xkbJLsH7psdtFnwcx+O3Y2+FCH3gmG/4X84zX0OdICCWKq9NumY8oF9zQmxMoMUebsmy 4KaztFJ/wM0ELffwvKynvZZoVUw3wqw2CLUGNztddcFoy30naT2oGkFAUzcg41l09unL tvURQGYuwRI+es/9j0X2urVODhgZhQiqSTz/I3ogDUuAfJYbgEUqfY7vvxDF8UeqN7LW J+XRbhOR45WO1xYamM6BFgbX40gtJT8tnM7aDPZ8xGdHWYazkWhZtuyb2zUWVxksAt5o PKaQ== X-Gm-Message-State: AOAM532IQJ8NTjIt1Za3VIUCWs09oqkBKuL0NvI1hqsZdHpBh//nFjWi zVSE9SeGazrCaBjeNtGtPf5fn9bX261vEA== X-Google-Smtp-Source: ABdhPJyML9EqzF9tCUzd5JlxUZWvuVu8O4qaVyGdHc0jP8cDzlV2sh7XoUGElc3QeP2KDync5QKtKA== X-Received: by 2002:a1c:4e03:0:b0:38e:d730:11eb with SMTP id g3-20020a1c4e03000000b0038ed73011ebmr14660826wmh.191.1650347479007; Mon, 18 Apr 2022 22:51:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/53] char: move qemu_openpty_raw from util/ to char/ Date: Tue, 19 Apr 2022 07:50:26 +0200 Message-Id: <20220419055109.142788-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348897683100001 From: Marc-Andr=C3=A9 Lureau It is only needed by char-pty. Fix the code style while at it. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-6-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- chardev/char-pty.c | 111 +++++++++++++++++++++++++++++++++ chardev/meson.build | 4 +- include/qemu-common.h | 2 - util/meson.build | 1 - util/qemu-openpty.c | 139 ------------------------------------------ 5 files changed, 113 insertions(+), 144 deletions(-) delete mode 100644 util/qemu-openpty.c diff --git a/chardev/char-pty.c b/chardev/char-pty.c index a2d1e7c985..d73d8b2390 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -197,6 +197,117 @@ static void char_pty_finalize(Object *obj) qemu_chr_be_event(chr, CHR_EVENT_CLOSED); } =20 +#if defined HAVE_PTY_H +# include +#elif defined CONFIG_BSD +# include +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__Drag= onFly__) +# include +# else +# include +# endif +#elif defined CONFIG_SOLARIS +# include +# include +#else +# include +#endif + +#ifdef __sun__ + +#if !defined(HAVE_OPENPTY) +/* Once illumos has openpty(), this is going to be removed. */ +static int openpty(int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp) +{ + const char *slave; + int mfd =3D -1, sfd =3D -1; + + *amaster =3D *aslave =3D -1; + + mfd =3D open("/dev/ptmx", O_RDWR | O_NOCTTY); + if (mfd < 0) { + goto err; + } + + if (grantpt(mfd) =3D=3D -1 || unlockpt(mfd) =3D=3D -1) { + goto err; + } + + if ((slave =3D ptsname(mfd)) =3D=3D NULL) { + goto err; + } + + if ((sfd =3D open(slave, O_RDONLY | O_NOCTTY)) =3D=3D -1) { + goto err; + } + + if (ioctl(sfd, I_PUSH, "ptem") =3D=3D -1 || + (termp !=3D NULL && tcgetattr(sfd, termp) < 0)) { + goto err; + } + + *amaster =3D mfd; + *aslave =3D sfd; + + if (winp) { + ioctl(sfd, TIOCSWINSZ, winp); + } + + return 0; + +err: + if (sfd !=3D -1) { + close(sfd); + } + close(mfd); + return -1; +} +#endif + +static void cfmakeraw (struct termios *termios_p) +{ + termios_p->c_iflag &=3D + ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON= ); + termios_p->c_oflag &=3D ~OPOST; + termios_p->c_lflag &=3D ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + termios_p->c_cflag &=3D ~(CSIZE | PARENB); + termios_p->c_cflag |=3D CS8; + + termios_p->c_cc[VMIN] =3D 0; + termios_p->c_cc[VTIME] =3D 0; +} +#endif + +/* like openpty() but also makes it raw; return master fd */ +static int qemu_openpty_raw(int *aslave, char *pty_name) +{ + int amaster; + struct termios tty; +#if defined(__OpenBSD__) || defined(__DragonFly__) + char pty_buf[PATH_MAX]; +#define q_ptsname(x) pty_buf +#else + char *pty_buf =3D NULL; +#define q_ptsname(x) ptsname(x) +#endif + + if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) { + return -1; + } + + /* Set raw attributes on the pty. */ + tcgetattr(*aslave, &tty); + cfmakeraw(&tty); + tcsetattr(*aslave, TCSAFLUSH, &tty); + + if (pty_name) { + strcpy(pty_name, q_ptsname(amaster)); + } + + return amaster; +} + static void char_pty_open(Chardev *chr, ChardevBackend *backend, bool *be_opened, diff --git a/chardev/meson.build b/chardev/meson.build index 325ba2bdb9..664f77b887 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -12,11 +12,11 @@ chardev_ss.add(files( 'char-udp.c', 'char.c', )) -chardev_ss.add(when: 'CONFIG_POSIX', if_true: files( +chardev_ss.add(when: 'CONFIG_POSIX', if_true: [files( 'char-fd.c', 'char-parallel.c', 'char-pty.c', -)) +), util]) chardev_ss.add(when: 'CONFIG_WIN32', if_true: files( 'char-console.c', 'char-win-stdio.c', diff --git a/include/qemu-common.h b/include/qemu-common.h index f0fe07cd74..f9b3f85b81 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -31,8 +31,6 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t c= ount) =20 #ifndef _WIN32 int qemu_pipe(int pipefd[2]); -/* like openpty() but also makes it raw; return master fd */ -int qemu_openpty_raw(int *aslave, char *pty_name); #endif =20 void cpu_exec_init_all(void); diff --git a/util/meson.build b/util/meson.build index bb0b010662..f8f0643318 100644 --- a/util/meson.build +++ b/util/meson.build @@ -16,7 +16,6 @@ if targetos =3D=3D 'freebsd' freebsd_dep =3D util endif util_ss.add(when: 'CONFIG_POSIX', if_true: [files('oslib-posix.c'), freebs= d_dep]) -util_ss.add(when: 'CONFIG_POSIX', if_true: [files('qemu-openpty.c'), util]) util_ss.add(when: 'CONFIG_POSIX', if_true: files('qemu-thread-posix.c')) util_ss.add(when: 'CONFIG_POSIX', if_true: files('memfd.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: files('aio-win32.c')) diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c deleted file mode 100644 index 427f43a769..0000000000 --- a/util/qemu-openpty.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * qemu-openpty.c - * - * Copyright (c) 2003-2008 Fabrice Bellard - * Copyright (c) 2010 Red Hat, Inc. - * - * Wrapper function qemu_openpty() implementation. - * - * Permission is hereby granted, free of charge, to any person obtaining a= copy - * of this software and associated documentation files (the "Software"), t= o deal - * in the Software without restriction, including without limitation the r= ights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included= in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN - * THE SOFTWARE. - */ - -/* - * This is not part of oslib-posix.c because this function - * uses openpty() which often in -lutil, and if we add this - * dependency to oslib-posix.o, every app will have to be - * linked with -lutil. - */ - -#include "qemu/osdep.h" -#include "qemu-common.h" - -#if defined HAVE_PTY_H -# include -#elif defined CONFIG_BSD -# include -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__Drag= onFly__) -# include -# else -# include -# endif -#elif defined CONFIG_SOLARIS -# include -# include -#else -# include -#endif - -#ifdef __sun__ - -#if !defined(HAVE_OPENPTY) -/* Once illumos has openpty(), this is going to be removed. */ -static int openpty(int *amaster, int *aslave, char *name, - struct termios *termp, struct winsize *winp) -{ - const char *slave; - int mfd =3D -1, sfd =3D -1; - - *amaster =3D *aslave =3D -1; - - mfd =3D open("/dev/ptmx", O_RDWR | O_NOCTTY); - if (mfd < 0) - goto err; - - if (grantpt(mfd) =3D=3D -1 || unlockpt(mfd) =3D=3D -1) - goto err; - - if ((slave =3D ptsname(mfd)) =3D=3D NULL) - goto err; - - if ((sfd =3D open(slave, O_RDONLY | O_NOCTTY)) =3D=3D -1) - goto err; - - if (ioctl(sfd, I_PUSH, "ptem") =3D=3D -1 || - (termp !=3D NULL && tcgetattr(sfd, termp) < 0)) - goto err; - - *amaster =3D mfd; - *aslave =3D sfd; - - if (winp) - ioctl(sfd, TIOCSWINSZ, winp); - - return 0; - -err: - if (sfd !=3D -1) - close(sfd); - close(mfd); - return -1; -} -#endif - -static void cfmakeraw (struct termios *termios_p) -{ - termios_p->c_iflag &=3D - ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - termios_p->c_oflag &=3D ~OPOST; - termios_p->c_lflag &=3D ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - termios_p->c_cflag &=3D ~(CSIZE|PARENB); - termios_p->c_cflag |=3D CS8; - - termios_p->c_cc[VMIN] =3D 0; - termios_p->c_cc[VTIME] =3D 0; -} -#endif - -int qemu_openpty_raw(int *aslave, char *pty_name) -{ - int amaster; - struct termios tty; -#if defined(__OpenBSD__) || defined(__DragonFly__) - char pty_buf[PATH_MAX]; -#define q_ptsname(x) pty_buf -#else - char *pty_buf =3D NULL; -#define q_ptsname(x) ptsname(x) -#endif - - if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) { - return -1; - } - - /* Set raw attributes on the pty. */ - tcgetattr(*aslave, &tty); - cfmakeraw(&tty); - tcsetattr(*aslave, TCSAFLUSH, &tty); - - if (pty_name) { - strcpy(pty_name, q_ptsname(amaster)); - } - - return amaster; -} --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348924074268.6181518585074; Mon, 18 Apr 2022 23:15:24 -0700 (PDT) Received: from localhost ([::1]:60750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh8z-0005YR-2k for importer@patchew.org; Tue, 19 Apr 2022 02:15:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggls-00019I-W9 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:30 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:37705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggll-0004OR-PT for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:27 -0400 Received: by mail-wr1-x433.google.com with SMTP id t1so20933272wra.4 for ; Mon, 18 Apr 2022 22:51:21 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EudXO8h9XD9KUaDC7++TnDRZ/qGkK5mTD4IKIHzQbCQ=; b=b7U0KFtrrEvBUBEhd+6tPkKBggVrkcXn9rJnGy2fmRgmy8ACrGMUt6V0wq0Z8fvKUE ahz0UYyd4xKxiKOrZJwfIaWlDXHDBDeHqBtB4biGA+q1QyteCkyTVLKBq8Xz5NOjs5NZ BiNFN9VtMyMIw1hMPF9JMpiHZS003O7+oQiJk3OAlIICH+eN03WiJIT/aXQS2b4zPVzN ZLBZtMMBAeB9z8z7FqqO46NcnjJdY9YaXyj/thxspv+5pHwvoO6p43b+XnUa2FLSZkh/ F05IkRsaWYjL2fowZ33w5q06fDHylby1+ZMhW+f3xYdD0U7IU8RtnpFUO/JjJGaUAobN AkDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EudXO8h9XD9KUaDC7++TnDRZ/qGkK5mTD4IKIHzQbCQ=; b=i0ZgGHvMV2vqaPWBU1dv97zE3OKRutX6fvZ9F2P8rsP+tvaPpTKta62Z4/SZWhsm9c XuGXQxUFpyYm4MR22gwndvEZEbxU13f2GpvbHd6hJskaecHwBzDow1fOnFNGU+muSBB0 /uk0XP++iyl8dB+iDILttaAO9UwgYEt1Y9/d+1hvcCt0UGH3x6Khtq+N7aSHyJ80+2PR zRvyVn6V1wI49HsRkybBw+zXfdp/+2suizVe9bNs573fk44d/k4UaYVzYZf2NrlDQpCa RnchqAmvZIFTB4dodKbgsAiK8fNV2Z0wQ3SjFnkbnkdsqRpc/k1xVHU5fvcicPO0TCcN U+1Q== X-Gm-Message-State: AOAM5339vQ1WKJC+rMWnUuK3wDJ9KgUX70slPPVRVfTtFxKaFY6aPFxd EmHDOQw+2dhV8DWFT37oCsCn9NC192o84g== X-Google-Smtp-Source: ABdhPJziMynv27Ca4Y8LoBkZ/cYAU1HTZMlnS9TIb5YBgZF1pkpMO+WG6hMucUmQrFE50Qv9UnQcqw== X-Received: by 2002:a5d:588a:0:b0:204:1f46:cf08 with SMTP id n10-20020a5d588a000000b002041f46cf08mr10819875wrf.133.1650347479938; Mon, 18 Apr 2022 22:51:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/53] Replace config-time define HOST_WORDS_BIGENDIAN Date: Tue, 19 Apr 2022 07:50:27 +0200 Message-Id: <20220419055109.142788-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::433; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Halil Pasic , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348926082100001 From: Marc-Andr=C3=A9 Lureau Replace a config-time define with a compile time condition define (compatible with clang and gcc) that must be declared prior to its usage. This avoids having a global configure time define, but also prevents from bad usage, if the config header wasn't included before. This can help to make some code independent from qemu too. gcc supports __BYTE_ORDER__ from about 4.6 and clang from 3.2. Signed-off-by: Marc-Andr=C3=A9 Lureau [ For the s390x parts I'm involved in ] Acked-by: Halil Pasic Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-7-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 4 +- accel/tcg/atomic_template.h | 4 +- audio/audio.h | 2 +- audio/dbusaudio.c | 2 +- disas.c | 2 +- hw/core/loader.c | 4 +- hw/display/artist.c | 6 +-- hw/display/pl110_template.h | 6 +-- hw/display/pxa2xx_lcd.c | 2 +- hw/display/vga.c | 12 +++--- hw/display/virtio-gpu-gl.c | 2 +- hw/net/can/ctucan_core.h | 2 +- hw/net/vmxnet3.h | 4 +- hw/s390x/event-facility.c | 2 +- hw/virtio/vhost.c | 2 +- include/exec/cpu-all.h | 7 ++-- include/exec/cpu-common.h | 2 +- include/exec/memop.h | 2 +- include/exec/memory.h | 2 +- include/fpu/softfloat-types.h | 2 +- include/hw/core/cpu.h | 2 +- include/hw/i386/intel_iommu.h | 6 +-- include/hw/i386/x86-iommu.h | 4 +- include/hw/virtio/virtio-access.h | 6 +-- include/hw/virtio/virtio-gpu-bswap.h | 2 +- include/libdecnumber/dconfig.h | 2 +- include/net/eth.h | 2 +- include/qemu/bswap.h | 8 ++-- include/qemu/host-utils.h | 2 +- include/qemu/int128.h | 2 +- include/ui/qemu-pixman.h | 2 +- linux-user/arm/nwfpe/double_cpdo.c | 4 +- linux-user/arm/nwfpe/fpa11_cpdt.c | 4 +- linux-user/ppc/signal.c | 3 +- linux-user/syscall.c | 6 +-- meson.build | 1 - net/net.c | 4 +- net/util.h | 2 +- target/alpha/translate.c | 2 +- target/arm/cpu.h | 8 ++-- target/arm/crypto_helper.c | 2 +- target/arm/helper.c | 2 +- target/arm/kvm64.c | 4 +- target/arm/neon_helper.c | 2 +- target/arm/sve_helper.c | 4 +- target/arm/translate-a64.h | 2 +- target/arm/translate-sve.c | 6 +-- target/arm/translate-vfp.c | 2 +- target/arm/translate.c | 2 +- target/arm/vec_internal.h | 2 +- target/hppa/translate.c | 2 +- target/i386/cpu.h | 2 +- target/i386/tcg/translate.c | 2 +- target/mips/cpu.h | 2 +- target/mips/tcg/lmmi_helper.c | 2 +- target/mips/tcg/msa_helper.c | 54 ++++++++++++------------- target/ppc/arch_dump.c | 2 +- target/ppc/cpu.h | 2 +- target/ppc/int_helper.c | 22 +++++----- target/ppc/kvm.c | 4 +- target/ppc/mem_helper.c | 2 +- target/ppc/translate/vmx-impl.c.inc | 4 +- target/ppc/translate/vsx-impl.c.inc | 2 +- target/riscv/insn_trans/trans_rvv.c.inc | 4 +- target/riscv/vector_helper.c | 2 +- target/s390x/tcg/translate.c | 2 +- target/s390x/tcg/translate_vx.c.inc | 2 +- target/s390x/tcg/vec.h | 2 +- target/sparc/vis_helper.c | 4 +- target/xtensa/cpu.h | 2 +- tcg/aarch64/tcg-target.c.inc | 4 +- tcg/arm/tcg-target.c.inc | 4 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 10 ++--- tcg/riscv/tcg-target.c.inc | 4 +- tcg/tcg-op.c | 4 +- tcg/tcg.c | 12 +++--- tests/fp/platform.h | 4 +- tests/qtest/vhost-user-blk-test.c | 2 +- tests/qtest/virtio-blk-test.c | 2 +- ui/vdagent.c | 2 +- ui/vnc.c | 2 +- util/bitmap.c | 2 +- util/host-utils.c | 2 +- 84 files changed, 173 insertions(+), 174 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 5f1377ca04..1c129dc90c 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1202,8 +1202,8 @@ void kvm_hwpoison_page_add(ram_addr_t ram_addr) =20 static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size) { -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) - /* The kernel expects ioeventfd values in HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) + /* The kernel expects ioeventfd values in HOST_BIG_ENDIAN * endianness, but the memory core hands them in target endianness. * For example, PPC is always treated as big-endian even if running * on KVM and on PPC64LE. Correct here. diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h index fc165031e8..404a530f7c 100644 --- a/accel/tcg/atomic_template.h +++ b/accel/tcg/atomic_template.h @@ -63,7 +63,7 @@ the ATOMIC_NAME macro, and redefined below. */ #if DATA_SIZE =3D=3D 1 # define END -#elif defined(HOST_WORDS_BIGENDIAN) +#elif HOST_BIG_ENDIAN # define END _be #else # define END _le @@ -196,7 +196,7 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new) =20 /* Define reverse-host-endian atomic operations. Note that END is used within the ATOMIC_NAME macro. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define END _le #else # define END _be diff --git a/audio/audio.h b/audio/audio.h index cbb10f4816..3d5ecdecd5 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -32,7 +32,7 @@ =20 typedef void (*audio_callback_fn) (void *opaque, int avail); =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define AUDIO_HOST_ENDIANNESS 1 #else #define AUDIO_HOST_ENDIANNESS 0 diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index f178b47dee..a3d656d3b0 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -122,7 +122,7 @@ static size_t dbus_put_buffer_out(HWVoiceOut *hw, void = *buf, size_t size) return size; } =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define AUDIO_HOST_BE TRUE #else #define AUDIO_HOST_BE FALSE diff --git a/disas.c b/disas.c index 3dab4482d1..2d2565ac57 100644 --- a/disas.c +++ b/disas.c @@ -144,7 +144,7 @@ static void initialize_debug_host(CPUDebug *s) =20 s->info.read_memory_func =3D host_read_memory; s->info.print_address_func =3D host_print_address; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN s->info.endian =3D BFD_ENDIAN_BIG; #else s->info.endian =3D BFD_ENDIAN_LITTLE; diff --git a/hw/core/loader.c b/hw/core/loader.c index ca2f2431fb..8d9b2df6e7 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -474,7 +474,7 @@ ssize_t load_elf_ram_sym(const char *filename, ret =3D ELF_LOAD_NOT_ELF; goto fail; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN data_order =3D ELFDATA2MSB; #else data_order =3D ELFDATA2LSB; @@ -511,7 +511,7 @@ ssize_t load_elf_ram_sym(const char *filename, =20 static void bswap_uboot_header(uboot_image_header_t *hdr) { -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN bswap32s(&hdr->ih_magic); bswap32s(&hdr->ih_hcrc); bswap32s(&hdr->ih_time); diff --git a/hw/display/artist.c b/hw/display/artist.c index 1d877998b9..69a8f9eea8 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -26,7 +26,7 @@ #define TYPE_ARTIST "artist" OBJECT_DECLARE_SIMPLE_TYPE(ARTISTState, ARTIST) =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define ROP8OFF(_i) (3 - (_i)) #else #define ROP8OFF @@ -712,7 +712,7 @@ static void combine_write_reg(hwaddr addr, uint64_t val= , int size, void *out) * FIXME: is there a qemu helper for this? */ =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN addr ^=3D 3; #endif =20 @@ -1087,7 +1087,7 @@ static uint64_t combine_read_reg(hwaddr addr, int siz= e, void *in) * FIXME: is there a qemu helper for this? */ =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN addr ^=3D 3; #endif =20 diff --git a/hw/display/pl110_template.h b/hw/display/pl110_template.h index 877419aa81..0087785322 100644 --- a/hw/display/pl110_template.h +++ b/hw/display/pl110_template.h @@ -15,18 +15,18 @@ =20 #if ORDER =3D=3D 0 #define NAME glue(lblp_, BORDER) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define SWAP_WORDS 1 #endif #elif ORDER =3D=3D 1 #define NAME glue(bbbp_, BORDER) -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define SWAP_WORDS 1 #endif #else #define SWAP_PIXELS 1 #define NAME glue(lbbp_, BORDER) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define SWAP_WORDS 1 #endif #endif diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c index 0f06ed6e9f..7859c5d1cd 100644 --- a/hw/display/pxa2xx_lcd.c +++ b/hw/display/pxa2xx_lcd.c @@ -199,7 +199,7 @@ typedef struct QEMU_PACKED { SKIP_PIXEL(to); \ } while (0) =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define SWAP_WORDS 1 #endif =20 diff --git a/hw/display/vga.c b/hw/display/vga.c index a7a291fa20..737cfbde98 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -94,19 +94,19 @@ const uint8_t gr_mask[16] =3D { (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define PAT(x) cbswap_32(x) #else #define PAT(x) (x) #endif =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define BIG 1 #else #define BIG 0 #endif =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff) #else #define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) @@ -133,7 +133,7 @@ static const uint32_t mask16[16] =3D { =20 #undef PAT =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define PAT(x) (x) #else #define PAT(x) cbswap_32(x) @@ -1296,7 +1296,7 @@ static void vga_draw_text(VGACommonState *s, int full= _update) if (cx > cx_max) cx_max =3D cx; *ch_attr_ptr =3D ch_attr; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN ch =3D ch_attr >> 8; cattr =3D ch_attr & 0xff; #else @@ -1477,7 +1477,7 @@ static void vga_draw_graphic(VGACommonState *s, int f= ull_update) vga_draw_line_func *vga_draw_line =3D NULL; bool share_surface, force_shadow =3D false; pixman_format_code_t format; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bool byteswap =3D !s->big_endian_fb; #else bool byteswap =3D s->big_endian_fb; diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 6cc4313b1a..0bca887703 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -108,7 +108,7 @@ static void virtio_gpu_gl_device_realize(DeviceState *q= dev, Error **errp) { VirtIOGPU *g =3D VIRTIO_GPU(qdev); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN error_setg(errp, "virgl is not supported on bigendian platforms"); return; #endif diff --git a/hw/net/can/ctucan_core.h b/hw/net/can/ctucan_core.h index bbc09ae067..608307a631 100644 --- a/hw/net/can/ctucan_core.h +++ b/hw/net/can/ctucan_core.h @@ -31,7 +31,7 @@ #include "exec/hwaddr.h" #include "net/can_emu.h" =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define __LITTLE_ENDIAN_BITFIELD 1 #endif =20 diff --git a/hw/net/vmxnet3.h b/hw/net/vmxnet3.h index 5b3b76ba7a..bf4f6de74a 100644 --- a/hw/net/vmxnet3.h +++ b/hw/net/vmxnet3.h @@ -35,7 +35,7 @@ #define __le32 uint32_t #define __le64 uint64_t =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define __BIG_ENDIAN_BITFIELD #else #endif @@ -800,7 +800,7 @@ struct Vmxnet3_DriverShared { #undef __le16 #undef __le32 #undef __le64 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #undef __BIG_ENDIAN_BITFIELD #endif =20 diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 6fa47b889c..faa51aa4c7 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -28,7 +28,7 @@ typedef struct SCLPEventsBus { } SCLPEventsBus; =20 /* we need to save 32 bit chunks for compatibility */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define RECV_MASK_LOWER 1 #define RECV_MASK_UPPER 0 #else /* little endian host */ diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index b643f42ea4..e55ac32bf3 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -989,7 +989,7 @@ static inline bool vhost_needs_vring_endian(VirtIODevic= e *vdev) if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { return false; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_LITTLE; #else return vdev->device_endian =3D=3D VIRTIO_DEVICE_ENDIAN_BIG; diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index c0f0fab28a..f77070da5f 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -34,13 +34,14 @@ =20 /* some important defines: * - * HOST_WORDS_BIGENDIAN : if defined, the host cpu is big endian and + * HOST_BIG_ENDIAN : whether the host cpu is big endian and * otherwise little endian. * - * TARGET_WORDS_BIGENDIAN : same for target cpu + * TARGET_WORDS_BIGENDIAN : if defined, the host cpu is big endian and oth= erwise + * little endian. */ =20 -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) #define BSWAP_NEEDED #endif =20 diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 50a7d2912e..c7d50fac95 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -46,7 +46,7 @@ enum device_endian { DEVICE_LITTLE_ENDIAN, }; =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define DEVICE_HOST_ENDIAN DEVICE_BIG_ENDIAN #else #define DEVICE_HOST_ENDIAN DEVICE_LITTLE_ENDIAN diff --git a/include/exec/memop.h b/include/exec/memop.h index 2a885f3917..44f923ed46 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -28,7 +28,7 @@ typedef enum MemOp { MO_SIGN =3D 0x08, /* Sign-extended, otherwise zero-extended. */ =20 MO_BSWAP =3D 0x10, /* Host reverse endian. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN MO_LE =3D MO_BSWAP, MO_BE =3D 0, #else diff --git a/include/exec/memory.h b/include/exec/memory.h index 4d5997e6bb..e40653f0d1 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2931,7 +2931,7 @@ static inline MemOp devend_memop(enum device_endian e= nd) QEMU_BUILD_BUG_ON(DEVICE_HOST_ENDIAN !=3D DEVICE_LITTLE_ENDIAN && DEVICE_HOST_ENDIAN !=3D DEVICE_BIG_ENDIAN); =20 -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) /* Swap if non-host endianness or native (target) endianness */ return (end =3D=3D DEVICE_HOST_ENDIAN) ? 0 : MO_BSWAP; #else diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h index 8abd9ab4ec..7a6ea881d8 100644 --- a/include/fpu/softfloat-types.h +++ b/include/fpu/softfloat-types.h @@ -103,7 +103,7 @@ typedef struct { #define make_floatx80(exp, mant) ((floatx80) { mant, exp }) #define make_floatx80_init(exp, mant) { .low =3D mant, .high =3D exp } typedef struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t high, low; #else uint64_t low, high; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 136973655c..b0e2e5b9d2 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -187,7 +187,7 @@ struct CPUClass { typedef union IcountDecr { uint32_t u32; struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint16_t high; uint16_t low; #else diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 3b5ac869db..bfa982a419 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -145,7 +145,7 @@ enum { /* Interrupt Remapping Table Entry Definition */ union VTD_IR_TableEntry { struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __reserved_1:8; /* Reserved 1 */ uint32_t vector:8; /* Interrupt Vector */ uint32_t irte_mode:1; /* IRTE Mode */ @@ -172,7 +172,7 @@ union VTD_IR_TableEntry { #endif uint32_t dest_id; /* Destination ID */ uint16_t source_id; /* Source-ID */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t __reserved_2:44; /* Reserved 2 */ uint64_t sid_vtype:2; /* Source-ID Validation Type */ uint64_t sid_q:2; /* Source-ID Qualifier */ @@ -191,7 +191,7 @@ union VTD_IR_TableEntry { /* Programming format for MSI/MSI-X addresses */ union VTD_IR_MSIAddress { struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __head:12; /* Should always be: 0x0fee */ uint32_t index_l:15; /* Interrupt index bit 14-0 */ uint32_t int_mode:1; /* Interrupt format */ diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h index 5ba0c056d6..7637edb430 100644 --- a/include/hw/i386/x86-iommu.h +++ b/include/hw/i386/x86-iommu.h @@ -87,7 +87,7 @@ struct X86IOMMUIrq { struct X86IOMMU_MSIMessage { union { struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __addr_head:12; /* 0xfee */ uint32_t dest:8; uint32_t __reserved:8; @@ -108,7 +108,7 @@ struct X86IOMMU_MSIMessage { }; union { struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint16_t trigger_mode:1; uint16_t level:1; uint16_t __resved:3; diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-a= ccess.h index 6818a23a2d..90cbb77782 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -149,7 +149,7 @@ static inline uint64_t virtio_ldq_p(VirtIODevice *vdev,= const void *ptr) =20 static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian(vdev) ? s : bswap16(s); #else return virtio_access_is_big_endian(vdev) ? bswap16(s) : s; @@ -215,7 +215,7 @@ static inline void virtio_tswap16s(VirtIODevice *vdev, = uint16_t *s) =20 static inline uint32_t virtio_tswap32(VirtIODevice *vdev, uint32_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian(vdev) ? s : bswap32(s); #else return virtio_access_is_big_endian(vdev) ? bswap32(s) : s; @@ -229,7 +229,7 @@ static inline void virtio_tswap32s(VirtIODevice *vdev, = uint32_t *s) =20 static inline uint64_t virtio_tswap64(VirtIODevice *vdev, uint64_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian(vdev) ? s : bswap64(s); #else return virtio_access_is_big_endian(vdev) ? bswap64(s) : s; diff --git a/include/hw/virtio/virtio-gpu-bswap.h b/include/hw/virtio/virti= o-gpu-bswap.h index 5faac0d8d5..9124108485 100644 --- a/include/hw/virtio/virtio-gpu-bswap.h +++ b/include/hw/virtio/virtio-gpu-bswap.h @@ -29,7 +29,7 @@ virtio_gpu_ctrl_hdr_bswap(struct virtio_gpu_ctrl_hdr *hdr) static inline void virtio_gpu_bswap_32(void *ptr, size_t size) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN =20 size_t i; struct virtio_gpu_ctrl_hdr *hdr =3D (struct virtio_gpu_ctrl_hdr *) ptr; diff --git a/include/libdecnumber/dconfig.h b/include/libdecnumber/dconfig.h index 0f7dccef1f..2bc0ba7f14 100644 --- a/include/libdecnumber/dconfig.h +++ b/include/libdecnumber/dconfig.h @@ -28,7 +28,7 @@ 02110-1301, USA. */ =20 =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define WORDS_BIGENDIAN 1 #else #define WORDS_BIGENDIAN 0 diff --git a/include/net/eth.h b/include/net/eth.h index 7767ae880e..6e699b0d7a 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -159,7 +159,7 @@ struct tcp_hdr { u_short th_dport; /* destination port */ uint32_t th_seq; /* sequence number */ uint32_t th_ack; /* acknowledgment number */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN u_char th_off : 4, /* data offset */ th_x2:4; /* (unused) */ #else diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 2d3bb8bbed..9dff7c7dbb 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -84,7 +84,7 @@ static inline void bswap64s(uint64_t *s) *s =3D bswap64(*s); } =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define be_bswap(v, size) (v) #define le_bswap(v, size) glue(bswap, size)(v) #define be_bswaps(v, size) @@ -188,7 +188,7 @@ CPU_CONVERT(le, 64, uint64_t) * a compile-time constant if you pass in a constant. So this can be * used to initialize static variables. */ -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN # define const_le32(_x) \ ((((_x) & 0x000000ffU) << 24) | \ (((_x) & 0x0000ff00U) << 8) | \ @@ -211,7 +211,7 @@ typedef union { =20 typedef union { float64 d; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN struct { uint32_t upper; uint32_t lower; @@ -235,7 +235,7 @@ typedef union { =20 typedef union { float128 q; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN struct { uint32_t upmost; uint32_t upper; diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index ca979dc6cc..f19bd29105 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -88,7 +88,7 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, u= int32_t c) union { uint64_t ll; struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t high, low; #else uint32_t low, high; diff --git a/include/qemu/int128.h b/include/qemu/int128.h index 2c4064256c..37e07fd6dd 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -205,7 +205,7 @@ typedef struct Int128 Int128; * a union with other integer types). */ struct Int128 { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN int64_t hi; uint64_t lo; #else diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index 806ddcd7cd..0c775604d1 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -19,7 +19,7 @@ * feeding libjpeg / libpng and writing screenshots. */ =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8 # define PIXMAN_BE_x8r8g8b8 PIXMAN_x8r8g8b8 # define PIXMAN_BE_a8r8g8b8 PIXMAN_a8r8g8b8 diff --git a/linux-user/arm/nwfpe/double_cpdo.c b/linux-user/arm/nwfpe/doub= le_cpdo.c index 1cef380852..d45ece2e2f 100644 --- a/linux-user/arm/nwfpe/double_cpdo.c +++ b/linux-user/arm/nwfpe/double_cpdo.c @@ -150,7 +150,7 @@ unsigned int DoubleCPDO(const unsigned int opcode) case MNF_CODE: { unsigned int *p =3D (unsigned int*)&rFm; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN p[0] ^=3D 0x80000000; #else p[1] ^=3D 0x80000000; @@ -162,7 +162,7 @@ unsigned int DoubleCPDO(const unsigned int opcode) case ABS_CODE: { unsigned int *p =3D (unsigned int*)&rFm; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN p[0] &=3D 0x7fffffff; #else p[1] &=3D 0x7fffffff; diff --git a/linux-user/arm/nwfpe/fpa11_cpdt.c b/linux-user/arm/nwfpe/fpa11= _cpdt.c index c32b0c2faa..fee525937c 100644 --- a/linux-user/arm/nwfpe/fpa11_cpdt.c +++ b/linux-user/arm/nwfpe/fpa11_cpdt.c @@ -44,7 +44,7 @@ void loadDouble(const unsigned int Fn, target_ulong addr) unsigned int *p; p =3D (unsigned int*)&fpa11->fpreg[Fn].fDouble; fpa11->fType[Fn] =3D typeDouble; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* FIXME - handle failure of get_user() */ get_user_u32(p[0], addr); /* sign & exponent */ get_user_u32(p[1], addr + 4); @@ -147,7 +147,7 @@ void storeDouble(const unsigned int Fn, target_ulong ad= dr) default: val =3D fpa11->fpreg[Fn].fDouble; } /* FIXME - handle put_user() failures */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN put_user_u32(p[0], addr); /* msw */ put_user_u32(p[1], addr + 4); /* lsw */ #else diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index ce5a4682cd..ca29d64579 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -215,8 +215,7 @@ static target_ulong get_sigframe(struct target_sigactio= n *ka, return (oldsp - frame_size) & ~0xFUL; } =20 -#if ((defined(TARGET_WORDS_BIGENDIAN) && defined(HOST_WORDS_BIGENDIAN)) ||= \ - (!defined(HOST_WORDS_BIGENDIAN) && !defined(TARGET_WORDS_BIGENDIAN))) +#if defined(TARGET_WORDS_BIGENDIAN) =3D=3D HOST_BIG_ENDIAN #define PPC_VEC_HI 0 #define PPC_VEC_LO 1 #else diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f65045efe6..31ca8cc229 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8132,7 +8132,7 @@ static int is_proc_myself(const char *filename, const= char *entry) return 0; } =20 -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) || \ +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) || \ defined(TARGET_SPARC) || defined(TARGET_M68K) || defined(TARGET_HPPA) static int is_proc(const char *filename, const char *entry) { @@ -8140,7 +8140,7 @@ static int is_proc(const char *filename, const char *= entry) } #endif =20 -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) static int open_net_route(void *cpu_env, int fd) { FILE *fp; @@ -8226,7 +8226,7 @@ static int do_openat(void *cpu_env, int dirfd, const = char *pathname, int flags, { "stat", open_self_stat, is_proc_myself }, { "auxv", open_self_auxv, is_proc_myself }, { "cmdline", open_self_cmdline, is_proc_myself }, -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) { "/proc/net/route", open_net_route, is_proc }, #endif #if defined(TARGET_SPARC) || defined(TARGET_HPPA) diff --git a/meson.build b/meson.build index 6e4a3d6326..9abc30d5ce 100644 --- a/meson.build +++ b/meson.build @@ -1592,7 +1592,6 @@ config_host_data.set('QEMU_VERSION_MICRO', meson.proj= ect_version().split('.')[2] =20 config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) -config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() =3D=3D = 'big') =20 have_coroutine_pool =3D get_option('coroutine_pool') if get_option('debug_stack_usage') and have_coroutine_pool diff --git a/net/net.c b/net/net.c index f0d14dbfc1..9f17ab2044 100644 --- a/net/net.c +++ b/net/net.c @@ -524,7 +524,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) =20 int qemu_set_vnet_le(NetClientState *nc, bool is_le) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (!nc || !nc->info->set_vnet_le) { return -ENOSYS; } @@ -537,7 +537,7 @@ int qemu_set_vnet_le(NetClientState *nc, bool is_le) =20 int qemu_set_vnet_be(NetClientState *nc, bool is_be) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return 0; #else if (!nc || !nc->info->set_vnet_be) { diff --git a/net/util.h b/net/util.h index 358185fd50..288312979f 100644 --- a/net/util.h +++ b/net/util.h @@ -30,7 +30,7 @@ * Structure of an internet header, naked of options. */ struct ip { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint8_t ip_v:4, /* version */ ip_hl:4; /* header length */ #else diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 66768ab47a..4e887311ab 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -235,7 +235,7 @@ static TCGv dest_fpr(DisasContext *ctx, unsigned reg) static int get_flag_ofs(unsigned shift) { int ofs =3D offsetof(CPUAlphaState, flags); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN ofs +=3D 3 - (shift / 8); #else ofs +=3D shift / 8; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 23879de5fa..816aa0394e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -95,7 +95,7 @@ enum { * therefore useful to be able to pass TCG the offset of the least * significant half of a uint64_t struct member. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define offsetoflow32(S, M) (offsetof(S, M) + sizeof(uint32_t)) #define offsetofhigh32(S, M) offsetof(S, M) #else @@ -382,7 +382,7 @@ typedef struct CPUArchState { union { /* Fault address registers. */ struct { uint64_t _unused_far0; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t ifar_ns; uint32_t dfar_ns; uint32_t ifar_s; @@ -419,7 +419,7 @@ typedef struct CPUArchState { uint64_t c9_pminten; /* perf monitor interrupt enables */ union { /* Memory attribute redirection */ struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t _unused_mair_0; uint32_t mair1_ns; uint32_t mair0_ns; @@ -1093,7 +1093,7 @@ void aarch64_add_pauth_properties(Object *obj); */ static inline uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN int i; =20 for (i =3D 0; i < nr; ++i) { diff --git a/target/arm/crypto_helper.c b/target/arm/crypto_helper.c index 28a84c2dbd..4c8fd34aec 100644 --- a/target/arm/crypto_helper.c +++ b/target/arm/crypto_helper.c @@ -23,7 +23,7 @@ union CRYPTO_STATE { uint64_t l[2]; }; =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define CR_ST_BYTE(state, i) ((state).bytes[(15 - (i)) ^ 8]) #define CR_ST_WORD(state, i) ((state).words[(3 - (i)) ^ 2]) #else diff --git a/target/arm/helper.c b/target/arm/helper.c index 7d14650615..50d287f289 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8642,7 +8642,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const= ARMCPRegInfo *r, r2->cp =3D 15; } =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (r2->fieldoffset) { r2->fieldoffset +=3D sizeof(uint32_t); } diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index ccadfbbe72..9ec8875150 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -1023,7 +1023,7 @@ static int kvm_arch_put_fpsimd(CPUState *cs) =20 for (i =3D 0; i < 32; i++) { uint64_t *q =3D aa64_vfp_qreg(env, i); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t fp_val[2] =3D { q[1], q[0] }; reg.addr =3D (uintptr_t)fp_val; #else @@ -1242,7 +1242,7 @@ static int kvm_arch_get_fpsimd(CPUState *cs) if (ret) { return ret; } else { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t t; t =3D q[0], q[0] =3D q[1], q[1] =3D t; #endif diff --git a/target/arm/neon_helper.c b/target/arm/neon_helper.c index 338b9189d5..bc6c4a54e9 100644 --- a/target/arm/neon_helper.c +++ b/target/arm/neon_helper.c @@ -23,7 +23,7 @@ typedef struct \ { \ type v1; \ } neon_##name; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define NEON_TYPE2(name, type) \ typedef struct \ { \ diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index d45d088615..e0f9aa9983 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2802,7 +2802,7 @@ static void swap_memmove(void *vd, void *vs, size_t n) uintptr_t o =3D (d | s | n) & 7; size_t i; =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN o =3D 0; #endif switch (o) { @@ -2864,7 +2864,7 @@ static void swap_memzero(void *vd, size_t n) return; } =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN o =3D 0; #endif switch (o) { diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 58f50abca4..38884158aa 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -71,7 +71,7 @@ static inline int vec_reg_offset(DisasContext *s, int reg= no, { int element_size =3D 1 << size; int offs =3D element * element_size; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* This is complicated slightly because vfp.zregs[n].d[0] is * still the lowest and vfp.zregs[n].d[15] the highest of the * 256 byte vector, even on big endian systems. diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 2c23459e76..180e14d9f8 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2872,7 +2872,7 @@ static TCGv_i64 load_last_active(DisasContext *s, TCG= v_i32 last, * The final adjustment for the vector register base * is added via constant offset to the load. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* Adjust for element ordering. See vec_reg_offset. */ if (esz < 3) { tcg_gen_xori_i32(last, last, 8 - (1 << esz)); @@ -5711,7 +5711,7 @@ static void do_ldrq(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) * for this load operation. */ TCGv_i64 tmp =3D tcg_temp_new_i64(); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN poff +=3D 6; #endif tcg_gen_ld16u_i64(tmp, cpu_env, poff); @@ -5790,7 +5790,7 @@ static void do_ldro(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) * for this load operation. */ TCGv_i64 tmp =3D tcg_temp_new_i64(); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN poff +=3D 4; #endif tcg_gen_ld32u_i64(tmp, cpu_env, poff); diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 17f796e32a..6a95a67a69 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -93,7 +93,7 @@ uint64_t vfp_expand_imm(int size, uint8_t imm8) static inline long vfp_f16_offset(unsigned reg, bool top) { long offs =3D vfp_reg_offset(false, reg); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (!top) { offs +=3D 2; } diff --git a/target/arm/translate.c b/target/arm/translate.c index bf2196b9e2..e8dfa71364 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1158,7 +1158,7 @@ long neon_element_offset(int reg, int element, MemOp = memop) { int element_size =3D 1 << (memop & MO_SIZE); int ofs =3D element * element_size; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* * Calculate the offset assuming fully little-endian, * then XOR to account for the order of the 8-byte units. diff --git a/target/arm/vec_internal.h b/target/arm/vec_internal.h index 2a33558290..fb43a2380e 100644 --- a/target/arm/vec_internal.h +++ b/target/arm/vec_internal.h @@ -29,7 +29,7 @@ * The H1_ macros are used when performing byte arithmetic and then * casting the final pointer to a type of size N. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define H1(x) ((x) ^ 7) #define H1_2(x) ((x) ^ 6) #define H1_4(x) ((x) ^ 4) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 5c0b1eb274..0b83ee4d98 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -566,7 +566,7 @@ static void save_gpr(DisasContext *ctx, unsigned reg, T= CGv_reg t) } } =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define HI_OFS 0 # define LO_OFS 4 #else diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 982c532353..ccf627d2c5 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1248,7 +1248,7 @@ typedef struct BNDCSReg { #define BNDCFG_BNDPRESERVE 2ULL #define BNDCFG_BDIR_MASK TARGET_PAGE_MASK =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define ZMM_B(n) _b_ZMMReg[63 - (n)] #define ZMM_W(n) _w_ZMMReg[31 - (n)] #define ZMM_L(n) _l_ZMMReg[15 - (n)] diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index c393913fe0..3ba1c99fff 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -359,7 +359,7 @@ static void gen_update_cc_op(DisasContext *s) =20 #endif /* !TARGET_X86_64 */ =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define REG_B_OFFSET (sizeof(target_ulong) - 1) #define REG_H_OFFSET (sizeof(target_ulong) - 2) #define REG_W_OFFSET (sizeof(target_ulong) - 2) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 52ce08a94d..5335ac10a3 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -35,7 +35,7 @@ union fpr_t { *define FP_ENDIAN_IDX to access the same location * in the fpr_t union regardless of the host endianness */ -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN # define FP_ENDIAN_IDX 1 #else # define FP_ENDIAN_IDX 0 diff --git a/target/mips/tcg/lmmi_helper.c b/target/mips/tcg/lmmi_helper.c index abeb7736ae..2c8732525c 100644 --- a/target/mips/tcg/lmmi_helper.c +++ b/target/mips/tcg/lmmi_helper.c @@ -37,7 +37,7 @@ typedef union { } LMIValue; =20 /* Some byte ordering issues can be mitigated by XORing in the following. = */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define BYTE_ORDER_XOR(N) N #else # define BYTE_ORDER_XOR(N) 0 diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index 5667b1f0a1..389c42e4ba 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -4146,7 +4146,7 @@ void helper_msa_ilvev_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[8] =3D pws->b[9]; pwd->b[9] =3D pwt->b[9]; pwd->b[10] =3D pws->b[11]; @@ -4190,7 +4190,7 @@ void helper_msa_ilvev_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[4] =3D pws->h[5]; pwd->h[5] =3D pwt->h[5]; pwd->h[6] =3D pws->h[7]; @@ -4218,7 +4218,7 @@ void helper_msa_ilvev_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[2] =3D pws->w[3]; pwd->w[3] =3D pwt->w[3]; pwd->w[0] =3D pws->w[1]; @@ -4250,7 +4250,7 @@ void helper_msa_ilvod_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[7] =3D pwt->b[6]; pwd->b[6] =3D pws->b[6]; pwd->b[5] =3D pwt->b[4]; @@ -4294,7 +4294,7 @@ void helper_msa_ilvod_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[3] =3D pwt->h[2]; pwd->h[2] =3D pws->h[2]; pwd->h[1] =3D pwt->h[0]; @@ -4322,7 +4322,7 @@ void helper_msa_ilvod_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[1] =3D pwt->w[0]; pwd->w[0] =3D pws->w[0]; pwd->w[3] =3D pwt->w[2]; @@ -4354,7 +4354,7 @@ void helper_msa_ilvl_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[7] =3D pwt->b[15]; pwd->b[6] =3D pws->b[15]; pwd->b[5] =3D pwt->b[14]; @@ -4398,7 +4398,7 @@ void helper_msa_ilvl_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[3] =3D pwt->h[7]; pwd->h[2] =3D pws->h[7]; pwd->h[1] =3D pwt->h[6]; @@ -4426,7 +4426,7 @@ void helper_msa_ilvl_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[1] =3D pwt->w[3]; pwd->w[0] =3D pws->w[3]; pwd->w[3] =3D pwt->w[2]; @@ -4458,7 +4458,7 @@ void helper_msa_ilvr_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[8] =3D pws->b[0]; pwd->b[9] =3D pwt->b[0]; pwd->b[10] =3D pws->b[1]; @@ -4502,7 +4502,7 @@ void helper_msa_ilvr_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[4] =3D pws->h[0]; pwd->h[5] =3D pwt->h[0]; pwd->h[6] =3D pws->h[1]; @@ -4530,7 +4530,7 @@ void helper_msa_ilvr_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[2] =3D pws->w[0]; pwd->w[3] =3D pwt->w[0]; pwd->w[0] =3D pws->w[1]; @@ -4661,7 +4661,7 @@ void helper_msa_pckev_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[8] =3D pws->b[9]; pwd->b[10] =3D pws->b[13]; pwd->b[12] =3D pws->b[1]; @@ -4705,7 +4705,7 @@ void helper_msa_pckev_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[4] =3D pws->h[5]; pwd->h[6] =3D pws->h[1]; pwd->h[0] =3D pwt->h[5]; @@ -4733,7 +4733,7 @@ void helper_msa_pckev_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[2] =3D pws->w[3]; pwd->w[0] =3D pwt->w[3]; pwd->w[3] =3D pws->w[1]; @@ -4765,7 +4765,7 @@ void helper_msa_pckod_b(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->b[7] =3D pwt->b[6]; pwd->b[5] =3D pwt->b[2]; pwd->b[3] =3D pwt->b[14]; @@ -4810,7 +4810,7 @@ void helper_msa_pckod_h(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->h[3] =3D pwt->h[2]; pwd->h[1] =3D pwt->h[6]; pwd->h[7] =3D pws->h[2]; @@ -4838,7 +4838,7 @@ void helper_msa_pckod_w(CPUMIPSState *env, wr_t *pws =3D &(env->active_fpu.fpr[ws].wr); wr_t *pwt =3D &(env->active_fpu.fpr[wt].wr); =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN pwd->w[1] =3D pwt->w[0]; pwd->w[3] =3D pws->w[0]; pwd->w[0] =3D pwt->w[2]; @@ -5926,7 +5926,7 @@ void helper_msa_copy_s_b(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 16; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 8) { n =3D 8 - n - 1; } else { @@ -5940,7 +5940,7 @@ void helper_msa_copy_s_h(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 8; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 4) { n =3D 4 - n - 1; } else { @@ -5954,7 +5954,7 @@ void helper_msa_copy_s_w(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 4; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 2) { n =3D 2 - n - 1; } else { @@ -5975,7 +5975,7 @@ void helper_msa_copy_u_b(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 16; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 8) { n =3D 8 - n - 1; } else { @@ -5989,7 +5989,7 @@ void helper_msa_copy_u_h(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 8; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 4) { n =3D 4 - n - 1; } else { @@ -6003,7 +6003,7 @@ void helper_msa_copy_u_w(CPUMIPSState *env, uint32_t = rd, uint32_t ws, uint32_t n) { n %=3D 4; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 2) { n =3D 2 - n - 1; } else { @@ -6019,7 +6019,7 @@ void helper_msa_insert_b(CPUMIPSState *env, uint32_t = wd, wr_t *pwd =3D &(env->active_fpu.fpr[wd].wr); target_ulong rs =3D env->active_tc.gpr[rs_num]; n %=3D 16; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 8) { n =3D 8 - n - 1; } else { @@ -6035,7 +6035,7 @@ void helper_msa_insert_h(CPUMIPSState *env, uint32_t = wd, wr_t *pwd =3D &(env->active_fpu.fpr[wd].wr); target_ulong rs =3D env->active_tc.gpr[rs_num]; n %=3D 8; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 4) { n =3D 4 - n - 1; } else { @@ -6051,7 +6051,7 @@ void helper_msa_insert_w(CPUMIPSState *env, uint32_t = wd, wr_t *pwd =3D &(env->active_fpu.fpr[wd].wr); target_ulong rs =3D env->active_tc.gpr[rs_num]; n %=3D 4; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN if (n < 2) { n =3D 2 - n - 1; } else { diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index 993740897d..1139cead9f 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -161,7 +161,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, P= owerPCCPU *cpu) bool needs_byteswap; ppc_avr_t *avr =3D cpu_avr_ptr(&cpu->env, i); =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN needs_byteswap =3D s->dump_info.d_endian =3D=3D ELFDATA2LSB; #else needs_byteswap =3D s->dump_info.d_endian =3D=3D ELFDATA2MSB; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 047b24ba50..627e574127 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2642,7 +2642,7 @@ static inline bool lsw_reg_in_range(int start, int nr= egs, int rx) } =20 /* Accessors for FP, VMX and VSX registers */ -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define VsrB(i) u8[i] #define VsrSB(i) s8[i] #define VsrH(i) u16[i] diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 492f34c499..8c1674510b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -425,7 +425,7 @@ uint64_t helper_PEXTD(uint64_t src, uint64_t mask) =20 /*************************************************************************= ****/ /* Altivec extension helpers */ -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define VECTOR_FOR_INORDER_I(index, element) \ for (index =3D 0; index < ARRAY_SIZE(r->element); index++) #else @@ -1177,7 +1177,7 @@ XXGENPCV(XXGENPCVDM, 8) #undef XXGENPCV_LE_COMP #undef XXGENPCV =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define VBPERMQ_INDEX(avr, i) ((avr)->u8[(i)]) #define VBPERMD_INDEX(i) (i) #define VBPERMQ_DW(index) (((index) & 0x40) !=3D 0) @@ -1298,7 +1298,7 @@ void helper_vpmsumd(ppc_avr_t *r, ppc_avr_t *a, ppc_a= vr_t *b) } =20 =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define PKBIG 1 #else #define PKBIG 0 @@ -1307,7 +1307,7 @@ void helper_vpkpx(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) { int i, j; ppc_avr_t result; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN const ppc_avr_t *x[2] =3D { a, b }; #else const ppc_avr_t *x[2] =3D { b, a }; @@ -1516,7 +1516,7 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_= t *b) { int sh =3D (b->VsrB(0xf) >> 3) & 0xf; =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN memmove(&r->u8[0], &a->u8[sh], 16 - sh); memset(&r->u8[16 - sh], 0, sh); #else @@ -1525,7 +1525,7 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_= t *b) #endif } =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define ELEM_ADDR(VEC, IDX, SIZE) (&(VEC)->u8[IDX]) #else #define ELEM_ADDR(VEC, IDX, SIZE) (&(VEC)->u8[15 - (IDX)] - (SIZE) + 1) @@ -1554,7 +1554,7 @@ VINSX(W, uint32_t) VINSX(D, uint64_t) #undef ELEM_ADDR #undef VINSX -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define VEXTDVLX(NAME, SIZE) \ void helper_##NAME(CPUPPCState *env, ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t= *b, \ target_ulong index) = \ @@ -1593,7 +1593,7 @@ VEXTDVLX(VEXTDUHVLX, 2) VEXTDVLX(VEXTDUWVLX, 4) VEXTDVLX(VEXTDDVLX, 8) #undef VEXTDVLX -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define VEXTRACT(suffix, element) = \ void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t inde= x) \ { = \ @@ -1750,7 +1750,7 @@ void helper_vsro(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_= t *b) { int sh =3D (b->VsrB(0xf) >> 3) & 0xf; =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN memmove(&r->u8[sh], &a->u8[0], 16 - sh); memset(&r->u8[0], 0, sh); #else @@ -1867,7 +1867,7 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) } } =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define UPKHI 1 #define UPKLO 0 #else @@ -1974,7 +1974,7 @@ VGENERIC_DO(popcntd, u64) =20 #undef VGENERIC_DO =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define QW_ONE { .u64 =3D { 0, 1 } } #else #define QW_ONE { .u64 =3D { 1, 0 } } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index dc93b99189..d1f07c4f41 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -632,7 +632,7 @@ static int kvm_put_fp(CPUState *cs) uint64_t *fpr =3D cpu_fpr_ptr(&cpu->env, i); uint64_t *vsrl =3D cpu_vsrl_ptr(&cpu->env, i); =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN vsr[0] =3D float64_val(*fpr); vsr[1] =3D *vsrl; #else @@ -710,7 +710,7 @@ static int kvm_get_fp(CPUState *cs) strerror(errno)); return ret; } else { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN *fpr =3D vsr[0]; if (vsx) { *vsrl =3D vsr[1]; diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 39945d9ea5..f1c76a7750 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -461,7 +461,7 @@ uint32_t helper_stqcx_be_parallel(CPUPPCState *env, tar= get_ulong addr, =20 /*************************************************************************= ****/ /* Altivec extension helpers */ -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN #define HI_IDX 0 #define LO_IDX 1 #else diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 6101bca3fd..764ac45409 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -173,7 +173,7 @@ static void gen_mtvscr(DisasContext *ctx) =20 val =3D tcg_temp_new_i32(); bofs =3D avr_full_offset(rB(ctx->opcode)); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bofs +=3D 3 * 4; #endif =20 @@ -1692,7 +1692,7 @@ static void gen_vsplt(DisasContext *ctx, int vece) =20 /* Experimental testing shows that hardware masks the immediate. */ bofs +=3D (uimm << vece) & 15; -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN bofs ^=3D 15; bofs &=3D ~((1 << vece) - 1); #endif diff --git a/target/ppc/translate/vsx-impl.c.inc b/target/ppc/translate/vsx= -impl.c.inc index d1f6333314..7181a672d8 100644 --- a/target/ppc/translate/vsx-impl.c.inc +++ b/target/ppc/translate/vsx-impl.c.inc @@ -1552,7 +1552,7 @@ static bool trans_XXSPLTW(DisasContext *ctx, arg_XX2_= uim2 *a) tofs =3D vsr_full_offset(a->xt); bofs =3D vsr_full_offset(a->xb); bofs +=3D a->uim << MO_32; -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN bofs ^=3D 8 | 4; #endif =20 diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_tr= ans/trans_rvv.c.inc index 4ea7e41e1a..8d675db9a2 100644 --- a/target/riscv/insn_trans/trans_rvv.c.inc +++ b/target/riscv/insn_trans/trans_rvv.c.inc @@ -3293,7 +3293,7 @@ static void load_element(TCGv_i64 dest, TCGv_ptr base, /* offset of the idx element with base regsiter r */ static uint32_t endian_ofs(DisasContext *s, int r, int idx) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return vreg_ofs(s, r) + ((idx ^ (7 >> s->sew)) << s->sew); #else return vreg_ofs(s, r) + (idx << s->sew); @@ -3303,7 +3303,7 @@ static uint32_t endian_ofs(DisasContext *s, int r, in= t idx) /* adjust the index according to the endian */ static void endian_adjust(TCGv_i32 ofs, int sew) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_xori_i32(ofs, ofs, 7 >> sew); #endif } diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 3bd4aac9c9..7a6ce0a3bc 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -79,7 +79,7 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ul= ong s1, * Note that vector data is stored in host-endian 64-bit chunks, * so addressing units smaller than that needs a host-endian fixup. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define H1(x) ((x) ^ 7) #define H1_2(x) ((x) ^ 6) #define H1_4(x) ((x) ^ 4) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 5acfc0ff9b..80f1f0be9a 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -263,7 +263,7 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t e= nr, MemOp es) * 16 byte operations to handle it in a special way. */ g_assert(es <=3D MO_64); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN offs ^=3D (8 - bytes); #endif return offs + vec_full_reg_offset(reg); diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/transla= te_vx.c.inc index 98eb7710a4..b829ce0c7c 100644 --- a/target/s390x/tcg/translate_vx.c.inc +++ b/target/s390x/tcg/translate_vx.c.inc @@ -175,7 +175,7 @@ static void get_vec_element_ptr_i64(TCGv_ptr ptr, uint8= _t reg, TCGv_i64 enr, =20 /* convert it to an element offset relative to cpu_env (vec_reg_offset= () */ tcg_gen_shli_i64(tmp, tmp, es); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN tcg_gen_xori_i64(tmp, tmp, 8 - NUM_VEC_ELEMENT_BYTES(es)); #endif tcg_gen_addi_i64(tmp, tmp, vec_full_reg_offset(reg)); diff --git a/target/s390x/tcg/vec.h b/target/s390x/tcg/vec.h index a6e361869b..8d095efcfc 100644 --- a/target/s390x/tcg/vec.h +++ b/target/s390x/tcg/vec.h @@ -38,7 +38,7 @@ typedef union S390Vector { * W: [ 1][ 0] - [ 3][ 2] * DW: [ 0] - [ 1] */ -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define H1(x) ((x) ^ 7) #define H2(x) ((x) ^ 3) #define H4(x) ((x) ^ 1) diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c index f917e5992d..3afdc6975c 100644 --- a/target/sparc/vis_helper.c +++ b/target/sparc/vis_helper.c @@ -42,7 +42,7 @@ target_ulong helper_array8(target_ulong pixel_addr, targe= t_ulong cubesize) GET_FIELD_SP(pixel_addr, 11, 12); } =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define VIS_B64(n) b[7 - (n)] #define VIS_W64(n) w[3 - (n)] #define VIS_SW64(n) sw[3 - (n)] @@ -470,7 +470,7 @@ uint64_t helper_bshuffle(uint64_t gsr, uint64_t src1, u= int64_t src2) uint32_t i, mask, host; =20 /* Set up S such that we can index across all of the bytes. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN s.ll[0] =3D src1; s.ll[1] =3D src2; host =3D 0; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 4515f682aa..a572e831ae 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -494,7 +494,7 @@ typedef struct XtensaConfigList { struct XtensaConfigList *next; } XtensaConfigList; =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN enum { FP_F32_HIGH, FP_F32_LOW, diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 5e67f881f1..61e284bb5c 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1557,7 +1557,7 @@ static void tcg_out_adr(TCGContext *s, TCGReg rd, con= st void *target) */ static void * const qemu_ld_helpers[MO_SIZE + 1] =3D { [MO_8] =3D helper_ret_ldub_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] =3D helper_be_lduw_mmu, [MO_32] =3D helper_be_ldul_mmu, [MO_64] =3D helper_be_ldq_mmu, @@ -1574,7 +1574,7 @@ static void * const qemu_ld_helpers[MO_SIZE + 1] =3D { */ static void * const qemu_st_helpers[MO_SIZE + 1] =3D { [MO_8] =3D helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] =3D helper_be_stw_mmu, [MO_32] =3D helper_be_stl_mmu, [MO_64] =3D helper_be_stq_mmu, diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 4bc0420f4d..2c6c353eea 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1296,7 +1296,7 @@ static void tcg_out_vldst(TCGContext *s, ARMInsn insn, static void * const qemu_ld_helpers[MO_SSIZE + 1] =3D { [MO_UB] =3D helper_ret_ldub_mmu, [MO_SB] =3D helper_ret_ldsb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_UW] =3D helper_be_lduw_mmu, [MO_UL] =3D helper_be_ldul_mmu, [MO_UQ] =3D helper_be_ldq_mmu, @@ -1316,7 +1316,7 @@ static void * const qemu_ld_helpers[MO_SSIZE + 1] =3D= { */ static void * const qemu_st_helpers[MO_SIZE + 1] =3D { [MO_8] =3D helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] =3D helper_be_stw_mmu, [MO_32] =3D helper_be_stl_mmu, [MO_64] =3D helper_be_stq_mmu, diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 993149d18a..bd76f0c97f 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -26,7 +26,7 @@ =20 #include "../tcg-ldst.c.inc" =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define MIPS_BE 1 #else # define MIPS_BE 0 diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 1f3c5c171c..cfcd121f9c 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -1864,7 +1864,7 @@ void tb_target_set_jmp_target(uintptr_t tc_ptr, uintp= tr_t jmp_rx, i1 =3D ADDIS | TAI(TCG_REG_TB, TCG_REG_TB, hi >> 16); i2 =3D ADDI | TAI(TCG_REG_TB, TCG_REG_TB, lo); } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN pair =3D (uint64_t)i1 << 32 | i2; #else pair =3D (uint64_t)i2 << 32 | i1; @@ -3235,7 +3235,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType t= ype, unsigned vece, tcg_out_mem_long(s, 0, LVEBX, out, base, offset); } elt =3D extract32(offset, 0, 4); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^=3D 15; #endif tcg_out32(s, VSPLTB | VRT(out) | VRB(out) | (elt << 16)); @@ -3248,7 +3248,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType t= ype, unsigned vece, tcg_out_mem_long(s, 0, LVEHX, out, base, offset); } elt =3D extract32(offset, 1, 3); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^=3D 7; #endif tcg_out32(s, VSPLTH | VRT(out) | VRB(out) | (elt << 16)); @@ -3261,7 +3261,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType t= ype, unsigned vece, tcg_debug_assert((offset & 3) =3D=3D 0); tcg_out_mem_long(s, 0, LVEWX, out, base, offset); elt =3D extract32(offset, 2, 2); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^=3D 3; #endif tcg_out32(s, VSPLTW | VRT(out) | VRB(out) | (elt << 16)); @@ -3275,7 +3275,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType t= ype, unsigned vece, tcg_out_mem_long(s, 0, LVX, out, base, offset & -16); tcg_out_vsldoi(s, TCG_VEC_TMP1, out, out, 8); elt =3D extract32(offset, 3, 1); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt =3D !elt; #endif if (elt) { diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 6409d9c3d5..81a83e45b1 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -854,7 +854,7 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) static void * const qemu_ld_helpers[MO_SSIZE + 1] =3D { [MO_UB] =3D helper_ret_ldub_mmu, [MO_SB] =3D helper_ret_ldsb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_UW] =3D helper_be_lduw_mmu, [MO_SW] =3D helper_be_ldsw_mmu, [MO_UL] =3D helper_be_ldul_mmu, @@ -879,7 +879,7 @@ static void * const qemu_ld_helpers[MO_SSIZE + 1] =3D { */ static void * const qemu_st_helpers[MO_SIZE + 1] =3D { [MO_8] =3D helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] =3D helper_be_stw_mmu, [MO_32] =3D helper_be_stl_mmu, [MO_64] =3D helper_be_stq_mmu, diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 65e1c94c2d..5d48537927 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1156,7 +1156,7 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_= target_long offset) { /* Since arg2 and ret have different types, they cannot be the same temporary */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset); tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4); #else @@ -1167,7 +1167,7 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_= target_long offset) =20 void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset); tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4); #else diff --git a/tcg/tcg.c b/tcg/tcg.c index 33a97eabdb..f8542529d0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -51,7 +51,7 @@ #else # define ELF_CLASS ELFCLASS64 #endif -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define ELF_DATA ELFDATA2MSB #else # define ELF_DATA ELFDATA2LSB @@ -883,7 +883,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv= _ptr base, TCGTemp *base_ts =3D tcgv_ptr_temp(base); TCGTemp *ts =3D tcg_global_alloc(s); int indirect_reg =3D 0, bigendian =3D 0; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bigendian =3D 1; #endif =20 @@ -1547,7 +1547,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int narg= s, TCGTemp **args) } #else if (TCG_TARGET_REG_BITS < 64 && (typemask & 6) =3D=3D dh_typecode_= i64) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN op->args[pi++] =3D temp_arg(ret + 1); op->args[pi++] =3D temp_arg(ret); #else @@ -1600,7 +1600,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int narg= s, TCGTemp **args) * have to get more complicated to differentiate between * stack arguments and register arguments. */ -#if defined(HOST_WORDS_BIGENDIAN) !=3D defined(TCG_TARGET_STACK_GROWSUP) +#if HOST_BIG_ENDIAN !=3D defined(TCG_TARGET_STACK_GROWSUP) op->args[pi++] =3D temp_arg(args[i] + 1); op->args[pi++] =3D temp_arg(args[i]); #else @@ -3598,7 +3598,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) /* fall through */ =20 case TEMP_VAL_MEM: -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN endian_fixup =3D itype =3D=3D TCG_TYPE_I32 ? 4 : 8; endian_fixup -=3D 1 << vece; #else @@ -3879,7 +3879,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const T= CGOp *op) if (!itsh->mem_coherent) { temp_sync(s, itsh, s->reserved_regs, 0, 0); } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN TCGTemp *its =3D itsh; #else TCGTemp *its =3D itsl; diff --git a/tests/fp/platform.h b/tests/fp/platform.h index c20ba70baa..6c72ad0cd0 100644 --- a/tests/fp/platform.h +++ b/tests/fp/platform.h @@ -29,9 +29,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE O= F THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config-host.h" +#include "qemu/compiler.h" =20 -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define LITTLEENDIAN 1 /* otherwise do not define it */ #endif diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk= -test.c index 62e670f39b..659b5050d8 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -37,7 +37,7 @@ typedef struct QVirtioBlkReq { uint8_t status; } QVirtioBlkReq; =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN static const bool host_is_big_endian =3D true; #else static const bool host_is_big_endian; /* false */ diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index 2a23698211..f22594a1a8 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -33,7 +33,7 @@ typedef struct QVirtioBlkReq { } QVirtioBlkReq; =20 =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN const bool host_is_big_endian =3D true; #else const bool host_is_big_endian; /* false */ diff --git a/ui/vdagent.c b/ui/vdagent.c index 7ea4bc5d9a..02861edfb1 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -664,7 +664,7 @@ static void vdagent_chr_open(Chardev *chr, VDAgentChardev *vd =3D QEMU_VDAGENT_CHARDEV(chr); ChardevQemuVDAgent *cfg =3D backend->u.qemu_vdagent.data; =20 -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN /* * TODO: vdagent protocol is defined to be LE, * so we have to byteswap everything on BE hosts. diff --git a/ui/vnc.c b/ui/vnc.c index 310a873c21..5cbeebb8d1 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2340,7 +2340,7 @@ static void pixel_format_message (VncState *vs) { vnc_write_u8(vs, vs->client_pf.bits_per_pixel); /* bits-per-pixel */ vnc_write_u8(vs, vs->client_pf.depth); /* depth */ =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN vnc_write_u8(vs, 1); /* big-endian-flag */ #else vnc_write_u8(vs, 0); /* big-endian-flag */ diff --git a/util/bitmap.c b/util/bitmap.c index 1f201393ae..f81d8057a7 100644 --- a/util/bitmap.c +++ b/util/bitmap.c @@ -376,7 +376,7 @@ static void bitmap_to_from_le(unsigned long *dst, { long len =3D BITS_TO_LONGS(nbits); =20 -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN long index; =20 for (index =3D 0; index < len; index++) { diff --git a/util/host-utils.c b/util/host-utils.c index bcc772b8ec..96d5dc0bed 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -34,7 +34,7 @@ static inline void mul64(uint64_t *plow, uint64_t *phigh, typedef union { uint64_t ll; struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t high, low; #else uint32_t low, high; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349727108911.1541888283641; Mon, 18 Apr 2022 23:28:47 -0700 (PDT) Received: from localhost ([::1]:49796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghLx-0000mD-S0 for importer@patchew.org; Tue, 19 Apr 2022 02:28:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglt-00019L-1j for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:34 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglm-0004Od-JH for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:27 -0400 Received: by mail-wr1-x436.google.com with SMTP id u3so20941253wrg.3 for ; Mon, 18 Apr 2022 22:51:22 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ix/sBUkghawyvXNAtg4+299GFgUXewXIHtXQ1Ljug6g=; b=oyPETp0oN1Z1ZZs6+50mh4nqou3Nilo7qp85DlJ8VGiCAcpSnnby5MMGaWuLEvrLO4 X5BP79HQlhavDvTd7jT7EmND1RnWN79LkY4043VSrnqFlhfqs7raeCK/+D6Ku3xMCX9k 80KVhWU/+tRGVTSruonbIxZyu7mjWhLX6GPhYSChhdBv6w+mW8h3Ekf8BiFPHF20U4vw 84TmXUhhnt7tqJYpiWb6oBNky+5+X4tEN6KFy6d/sANxse1kAguRqAGN5LWbjD45AvF8 BUUxNZMrc/Xh5uHe+HRIo2TmP/+Sm2vQx+fEuPK4zLCZOi4WJOObx0VMXMb+cxwYbjDZ lGiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ix/sBUkghawyvXNAtg4+299GFgUXewXIHtXQ1Ljug6g=; b=vsXYzpmxue7+Z5Ce/pOHCMdU05nAwSzzyuxg23KSEPmDKIHYfCBm+jwBt091FKHGiB r2rTRykoA/xk3AocVHVWMZSpnhkf3TO2UbQFuUiZ4lgN2O9g1k3wm6GFSTltv2dpx1Em X9CthdNeECLNusbYBAAVymtxz7lso5F1ZEWtHooWB73nm38heXyTt/0HItGGaTMz0Uxn EZma3WGH0TEB+rs1wbqNKvePAdxAhBz42599hKhrvgjUEVt0AdVbDJq1kOnnRqq2v3PL 2KrFGvqQ0hp0zveYKRxAHI3L3ZNb4EP2xENH6zvG0cYFXyABLRZ9PEr9wXFYB3o6VsiP 3rag== X-Gm-Message-State: AOAM5327HDccAC6r1NwckUwrT3NsFrG6K8tUCEZgaiM3SMCVGK+haFNG XSdyR02L0syk34r6EqRR4A3w0voU2EiIiQ== X-Google-Smtp-Source: ABdhPJw3y0qPvUzpPdNdeaEa8RKLLRxeFkzx3CuMdetNw+LcdpcListafot6A9nRD6rJFq7s0jTL8A== X-Received: by 2002:adf:dc0b:0:b0:20a:a549:d3a6 with SMTP id t11-20020adfdc0b000000b0020aa549d3a6mr1898683wri.34.1650347480821; Mon, 18 Apr 2022 22:51:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/53] Replace TARGET_WORDS_BIGENDIAN Date: Tue, 19 Apr 2022 07:50:28 +0200 Message-Id: <20220419055109.142788-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::436; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Halil Pasic , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349728782100001 From: Marc-Andr=C3=A9 Lureau Convert the TARGET_WORDS_BIGENDIAN macro, similarly to what was done with HOST_BIG_ENDIAN. The new TARGET_BIG_ENDIAN macro is either 0 or 1, and thus should always be defined to prevent misuse. Signed-off-by: Marc-Andr=C3=A9 Lureau Suggested-by: Halil Pasic Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-8-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 2 +- bsd-user/qemu.h | 2 +- configs/targets/aarch64_be-linux-user.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- configs/targets/hppa-linux-user.mak | 2 +- configs/targets/hppa-softmmu.mak | 2 +- configs/targets/m68k-linux-user.mak | 2 +- configs/targets/m68k-softmmu.mak | 2 +- configs/targets/microblaze-linux-user.mak | 2 +- configs/targets/microblaze-softmmu.mak | 2 +- configs/targets/mips-linux-user.mak | 2 +- configs/targets/mips-softmmu.mak | 2 +- configs/targets/mips64-linux-user.mak | 2 +- configs/targets/mips64-softmmu.mak | 2 +- configs/targets/mipsn32-linux-user.mak | 2 +- configs/targets/or1k-linux-user.mak | 2 +- configs/targets/or1k-softmmu.mak | 2 +- configs/targets/ppc-linux-user.mak | 2 +- configs/targets/ppc-softmmu.mak | 2 +- configs/targets/ppc64-linux-user.mak | 2 +- configs/targets/ppc64-softmmu.mak | 2 +- configs/targets/s390x-linux-user.mak | 2 +- configs/targets/s390x-softmmu.mak | 2 +- configs/targets/sh4eb-linux-user.mak | 2 +- configs/targets/sh4eb-softmmu.mak | 2 +- configs/targets/sparc-linux-user.mak | 2 +- configs/targets/sparc-softmmu.mak | 2 +- configs/targets/sparc32plus-linux-user.mak | 2 +- configs/targets/sparc64-linux-user.mak | 2 +- configs/targets/sparc64-softmmu.mak | 2 +- configs/targets/xtensaeb-linux-user.mak | 2 +- configs/targets/xtensaeb-softmmu.mak | 2 +- cpu.c | 2 +- disas.c | 2 +- docs/devel/loads-stores.rst | 2 +- hw/arm/armv7m.c | 2 +- hw/display/vga.c | 2 +- hw/microblaze/boot.c | 2 +- hw/mips/gt64xxx_pci.c | 6 +++--- hw/mips/jazz.c | 2 +- hw/mips/malta.c | 24 +++++++++++----------- hw/mips/mipssim.c | 2 +- hw/nios2/boot.c | 2 +- hw/xtensa/sim.c | 2 +- hw/xtensa/xtfpga.c | 4 ++-- include/exec/cpu-all.h | 7 +++---- include/exec/cpu_ldst.h | 2 +- include/exec/gdbstub.h | 2 +- include/exec/memop.h | 2 +- include/exec/memory.h | 2 +- include/exec/poison.h | 2 +- include/hw/core/cpu.h | 2 +- include/hw/mips/bios.h | 2 +- include/hw/virtio/virtio-access.h | 2 +- linux-user/aarch64/cpu_loop.c | 2 +- linux-user/aarch64/signal.c | 4 ++-- linux-user/aarch64/target_syscall.h | 2 +- linux-user/arm/cpu_loop.c | 2 +- linux-user/arm/target_syscall.h | 2 +- linux-user/elfload.c | 6 +++--- linux-user/ppc/signal.c | 4 ++-- linux-user/ppc/target_syscall.h | 2 +- linux-user/qemu.h | 2 +- linux-user/syscall.c | 6 +++--- linux-user/uname.c | 2 +- linux-user/user-internals.h | 2 +- linux-user/xtensa/signal.c | 2 +- linux-user/xtensa/target_structs.h | 2 +- meson.build | 5 +++++ softmmu/memory.c | 2 +- softmmu/qtest.c | 2 +- target/arm/cpu.c | 2 +- target/arm/cpu.h | 8 ++++---- target/mips/cpu.c | 4 ++-- target/mips/tcg/msa_helper.c | 10 ++++----- target/ppc/cpu_init.c | 2 +- target/ppc/gdbstub.c | 4 ++-- target/ppc/mem_helper.c | 2 +- target/ppc/translate.c | 2 +- target/xtensa/cpu.h | 2 +- target/xtensa/overlay_tool.h | 2 +- target/xtensa/translate.c | 6 +++--- tests/tcg/xtensa/Makefile.softmmu-target | 2 +- 83 files changed, 120 insertions(+), 116 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 1c129dc90c..8d9d2367ee 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1202,7 +1202,7 @@ void kvm_hwpoison_page_add(ram_addr_t ram_addr) =20 static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size) { -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN /* The kernel expects ioeventfd values in HOST_BIG_ENDIAN * endianness, but the memory core hands them in target endianness. * For example, PPC is always treated as big-endian even if running diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 21c06f2e70..be6105385e 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -465,7 +465,7 @@ static inline void *lock_user_string(abi_ulong guest_ad= dr) static inline uint64_t target_arg64(uint32_t word0, uint32_t word1) { #if TARGET_ABI_BITS =3D=3D 32 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN return ((uint64_t)word0 << 32) | word1; #else return ((uint64_t)word1 << 32) | word0; diff --git a/configs/targets/aarch64_be-linux-user.mak b/configs/targets/aa= rch64_be-linux-user.mak index d3ee10c00f..7794424745 100644 --- a/configs/targets/aarch64_be-linux-user.mak +++ b/configs/targets/aarch64_be-linux-user.mak @@ -1,6 +1,6 @@ TARGET_ARCH=3Daarch64 TARGET_BASE_ARCH=3Darm -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml TARGET_HAS_BFLT=3Dy CONFIG_ARM_COMPATIBLE_SEMIHOSTING=3Dy diff --git a/configs/targets/armeb-linux-user.mak b/configs/targets/armeb-l= inux-user.mak index f81e5bf1fe..a249cc2e29 100644 --- a/configs/targets/armeb-linux-user.mak +++ b/configs/targets/armeb-linux-user.mak @@ -1,7 +1,7 @@ TARGET_ARCH=3Darm TARGET_SYSTBL_ABI=3Dcommon,oabi TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-v= fp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-prof= ile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=3Dy CONFIG_ARM_COMPATIBLE_SEMIHOSTING=3Dy diff --git a/configs/targets/hppa-linux-user.mak b/configs/targets/hppa-lin= ux-user.mak index f01e0a7b9e..db873a8796 100644 --- a/configs/targets/hppa-linux-user.mak +++ b/configs/targets/hppa-linux-user.mak @@ -2,4 +2,4 @@ TARGET_ARCH=3Dhppa TARGET_SYSTBL_ABI=3Dcommon,32 TARGET_SYSTBL=3Dsyscall.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/hppa-softmmu.mak b/configs/targets/hppa-softmm= u.mak index e3e71eb21b..44f07b0332 100644 --- a/configs/targets/hppa-softmmu.mak +++ b/configs/targets/hppa-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dhppa TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy diff --git a/configs/targets/m68k-linux-user.mak b/configs/targets/m68k-lin= ux-user.mak index 805d16c6ab..579b5d299c 100644 --- a/configs/targets/m68k-linux-user.mak +++ b/configs/targets/m68k-linux-user.mak @@ -1,6 +1,6 @@ TARGET_ARCH=3Dm68k TARGET_SYSTBL_ABI=3Dcommon TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/cf-core.xml gdb-xml/cf-fp.xml gdb-xml/m68k-cor= e.xml gdb-xml/m68k-fp.xml TARGET_HAS_BFLT=3Dy diff --git a/configs/targets/m68k-softmmu.mak b/configs/targets/m68k-softmm= u.mak index 5df1a2b7d7..bbcd0bada6 100644 --- a/configs/targets/m68k-softmmu.mak +++ b/configs/targets/m68k-softmmu.mak @@ -1,3 +1,3 @@ TARGET_ARCH=3Dm68k -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/cf-core.xml gdb-xml/cf-fp.xml gdb-xml/m68k-cor= e.xml gdb-xml/m68k-fp.xml diff --git a/configs/targets/microblaze-linux-user.mak b/configs/targets/mi= croblaze-linux-user.mak index 2a25bf2fa3..4249a37f65 100644 --- a/configs/targets/microblaze-linux-user.mak +++ b/configs/targets/microblaze-linux-user.mak @@ -1,5 +1,5 @@ TARGET_ARCH=3Dmicroblaze TARGET_SYSTBL_ABI=3Dcommon TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_HAS_BFLT=3Dy diff --git a/configs/targets/microblaze-softmmu.mak b/configs/targets/micro= blaze-softmmu.mak index 33f2a00402..8385e2d333 100644 --- a/configs/targets/microblaze-softmmu.mak +++ b/configs/targets/microblaze-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dmicroblaze -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy TARGET_NEED_FDT=3Dy diff --git a/configs/targets/mips-linux-user.mak b/configs/targets/mips-lin= ux-user.mak index 19f5779831..71fa77d464 100644 --- a/configs/targets/mips-linux-user.mak +++ b/configs/targets/mips-linux-user.mak @@ -3,4 +3,4 @@ TARGET_ABI_MIPSO32=3Dy TARGET_SYSTBL_ABI=3Do32 TARGET_SYSTBL=3Dsyscall_o32.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/mips-softmmu.mak b/configs/targets/mips-softmm= u.mak index 8a49999a47..7787a4d94c 100644 --- a/configs/targets/mips-softmmu.mak +++ b/configs/targets/mips-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dmips TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy diff --git a/configs/targets/mips64-linux-user.mak b/configs/targets/mips64= -linux-user.mak index 32fd1acdf2..5a4771f22d 100644 --- a/configs/targets/mips64-linux-user.mak +++ b/configs/targets/mips64-linux-user.mak @@ -4,4 +4,4 @@ TARGET_BASE_ARCH=3Dmips TARGET_SYSTBL_ABI=3Dn64 TARGET_SYSTBL=3Dsyscall_n64.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/mips64-softmmu.mak b/configs/targets/mips64-so= ftmmu.mak index ece25b9624..568d66650c 100644 --- a/configs/targets/mips64-softmmu.mak +++ b/configs/targets/mips64-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dmips64 TARGET_BASE_ARCH=3Dmips TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/mipsn32-linux-user.mak b/configs/targets/mipsn= 32-linux-user.mak index b8c2441ad0..1e80b302fc 100644 --- a/configs/targets/mipsn32-linux-user.mak +++ b/configs/targets/mipsn32-linux-user.mak @@ -5,4 +5,4 @@ TARGET_BASE_ARCH=3Dmips TARGET_SYSTBL_ABI=3Dn32 TARGET_SYSTBL=3Dsyscall_n32.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/or1k-linux-user.mak b/configs/targets/or1k-lin= ux-user.mak index 1dfb93e46d..39558f77ec 100644 --- a/configs/targets/or1k-linux-user.mak +++ b/configs/targets/or1k-linux-user.mak @@ -1,2 +1,2 @@ TARGET_ARCH=3Dopenrisc -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/or1k-softmmu.mak b/configs/targets/or1k-softmm= u.mak index 9e1d4a1fb1..263e970870 100644 --- a/configs/targets/or1k-softmmu.mak +++ b/configs/targets/or1k-softmmu.mak @@ -1,3 +1,3 @@ TARGET_ARCH=3Dopenrisc -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_NEED_FDT=3Dy diff --git a/configs/targets/ppc-linux-user.mak b/configs/targets/ppc-linux= -user.mak index ca4187e4aa..cc0439a528 100644 --- a/configs/targets/ppc-linux-user.mak +++ b/configs/targets/ppc-linux-user.mak @@ -1,5 +1,5 @@ TARGET_ARCH=3Dppc TARGET_SYSTBL_ABI=3Dcommon,nospu,32 TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/p= ower-altivec.xml gdb-xml/power-spe.xml diff --git a/configs/targets/ppc-softmmu.mak b/configs/targets/ppc-softmmu.= mak index f4eef1819a..774440108f 100644 --- a/configs/targets/ppc-softmmu.mak +++ b/configs/targets/ppc-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dppc -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/p= ower-altivec.xml gdb-xml/power-spe.xml TARGET_NEED_FDT=3Dy diff --git a/configs/targets/ppc64-linux-user.mak b/configs/targets/ppc64-l= inux-user.mak index 3133346676..4d81969f4a 100644 --- a/configs/targets/ppc64-linux-user.mak +++ b/configs/targets/ppc64-linux-user.mak @@ -3,5 +3,5 @@ TARGET_BASE_ARCH=3Dppc TARGET_ABI_DIR=3Dppc TARGET_SYSTBL_ABI=3Dcommon,nospu,64 TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml= /power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml diff --git a/configs/targets/ppc64-softmmu.mak b/configs/targets/ppc64-soft= mmu.mak index 84fbf46be9..ddf0c39617 100644 --- a/configs/targets/ppc64-softmmu.mak +++ b/configs/targets/ppc64-softmmu.mak @@ -1,6 +1,6 @@ TARGET_ARCH=3Dppc64 TARGET_BASE_ARCH=3Dppc -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml= /power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml TARGET_NEED_FDT=3Dy diff --git a/configs/targets/s390x-linux-user.mak b/configs/targets/s390x-l= inux-user.mak index 9e31ce6457..e2978248ed 100644 --- a/configs/targets/s390x-linux-user.mak +++ b/configs/targets/s390x-linux-user.mak @@ -1,5 +1,5 @@ TARGET_ARCH=3Ds390x TARGET_SYSTBL_ABI=3Dcommon,64 TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_XML_FILES=3D gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/= s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml = gdb-xml/s390-gs.xml diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-soft= mmu.mak index fd9fbd870d..258b4cf358 100644 --- a/configs/targets/s390x-softmmu.mak +++ b/configs/targets/s390x-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Ds390x -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy TARGET_XML_FILES=3D gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/= s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml = gdb-xml/s390-gs.xml diff --git a/configs/targets/sh4eb-linux-user.mak b/configs/targets/sh4eb-l= inux-user.mak index 9b6fb4c1bb..6724165efe 100644 --- a/configs/targets/sh4eb-linux-user.mak +++ b/configs/targets/sh4eb-linux-user.mak @@ -2,5 +2,5 @@ TARGET_ARCH=3Dsh4 TARGET_SYSTBL_ABI=3Dcommon TARGET_SYSTBL=3Dsyscall.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_HAS_BFLT=3Dy diff --git a/configs/targets/sh4eb-softmmu.mak b/configs/targets/sh4eb-soft= mmu.mak index 382e9a80f8..dc8b30bf7a 100644 --- a/configs/targets/sh4eb-softmmu.mak +++ b/configs/targets/sh4eb-softmmu.mak @@ -1,3 +1,3 @@ TARGET_ARCH=3Dsh4 TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/sparc-linux-user.mak b/configs/targets/sparc-l= inux-user.mak index 53dc7aaed5..00e7bc1f07 100644 --- a/configs/targets/sparc-linux-user.mak +++ b/configs/targets/sparc-linux-user.mak @@ -2,4 +2,4 @@ TARGET_ARCH=3Dsparc TARGET_SYSTBL_ABI=3Dcommon,32 TARGET_SYSTBL=3Dsyscall.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/sparc-softmmu.mak b/configs/targets/sparc-soft= mmu.mak index 9ba3d7b07f..a849190f01 100644 --- a/configs/targets/sparc-softmmu.mak +++ b/configs/targets/sparc-softmmu.mak @@ -1,3 +1,3 @@ TARGET_ARCH=3Dsparc TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/sparc32plus-linux-user.mak b/configs/targets/s= parc32plus-linux-user.mak index e4c51df3dc..a65c0951a1 100644 --- a/configs/targets/sparc32plus-linux-user.mak +++ b/configs/targets/sparc32plus-linux-user.mak @@ -5,4 +5,4 @@ TARGET_ABI_DIR=3Dsparc TARGET_SYSTBL_ABI=3Dcommon,32 TARGET_SYSTBL=3Dsyscall.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/sparc64-linux-user.mak b/configs/targets/sparc= 64-linux-user.mak index 9d23ab4a26..20fcb93fa4 100644 --- a/configs/targets/sparc64-linux-user.mak +++ b/configs/targets/sparc64-linux-user.mak @@ -4,4 +4,4 @@ TARGET_ABI_DIR=3Dsparc TARGET_SYSTBL_ABI=3Dcommon,64 TARGET_SYSTBL=3Dsyscall.tbl TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/sparc64-softmmu.mak b/configs/targets/sparc64-= softmmu.mak index 8dd3217800..c626ac3eae 100644 --- a/configs/targets/sparc64-softmmu.mak +++ b/configs/targets/sparc64-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Dsparc64 TARGET_BASE_ARCH=3Dsparc TARGET_ALIGNED_ONLY=3Dy -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy diff --git a/configs/targets/xtensaeb-linux-user.mak b/configs/targets/xten= saeb-linux-user.mak index 1ea0f1ba91..bce2d1d65d 100644 --- a/configs/targets/xtensaeb-linux-user.mak +++ b/configs/targets/xtensaeb-linux-user.mak @@ -1,5 +1,5 @@ TARGET_ARCH=3Dxtensa TARGET_SYSTBL_ABI=3Dcommon TARGET_SYSTBL=3Dsyscall.tbl -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_HAS_BFLT=3Dy diff --git a/configs/targets/xtensaeb-softmmu.mak b/configs/targets/xtensae= b-softmmu.mak index 405cf5acbb..b02e11b820 100644 --- a/configs/targets/xtensaeb-softmmu.mak +++ b/configs/targets/xtensaeb-softmmu.mak @@ -1,3 +1,3 @@ TARGET_ARCH=3Dxtensa -TARGET_WORDS_BIGENDIAN=3Dy +TARGET_BIG_ENDIAN=3Dy TARGET_SUPPORTS_MTTCG=3Dy diff --git a/cpu.c b/cpu.c index be1f8b074c..d34c3439bb 100644 --- a/cpu.c +++ b/cpu.c @@ -469,7 +469,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, =20 bool target_words_bigendian(void) { -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN return true; #else return false; diff --git a/disas.c b/disas.c index 2d2565ac57..8c16e55c7e 100644 --- a/disas.c +++ b/disas.c @@ -126,7 +126,7 @@ static void initialize_debug_target(CPUDebug *s, CPUSta= te *cpu) s->cpu =3D cpu; s->info.read_memory_func =3D target_read_memory; s->info.print_address_func =3D print_address; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN s->info.endian =3D BFD_ENDIAN_BIG; #else s->info.endian =3D BFD_ENDIAN_LITTLE; diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst index 8f0035c821..ad5dfe133e 100644 --- a/docs/devel/loads-stores.rst +++ b/docs/devel/loads-stores.rst @@ -275,7 +275,7 @@ called during the translator callback ``translate_insn`= `. =20 There is a set of functions ending in ``_swap`` which, if the parameter is true, returns the value in the endianness that is the reverse of -the guest native endianness, as determined by ``TARGET_WORDS_BIGENDIAN``. +the guest native endianness, as determined by ``TARGET_BIG_ENDIAN``. =20 Function names follow the pattern: =20 diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 41cfca0f22..32349ec94b 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -577,7 +577,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel= _filename, int mem_size) int asidx; CPUState *cs =3D CPU(cpu); =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #else big_endian =3D 0; diff --git a/hw/display/vga.c b/hw/display/vga.c index 737cfbde98..5dca2d1528 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -2242,7 +2242,7 @@ bool vga_common_init(VGACommonState *s, Object *obj, = Error **errp) * into a device attribute set by the machine/platform to remove * all target endian dependencies from this file. */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN s->default_endian_fb =3D true; #else s->default_endian_fb =3D false; diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 8821d009f1..03c030aa2c 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -138,7 +138,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr = ddr_base, uint32_t base32; int big_endian =3D 0; =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #endif =20 diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index e0ff1b5566..19d0d9889f 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -986,7 +986,7 @@ static void gt64120_reset(DeviceState *dev) /* FIXME: Malta specific hw assumptions ahead */ =20 /* CPU Configuration */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN s->regs[GT_CPU] =3D 0x00000000; #else s->regs[GT_CPU] =3D 0x00001000; @@ -1097,7 +1097,7 @@ static void gt64120_reset(DeviceState *dev) s->regs[GT_TC_CONTROL] =3D 0x00000000; =20 /* PCI Internal */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN s->regs[GT_PCI0_CMD] =3D 0x00000000; #else s->regs[GT_PCI0_CMD] =3D 0x00010001; @@ -1118,7 +1118,7 @@ static void gt64120_reset(DeviceState *dev) s->regs[GT_PCI0_SSCS10_BAR] =3D 0x00000000; s->regs[GT_PCI0_SSCS32_BAR] =3D 0x01000000; s->regs[GT_PCI0_SCS3BT_BAR] =3D 0x1f000000; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN s->regs[GT_PCI1_CMD] =3D 0x00000000; #else s->regs[GT_PCI1_CMD] =3D 0x00010001; diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 44f0d48bfd..4d6b44de34 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -158,7 +158,7 @@ static void mips_jazz_init(MachineState *machine, [JAZZ_PICA61] =3D {33333333, 4}, }; =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #else big_endian =3D 0; diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 6288511723..c4474b927c 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -367,7 +367,7 @@ static uint64_t malta_fpga_read(void *opaque, hwaddr ad= dr, =20 /* STATUS Register */ case 0x00208: -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN val =3D 0x00000012; #else val =3D 0x00000010; @@ -695,7 +695,7 @@ static void write_bootloader_nanomips(uint8_t *base, ui= nt64_t run_addr, stw_p(p++, 0xe040); stw_p(p++, 0x0681); /* lui t1, %hi(0xb4000000) */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN =20 stw_p(p++, 0xe020); stw_p(p++, 0x0be1); /* lui t0, %hi(0xdf000000) */ @@ -894,7 +894,7 @@ static void write_bootloader(uint8_t *base, uint64_t ru= n_addr, /* Load BAR registers as done by YAMON */ stl_p(p++, 0x3c09b400); /* lui t1, 0xb400 */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c08df00); /* lui t0, 0xdf00 */ #else stl_p(p++, 0x340800df); /* ori t0, r0, 0x00df */ @@ -903,39 +903,39 @@ static void write_bootloader(uint8_t *base, uint64_t = run_addr, =20 stl_p(p++, 0x3c09bbe0); /* lui t1, 0xbbe0 */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c08c000); /* lui t0, 0xc000 */ #else stl_p(p++, 0x340800c0); /* ori t0, r0, 0x00c0 */ #endif stl_p(p++, 0xad280048); /* sw t0, 0x0048(t1) */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c084000); /* lui t0, 0x4000 */ #else stl_p(p++, 0x34080040); /* ori t0, r0, 0x0040 */ #endif stl_p(p++, 0xad280050); /* sw t0, 0x0050(t1) */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c088000); /* lui t0, 0x8000 */ #else stl_p(p++, 0x34080080); /* ori t0, r0, 0x0080 */ #endif stl_p(p++, 0xad280058); /* sw t0, 0x0058(t1) */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c083f00); /* lui t0, 0x3f00 */ #else stl_p(p++, 0x3408003f); /* ori t0, r0, 0x003f */ #endif stl_p(p++, 0xad280060); /* sw t0, 0x0060(t1) */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c08c100); /* lui t0, 0xc100 */ #else stl_p(p++, 0x340800c1); /* ori t0, r0, 0x00c1 */ #endif stl_p(p++, 0xad280080); /* sw t0, 0x0080(t1) */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN stl_p(p++, 0x3c085e00); /* lui t0, 0x5e00 */ #else stl_p(p++, 0x3408005e); /* ori t0, r0, 0x005e */ @@ -1030,7 +1030,7 @@ static uint64_t load_kernel(void) int prom_index =3D 0; uint64_t (*xlate_to_kseg0) (void *opaque, uint64_t addr); =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #else big_endian =3D 0; @@ -1272,7 +1272,7 @@ void mips_malta_init(MachineState *machine) ram_low_postio); } =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN be =3D 1; #else be =3D 0; @@ -1353,7 +1353,7 @@ void mips_malta_init(MachineState *machine) * In little endian mode the 32bit words in the bios are swapped, * a neat trick which allows bi-endian firmware. */ -#ifndef TARGET_WORDS_BIGENDIAN +#if !TARGET_BIG_ENDIAN { uint32_t *end, *addr; const size_t swapsize =3D MIN(bios_size, 0x3e0000); diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 27a46bd538..30bc1c4f08 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -65,7 +65,7 @@ static uint64_t load_kernel(void) ram_addr_t initrd_offset; int big_endian; =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #else big_endian =3D 0; diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index 5b3e4efed5..e889595d5c 100644 --- a/hw/nios2/boot.c +++ b/hw/nios2/boot.c @@ -140,7 +140,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base, uint64_t entry, high; int big_endian =3D 0; =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN big_endian =3D 1; #endif =20 diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 2028fe793d..946c71cb5b 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -96,7 +96,7 @@ XtensaCPU *xtensa_sim_common_init(MachineState *machine) void xtensa_sim_load_kernel(XtensaCPU *cpu, MachineState *machine) { const char *kernel_filename =3D machine->kernel_filename; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN int big_endian =3D true; #else int big_endian =3D false; diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index c1e004e882..2a5556a35f 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -219,7 +219,7 @@ static const MemoryRegionOps xtfpga_io_ops =3D { =20 static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machin= e) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN int be =3D 1; #else int be =3D 0; @@ -430,7 +430,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, M= achineState *machine) } if (entry_point !=3D env->pc) { uint8_t boot[] =3D { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN 0x60, 0x00, 0x08, /* j 1f */ 0x00, /* .literal_position */ 0x00, 0x00, 0x00, 0x00, /* .literal entry_pc */ diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index f77070da5f..5d5290deb5 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -37,11 +37,10 @@ * HOST_BIG_ENDIAN : whether the host cpu is big endian and * otherwise little endian. * - * TARGET_WORDS_BIGENDIAN : if defined, the host cpu is big endian and oth= erwise - * little endian. + * TARGET_BIG_ENDIAN : same for the target cpu */ =20 -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN #define BSWAP_NEEDED #endif =20 @@ -121,7 +120,7 @@ static inline void tswap64s(uint64_t *s) /* Target-endianness CPU memory access functions. These fit into the * {ld,st}{type}{sign}{size}{endian}_p naming scheme described in bswap.h. */ -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN #define lduw_p(p) lduw_be_p(p) #define ldsw_p(p) ldsw_be_p(p) #define ldl_p(p) ldl_be_p(p) diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 6adacf8928..d0c7c0d5fe 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -377,7 +377,7 @@ static inline CPUTLBEntry *tlb_entry(CPUArchState *env,= uintptr_t mmu_idx, =20 #endif /* defined(CONFIG_USER_ONLY) */ =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN # define cpu_lduw_data cpu_lduw_be_data # define cpu_ldsw_data cpu_ldsw_be_data # define cpu_ldl_data cpu_ldl_be_data diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 89edf94d28..c35d7334b4 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -110,7 +110,7 @@ static inline int gdb_get_reg128(GByteArray *buf, uint6= 4_t val_hi, uint64_t val_lo) { uint64_t to_quad; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN to_quad =3D tswap64(val_hi); g_byte_array_append(buf, (uint8_t *) &to_quad, 8); to_quad =3D tswap64(val_lo); diff --git a/include/exec/memop.h b/include/exec/memop.h index 44f923ed46..25d027434a 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -36,7 +36,7 @@ typedef enum MemOp { MO_BE =3D MO_BSWAP, #endif #ifdef NEED_CPU_H -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN MO_TE =3D MO_BE, #else MO_TE =3D MO_LE, diff --git a/include/exec/memory.h b/include/exec/memory.h index e40653f0d1..f1c19451bc 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2931,7 +2931,7 @@ static inline MemOp devend_memop(enum device_endian e= nd) QEMU_BUILD_BUG_ON(DEVICE_HOST_ENDIAN !=3D DEVICE_LITTLE_ENDIAN && DEVICE_HOST_ENDIAN !=3D DEVICE_BIG_ENDIAN); =20 -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN /* Swap if non-host endianness or native (target) endianness */ return (end =3D=3D DEVICE_HOST_ENDIAN) ? 0 : MO_BSWAP; #else diff --git a/include/exec/poison.h b/include/exec/poison.h index 7c5c02f03f..9f1ca3409c 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -38,7 +38,7 @@ #pragma GCC poison TARGET_HAS_BFLT #pragma GCC poison TARGET_NAME #pragma GCC poison TARGET_SUPPORTS_MTTCG -#pragma GCC poison TARGET_WORDS_BIGENDIAN +#pragma GCC poison TARGET_BIG_ENDIAN #pragma GCC poison BSWAP_NEEDED =20 #pragma GCC poison TARGET_LONG_BITS diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b0e2e5b9d2..13adb251b2 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1028,7 +1028,7 @@ void cpu_exec_unrealizefn(CPUState *cpu); * target_words_bigendian: * Returns true if the (default) endianness of the target is big endian, * false otherwise. Note that in target-specific code, you can use - * TARGET_WORDS_BIGENDIAN directly instead. On the other hand, common + * TARGET_BIG_ENDIAN directly instead. On the other hand, common * code should normally never need to know about the endianness of the * target, so please do *not* use this function unless you know very well * what you are doing! diff --git a/include/hw/mips/bios.h b/include/hw/mips/bios.h index c03007999a..44acb6815b 100644 --- a/include/hw/mips/bios.h +++ b/include/hw/mips/bios.h @@ -5,7 +5,7 @@ #include "cpu.h" =20 #define BIOS_SIZE (4 * MiB) -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN #define BIOS_FILENAME "mips_bios.bin" #else #define BIOS_FILENAME "mipsel_bios.bin" diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-a= ccess.h index 90cbb77782..07aae69042 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -28,7 +28,7 @@ static inline bool virtio_access_is_big_endian(VirtIODevi= ce *vdev) { #if defined(LEGACY_VIRTIO_IS_BIENDIAN) return virtio_is_big_endian(vdev); -#elif defined(TARGET_WORDS_BIGENDIAN) +#elif TARGET_BIG_ENDIAN if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { /* Devices conforming to VIRTIO 1.0 or later are always LE. */ return false; diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 1737e2ea65..31a66a4fa0 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -202,7 +202,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) } env->pc =3D regs->pc; env->xregs[31] =3D regs->sp; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN env->cp15.sctlr_el[1] |=3D SCTLR_E0E; for (i =3D 1; i < 4; ++i) { env->cp15.sctlr_el[i] |=3D SCTLR_EE; diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index df9e39a4ba..7de4c96eb9 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -147,7 +147,7 @@ static void target_setup_fpsimd_record(struct target_fp= simd_context *fpsimd, =20 for (i =3D 0; i < 32; i++) { uint64_t *q =3D aa64_vfp_qreg(env, i); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN __put_user(q[0], &fpsimd->vregs[i * 2 + 1]); __put_user(q[1], &fpsimd->vregs[i * 2]); #else @@ -233,7 +233,7 @@ static void target_restore_fpsimd_record(CPUARMState *e= nv, =20 for (i =3D 0; i < 32; i++) { uint64_t *q =3D aa64_vfp_qreg(env, i); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN __get_user(q[0], &fpsimd->vregs[i * 2 + 1]); __get_user(q[1], &fpsimd->vregs[i * 2]); #else diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/targe= t_syscall.h index a98f568ab4..c055133725 100644 --- a/linux-user/aarch64/target_syscall.h +++ b/linux-user/aarch64/target_syscall.h @@ -8,7 +8,7 @@ struct target_pt_regs { uint64_t pstate; }; =20 -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN #define UNAME_MACHINE "aarch64_be" #else #define UNAME_MACHINE "aarch64" diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index aae375d617..e4bca93749 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -519,7 +519,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) for(i =3D 0; i < 16; i++) { env->regs[i] =3D regs->uregs[i]; } -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN /* Enable BE8. */ if (EF_ARM_EABI_VERSION(info->elf_flags) >=3D EF_ARM_EABI_VER4 && (info->elf_flags & EF_ARM_BE8)) { diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscal= l.h index f04f9c9e3d..412ad434cf 100644 --- a/linux-user/arm/target_syscall.h +++ b/linux-user/arm/target_syscall.h @@ -18,7 +18,7 @@ struct target_pt_regs { #define ARM_NR_set_tls (ARM_NR_BASE + 5) #define ARM_NR_get_tls (ARM_NR_BASE + 6) =20 -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN #define UNAME_MACHINE "armv5teb" #else #define UNAME_MACHINE "armv5tel" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c45da4d633..c501c246dc 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -105,7 +105,7 @@ int info_is_fdpic(struct image_info *info) #define ELIBBAD 80 #endif =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN #define ELF_DATA ELFDATA2MSB #else #define ELF_DATA ELFDATA2LSB @@ -483,7 +483,7 @@ static const char *get_elf_platform(void) { CPUARMState *env =3D thread_cpu->env_ptr; =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN # define END "b" #else # define END "l" @@ -514,7 +514,7 @@ static const char *get_elf_platform(void) =20 #define ELF_ARCH EM_AARCH64 #define ELF_CLASS ELFCLASS64 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN # define ELF_PLATFORM "aarch64_be" #else # define ELF_PLATFORM "aarch64" diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index ca29d64579..07729c1653 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -215,7 +215,7 @@ static target_ulong get_sigframe(struct target_sigactio= n *ka, return (oldsp - frame_size) & ~0xFUL; } =20 -#if defined(TARGET_WORDS_BIGENDIAN) =3D=3D HOST_BIG_ENDIAN +#if TARGET_BIG_ENDIAN =3D=3D HOST_BIG_ENDIAN #define PPC_VEC_HI 0 #define PPC_VEC_LO 1 #else @@ -542,7 +542,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, env->nip =3D (target_ulong) ka->_sa_handler; #endif =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN /* Signal handlers are entered in big-endian mode. */ ppc_store_msr(env, env->msr & ~(1ull << MSR_LE)); #else diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscal= l.h index 7df9118937..77b36d0b46 100644 --- a/linux-user/ppc/target_syscall.h +++ b/linux-user/ppc/target_syscall.h @@ -59,7 +59,7 @@ struct target_revectored_struct { */ =20 #if defined(TARGET_PPC64) -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN #define UNAME_MACHINE "ppc64" #else #define UNAME_MACHINE "ppc64le" diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 98dfbf2096..46550f5e21 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -236,7 +236,7 @@ static inline bool access_ok(CPUState *cpu, int type, } while (0) =20 =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN # define __put_user(x, hptr) __put_user_e(x, hptr, be) # define __get_user(x, hptr) __get_user_e(x, hptr, be) #else diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 31ca8cc229..dd0d92ba4e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8132,7 +8132,7 @@ static int is_proc_myself(const char *filename, const= char *entry) return 0; } =20 -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) || \ +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN || \ defined(TARGET_SPARC) || defined(TARGET_M68K) || defined(TARGET_HPPA) static int is_proc(const char *filename, const char *entry) { @@ -8140,7 +8140,7 @@ static int is_proc(const char *filename, const char *= entry) } #endif =20 -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN static int open_net_route(void *cpu_env, int fd) { FILE *fp; @@ -8226,7 +8226,7 @@ static int do_openat(void *cpu_env, int dirfd, const = char *pathname, int flags, { "stat", open_self_stat, is_proc_myself }, { "auxv", open_self_auxv, is_proc_myself }, { "cmdline", open_self_cmdline, is_proc_myself }, -#if HOST_BIG_ENDIAN !=3D defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN { "/proc/net/route", open_net_route, is_proc }, #endif #if defined(TARGET_SPARC) || defined(TARGET_HPPA) diff --git a/linux-user/uname.c b/linux-user/uname.c index 1d82608c10..0856783b21 100644 --- a/linux-user/uname.c +++ b/linux-user/uname.c @@ -41,7 +41,7 @@ const char *cpu_to_uname_machine(void *cpu_env) =20 /* in theory, endianness is configurable on some ARM CPUs, but this is= n't * used in user mode emulation */ -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN #define utsname_suffix "b" #else #define utsname_suffix "l" diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index ee152ccfaa..2a80bc83ae 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -115,7 +115,7 @@ static inline int is_error(abi_long ret) #if (TARGET_ABI_BITS =3D=3D 32) && !defined(TARGET_ABI_MIPSN32) static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN return ((uint64_t)word0 << 32) | word1; #else return ((uint64_t)word1 << 32) | word0; diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 06d91a37ec..f5fb8b5cbe 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -130,7 +130,7 @@ static int setup_sigcontext(struct target_rt_sigframe *= frame, =20 static void install_sigtramp(uint8_t *tramp) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN /* Generate instruction: MOVI a2, __NR_rt_sigreturn */ __put_user(0x22, &tramp[0]); __put_user(0x0a, &tramp[1]); diff --git a/linux-user/xtensa/target_structs.h b/linux-user/xtensa/target_= structs.h index 9cde6844b8..cb1b3411cf 100644 --- a/linux-user/xtensa/target_structs.h +++ b/linux-user/xtensa/target_structs.h @@ -15,7 +15,7 @@ struct target_ipc_perm { =20 struct target_semid64_ds { struct target_ipc_perm sem_perm; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN abi_ulong __unused1; abi_ulong sem_otime; abi_ulong __unused2; diff --git a/meson.build b/meson.build index 9abc30d5ce..08f8183a66 100644 --- a/meson.build +++ b/meson.build @@ -2186,6 +2186,9 @@ foreach target : target_dirs if 'TARGET_ABI_DIR' not in config_target config_target +=3D {'TARGET_ABI_DIR': config_target['TARGET_ARCH']} endif + if 'TARGET_BIG_ENDIAN' not in config_target + config_target +=3D {'TARGET_BIG_ENDIAN': 'n'} + endif =20 foreach k, v: disassemblers if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].starts= with(k) @@ -2210,6 +2213,8 @@ foreach target : target_dirs config_target_data.set_quoted(k, v) elif v =3D=3D 'y' config_target_data.set(k, 1) + elif v =3D=3D 'n' + config_target_data.set(k, 0) else config_target_data.set(k, v) endif diff --git a/softmmu/memory.c b/softmmu/memory.c index bfa5d5178c..7ba2048836 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -350,7 +350,7 @@ static void flatview_simplify(FlatView *view) =20 static bool memory_region_big_endian(MemoryRegion *mr) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN return mr->ops->endianness !=3D DEVICE_LITTLE_ENDIAN; #else return mr->ops->endianness =3D=3D DEVICE_BIG_ENDIAN; diff --git a/softmmu/qtest.c b/softmmu/qtest.c index 010d11513d..f8acef2628 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -714,7 +714,7 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "endianness") =3D=3D 0) { qtest_send_prefix(chr); -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN qtest_sendf(chr, "OK big\n"); #else qtest_sendf(chr, "OK little\n"); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5d4ca7a227..0980d33901 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -812,7 +812,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemb= le_info *info) =20 sctlr_b =3D arm_sctlr_b(env); if (bswap_code(sctlr_b)) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN info->endian =3D BFD_ENDIAN_LITTLE; #else info->endian =3D BFD_ENDIAN_BIG; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 816aa0394e..ccf635ac5c 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3549,12 +3549,12 @@ static inline int cpu_mmu_index(CPUARMState *env, b= ool ifetch) static inline bool bswap_code(bool sctlr_b) { #ifdef CONFIG_USER_ONLY - /* BE8 (SCTLR.B =3D 0, TARGET_WORDS_BIGENDIAN =3D 1) is mixed endian. - * The invalid combination SCTLR.B=3D1/CPSR.E=3D1/TARGET_WORDS_BIGENDI= AN=3D0 + /* BE8 (SCTLR.B =3D 0, TARGET_BIG_ENDIAN =3D 1) is mixed endian. + * The invalid combination SCTLR.B=3D1/CPSR.E=3D1/TARGET_BIG_ENDIAN=3D0 * would also end up as a mixed-endian mode with BE code, LE data. */ return -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN 1 ^ #endif sctlr_b; @@ -3570,7 +3570,7 @@ static inline bool bswap_code(bool sctlr_b) static inline bool arm_cpu_bswap_data(CPUARMState *env) { return -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN 1 ^ #endif arm_cpu_data_is_big_endian(env); diff --git a/target/mips/cpu.c b/target/mips/cpu.c index af287177d5..ad74fbe636 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -189,7 +189,7 @@ static void mips_cpu_reset(DeviceState *dev) /* Reset registers to their default values */ env->CP0_PRid =3D env->cpu_model->CP0_PRid; env->CP0_Config0 =3D env->cpu_model->CP0_Config0; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN env->CP0_Config0 |=3D (1 << CP0C0_BE); #endif env->CP0_Config1 =3D env->cpu_model->CP0_Config1; @@ -418,7 +418,7 @@ static void mips_cpu_disas_set_info(CPUState *s, disass= emble_info *info) CPUMIPSState *env =3D &cpu->env; =20 if (!(env->insn_flags & ISA_NANOMIPS32)) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN info->print_insn =3D print_insn_big_mips; #else info->print_insn =3D print_insn_little_mips; diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c index 389c42e4ba..4dde5d639a 100644 --- a/target/mips/tcg/msa_helper.c +++ b/target/mips/tcg/msa_helper.c @@ -8218,7 +8218,7 @@ void helper_msa_ffint_u_df(CPUMIPSState *env, uint32_= t df, uint32_t wd, #define MEMOP_IDX(DF) #endif =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN static inline uint64_t bswap16x4(uint64_t x) { uint64_t m =3D 0x00ff00ff00ff00ffull; @@ -8258,7 +8258,7 @@ void helper_msa_ld_h(CPUMIPSState *env, uint32_t wd, */ d0 =3D cpu_ldq_le_data_ra(env, addr + 0, ra); d1 =3D cpu_ldq_le_data_ra(env, addr + 8, ra); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN d0 =3D bswap16x4(d0); d1 =3D bswap16x4(d1); #endif @@ -8279,7 +8279,7 @@ void helper_msa_ld_w(CPUMIPSState *env, uint32_t wd, */ d0 =3D cpu_ldq_le_data_ra(env, addr + 0, ra); d1 =3D cpu_ldq_le_data_ra(env, addr + 8, ra); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN d0 =3D bswap32x2(d0); d1 =3D bswap32x2(d1); #endif @@ -8345,7 +8345,7 @@ void helper_msa_st_h(CPUMIPSState *env, uint32_t wd, /* Store 8 bytes at a time. See helper_msa_ld_h. */ d0 =3D pwd->d[0]; d1 =3D pwd->d[1]; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN d0 =3D bswap16x4(d0); d1 =3D bswap16x4(d1); #endif @@ -8366,7 +8366,7 @@ void helper_msa_st_w(CPUMIPSState *env, uint32_t wd, /* Store 8 bytes at a time. See helper_msa_ld_w. */ d0 =3D pwd->d[0]; d1 =3D pwd->d[1]; -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN d0 =3D bswap32x2(d0); d1 =3D bswap32x2(d1); #endif diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 073fd10168..5062d0e478 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7150,7 +7150,7 @@ static void ppc_cpu_reset(DeviceState *dev) #if defined(TARGET_PPC64) msr |=3D (target_ulong)1 << MSR_TM; /* Transactional memory */ #endif -#if !defined(TARGET_WORDS_BIGENDIAN) +#if !TARGET_BIG_ENDIAN msr |=3D (target_ulong)1 << MSR_LE; /* Little-endian user mode */ if (!((env->msr_mask >> MSR_LE) & 1)) { fprintf(stderr, "Selected CPU does not support little-endian.\n"); diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 105c2f7dd1..1252429a2a 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -87,9 +87,9 @@ static int ppc_gdb_register_len(int n) /* * We need to present the registers to gdb in the "current" memory * ordering. For user-only mode we get this for free; - * TARGET_WORDS_BIGENDIAN is set to the proper ordering for the + * TARGET_BIG_ENDIAN is set to the proper ordering for the * binary, and cannot be changed. For system mode, - * TARGET_WORDS_BIGENDIAN is always set, and we must check the current + * TARGET_BIG_ENDIAN is always set, and we must check the current * mode of the chip to see if we're running in little-endian. */ void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index f1c76a7750..c4ff8fd632 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -32,7 +32,7 @@ =20 static inline bool needs_byteswap(const CPUPPCState *env) { -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN return msr_le; #else return !msr_le; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 408ae26173..f14f8d7309 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -193,7 +193,7 @@ struct DisasContext { /* Return true iff byteswap is needed in a scalar memop */ static inline bool need_byteswap(const DisasContext *ctx) { -#if defined(TARGET_WORDS_BIGENDIAN) +#if TARGET_BIG_ENDIAN return ctx->le_mode; #else return !ctx->le_mode; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index a572e831ae..f10cfabdc3 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -590,7 +590,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vadd= r addr, #define XTENSA_CPU_TYPE_NAME(model) model XTENSA_CPU_TYPE_SUFFIX #define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU =20 -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN #define XTENSA_DEFAULT_CPU_MODEL "fsf" #define XTENSA_DEFAULT_CPU_NOMMU_MODEL "fsf" #else diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h index 78720734fe..701c00eed2 100644 --- a/target/xtensa/overlay_tool.h +++ b/target/xtensa/overlay_tool.h @@ -449,7 +449,7 @@ =20 #endif =20 -#if (defined(TARGET_WORDS_BIGENDIAN) !=3D 0) =3D=3D (XCHAL_HAVE_BE !=3D 0) +#if TARGET_BIG_ENDIAN =3D=3D (XCHAL_HAVE_BE !=3D 0) #define REGISTER_CORE(core) \ static void __attribute__((constructor)) register_core(void) \ { \ diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index b1491ed625..fc4e9d2c9a 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1471,14 +1471,14 @@ static void translate_b(DisasContext *dc, const Opc= odeArg arg[], static void translate_bb(DisasContext *dc, const OpcodeArg arg[], const uint32_t par[]) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN TCGv_i32 bit =3D tcg_const_i32(0x80000000u); #else TCGv_i32 bit =3D tcg_const_i32(0x00000001u); #endif TCGv_i32 tmp =3D tcg_temp_new_i32(); tcg_gen_andi_i32(tmp, arg[1].in, 0x1f); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN tcg_gen_shr_i32(bit, bit, tmp); #else tcg_gen_shl_i32(bit, bit, tmp); @@ -1493,7 +1493,7 @@ static void translate_bbi(DisasContext *dc, const Opc= odeArg arg[], const uint32_t par[]) { TCGv_i32 tmp =3D tcg_temp_new_i32(); -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_BIG_ENDIAN tcg_gen_andi_i32(tmp, arg[0].in, 0x80000000u >> arg[1].imm); #else tcg_gen_andi_i32(tmp, arg[0].in, 0x00000001u << arg[1].imm); diff --git a/tests/tcg/xtensa/Makefile.softmmu-target b/tests/tcg/xtensa/Ma= kefile.softmmu-target index 9530cac2ad..973e55298e 100644 --- a/tests/tcg/xtensa/Makefile.softmmu-target +++ b/tests/tcg/xtensa/Makefile.softmmu-target @@ -2,7 +2,7 @@ # Xtensa softmmu tests # =20 -ifneq ($(TARGET_WORDS_BIGENDIAN),y) +ifneq ($(TARGET_BIG_ENDIAN),y) =20 XTENSA_SRC =3D $(SRC_PATH)/tests/tcg/xtensa XTENSA_ALL =3D $(filter-out $(XTENSA_SRC)/linker.ld.S,$(wildcard $(XTENSA_= SRC)/*.S)) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650348913291565.5709775262104; Mon, 18 Apr 2022 23:15:13 -0700 (PDT) Received: from localhost ([::1]:60748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh8p-0005YP-Q4 for importer@patchew.org; Tue, 19 Apr 2022 02:15:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglo-00017s-SI for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:38575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglm-0004Og-Pf for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:24 -0400 Received: by mail-wm1-x332.google.com with SMTP id r187-20020a1c44c4000000b0038ccb70e239so777403wma.3 for ; Mon, 18 Apr 2022 22:51:22 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hLBhHXaZKYrV14/sIWGGHgjOzMy581GRe2H5TvaKgUc=; b=MVdRODd8Oe8fMIECdu7hGLGT6vukWq1gZh6eWon9oE353Y6XQ9MiLckWMU94ivSJuc QSmmWjqbcMaGRar7vGZJOKBvXxoEtatbRv08GCpeaeMSQVkYUfzs7CM3MA04Ss/ivDeE itAjezgponDGM8rmoXooIpOacgpG9A9zI3Q/94p5jLttrxOLRwHISE2no5Z2D/8rSp2J V2NTESMSlmrOw/H+YGCYp4OHy3wEj6zS3xw5maxXZg0j5Rags2UG3Fkob9LNiQn7hrgW BiMG2vf0Q5YLTR7UZb4IIDxEKTaiDpuSDaJBWsDnD9Djm9PlOTJIkO38WemZT8jr0R0L +0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hLBhHXaZKYrV14/sIWGGHgjOzMy581GRe2H5TvaKgUc=; b=u6GJWznc/Yf+9yEwnsFAo5xRT8Ioxe3HwNNW77typ7eHJBXjUmN8C6JVcftUZ5Q+7c QueX1+gzb4V0ixSHAoKOeWa/BnBM6pQaVfmIppyiDqDQtyW4azNen3KZBJMm8agcZq7N qKTyFjKZYJl13sjl8gfIr3ALq3Qwj5IiReLIFj+G5TDG+q8F7ogzZ+yTp8P9M4cEs+bo /WeVjOXzbpJ/sunUH+6p3IhdfcDR6XDnsdJmrWjU+wbZV299IL0ohUmsTD/xpJwE9yLN YrA5PcRtNLkfd7KHlZxlW298diydfT/HeL3H2JQHWjW74ESLB8L6q5qqRuVKW061JtVS HSfA== X-Gm-Message-State: AOAM53081lIqczwjul4gG62P/85TEyHsNHeyt3RmjqJ0PQc2RSOBErpQ JkgypP/1GtFhY80kIUnrO2rr2WINxDUXLA== X-Google-Smtp-Source: ABdhPJy2V3+LlQTJ1kksebTY2SikEruvY1i0cEagGanmlGA6sD/DKRPw/JUmMby5tedt1C2ZCRv1+A== X-Received: by 2002:a1c:6a01:0:b0:37f:1b18:6b17 with SMTP id f1-20020a1c6a01000000b0037f1b186b17mr18345403wmc.146.1650347481464; Mon, 18 Apr 2022 22:51:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/53] osdep: poison {HOST,TARGET}_WORDS_BIGENDIAN Date: Tue, 19 Apr 2022 07:50:29 +0200 Message-Id: <20220419055109.142788-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::332; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348913852100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Suggested-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-9-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/osdep.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 9f06bf536f..95a14914d1 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -34,6 +34,18 @@ #include "exec/poison.h" #endif =20 +/* + * HOST_WORDS_BIGENDIAN was replaced with HOST_BIG_ENDIAN. Prevent it from + * creeping back in. + */ +#pragma GCC poison HOST_WORDS_BIGENDIAN + +/* + * TARGET_WORDS_BIGENDIAN was replaced with TARGET_BIG_ENDIAN. Prevent it = from + * creeping back in. + */ +#pragma GCC poison TARGET_WORDS_BIGENDIAN + #include "qemu/compiler.h" =20 /* Older versions of C++ don't get definitions of various macros from --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16503480568265.803980893646667; Mon, 18 Apr 2022 23:00:56 -0700 (PDT) Received: from localhost ([::1]:43504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nggv1-0001i2-GC for importer@patchew.org; Tue, 19 Apr 2022 02:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglr-000197-AG for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:28 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:36807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggln-0004Ov-JR for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:25 -0400 Received: by mail-wm1-x330.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso790856wml.1 for ; Mon, 18 Apr 2022 22:51:23 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QDFagQlYRGOosDLeECh2JtUZAH1swXIXmWLoc6DTcyI=; b=k+sp+A1WA2dyPNpqYgMZ0f5AAiR69fQt5OUWFHJpTVI5NJyoCTO2igW1nHXGWhseJJ TP2dWy4U188wZG5WAuEyv06tWXUgWBjx8VsLyIzq1umi4K/jaV+uuGSqpFq45BHlzutC FMxIXues8PyJIvVw3E9MdUfi1JmmyHXnnrcUIrWyJ7vuEW8jR5N0RUj0S9Yd/QX48H92 RWuYRYBM1MZda6T35I+t9lFhkpQzDdQUvDQ89DHjt9p5qn3vm27+6uN5GIObRRmVsCaC oVd5KfyAfnNCyReDnsBAVmwAyZLQt7XIuwTGq1+9/RGJtWnZ3VW6K3hR+N6R7/IW5hwx evKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=QDFagQlYRGOosDLeECh2JtUZAH1swXIXmWLoc6DTcyI=; b=b8D/cNSsS4yNGUK2m5iT9IZ16EXzefl1hHWMUGoHFoOYjugarv4n7tvtp5DNRMSL0p 85AOyjN8qP1ahtOPHFIRuJTY5e3dxhtgdC0XB/m5NXEavGAfGK5Ui7/Zu7hEAfzXMoue 6EV2KS/8GV6ZoBfIpyQ4Wd9jx6AOArkfkUl05Hin18IMHCRj4ypg3R+F6QyI3dw1r+fE cKL6SRngtzD9EncMXA0gq7jWP6+JWEDtD5UUNDWL+n7Snx43jL5SMk516dYsQ2uFyHAT /kNI7kZySFk4qI7oU3cGsyenvQU73H1OusgNOegnG3Oimo+HCC/mtdnbSGQ1rbwUSBGK YevQ== X-Gm-Message-State: AOAM5319g8AJ8Ib6UrkkzSAlpwq5xW2cWVolWGHsHMXIeyItkfKyr0Nk dy/Y+f7BIe2AvJ2OtE5xF9ap5oh4xH1BvQ== X-Google-Smtp-Source: ABdhPJyG2klFJ63P30hr2fK1mYppnNmcf/eSD6mdi/IyBKWD1Em31pl692gYfbgxTBDdmsA3TtUFsg== X-Received: by 2002:a1c:f30b:0:b0:380:e444:86b9 with SMTP id q11-20020a1cf30b000000b00380e44486b9mr14266626wmq.81.1650347482196; Mon, 18 Apr 2022 22:51:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/53] include/qapi: add g_autoptr support for qobject types Date: Tue, 19 Apr 2022 07:50:30 +0200 Message-Id: <20220419055109.142788-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::330; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348058519100002 From: Marc-Andr=C3=A9 Lureau Need wrappers for qobject_unref() calls, which is a macro. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-10-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qapi/qmp/qbool.h | 4 ++++ include/qapi/qmp/qdict.h | 4 ++++ include/qapi/qmp/qlist.h | 4 ++++ include/qapi/qmp/qnull.h | 4 ++++ include/qapi/qmp/qnum.h | 4 ++++ include/qapi/qmp/qstring.h | 4 ++++ qobject/qbool.c | 5 +++++ qobject/qdict.c | 5 +++++ qobject/qlist.c | 5 +++++ qobject/qnull.c | 5 +++++ qobject/qnum.c | 5 +++++ qobject/qstring.c | 5 +++++ 12 files changed, 54 insertions(+) diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h index 2f888d1057..0d09726939 100644 --- a/include/qapi/qmp/qbool.h +++ b/include/qapi/qmp/qbool.h @@ -21,6 +21,10 @@ struct QBool { bool value; }; =20 +void qbool_unref(QBool *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QBool, qbool_unref) + QBool *qbool_from_bool(bool value); bool qbool_get_bool(const QBool *qb); =20 diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index d5b5430e21..882d950bde 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -30,6 +30,10 @@ struct QDict { QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX]; }; =20 +void qdict_unref(QDict *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QDict, qdict_unref) + /* Object API */ QDict *qdict_new(void); const char *qdict_entry_key(const QDictEntry *entry); diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h index 06e98ad5f4..e4e985d435 100644 --- a/include/qapi/qmp/qlist.h +++ b/include/qapi/qmp/qlist.h @@ -26,6 +26,10 @@ struct QList { QTAILQ_HEAD(,QListEntry) head; }; =20 +void qlist_unref(QList *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QList, qlist_unref) + #define qlist_append(qlist, obj) \ qlist_append_obj(qlist, QOBJECT(obj)) =20 diff --git a/include/qapi/qmp/qnull.h b/include/qapi/qmp/qnull.h index e84ecceedb..7feb7c7d83 100644 --- a/include/qapi/qmp/qnull.h +++ b/include/qapi/qmp/qnull.h @@ -26,4 +26,8 @@ static inline QNull *qnull(void) return qobject_ref(&qnull_); } =20 +void qnull_unref(QNull *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QNull, qnull_unref) + #endif /* QNULL_H */ diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h index 7f84e20bfb..e86788dd2e 100644 --- a/include/qapi/qmp/qnum.h +++ b/include/qapi/qmp/qnum.h @@ -54,6 +54,10 @@ struct QNum { } u; }; =20 +void qnum_unref(QNum *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QNum, qnum_unref) + QNum *qnum_from_int(int64_t value); QNum *qnum_from_uint(uint64_t value); QNum *qnum_from_double(double value); diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index 1d8ba46936..318d815d6a 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -20,6 +20,10 @@ struct QString { const char *string; }; =20 +void qstring_unref(QString *q); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QString, qstring_unref) + QString *qstring_new(void); QString *qstring_from_str(const char *str); QString *qstring_from_substr(const char *str, size_t start, size_t end); diff --git a/qobject/qbool.c b/qobject/qbool.c index 16a600abb9..c7049c0c50 100644 --- a/qobject/qbool.c +++ b/qobject/qbool.c @@ -56,3 +56,8 @@ void qbool_destroy_obj(QObject *obj) assert(obj !=3D NULL); g_free(qobject_to(QBool, obj)); } + +void qbool_unref(QBool *q) +{ + qobject_unref(q); +} diff --git a/qobject/qdict.c b/qobject/qdict.c index 0216ca7ac1..8faff230d3 100644 --- a/qobject/qdict.c +++ b/qobject/qdict.c @@ -442,3 +442,8 @@ void qdict_destroy_obj(QObject *obj) =20 g_free(qdict); } + +void qdict_unref(QDict *q) +{ + qobject_unref(q); +} diff --git a/qobject/qlist.c b/qobject/qlist.c index 60562a1f52..356ad946b0 100644 --- a/qobject/qlist.c +++ b/qobject/qlist.c @@ -182,3 +182,8 @@ void qlist_destroy_obj(QObject *obj) =20 g_free(qlist); } + +void qlist_unref(QList *q) +{ + qobject_unref(q); +} diff --git a/qobject/qnull.c b/qobject/qnull.c index b26b368219..445a5db7f3 100644 --- a/qobject/qnull.c +++ b/qobject/qnull.c @@ -29,3 +29,8 @@ bool qnull_is_equal(const QObject *x, const QObject *y) { return true; } + +void qnull_unref(QNull *q) +{ + qobject_unref(q); +} diff --git a/qobject/qnum.c b/qobject/qnum.c index 5dd66938dd..2bbeaedc7b 100644 --- a/qobject/qnum.c +++ b/qobject/qnum.c @@ -239,3 +239,8 @@ void qnum_destroy_obj(QObject *obj) assert(obj !=3D NULL); g_free(qobject_to(QNum, obj)); } + +void qnum_unref(QNum *q) +{ + qobject_unref(q); +} diff --git a/qobject/qstring.c b/qobject/qstring.c index b4613899b9..794f8c9357 100644 --- a/qobject/qstring.c +++ b/qobject/qstring.c @@ -100,3 +100,8 @@ void qstring_destroy_obj(QObject *obj) g_free((char *)qs->string); g_free(qs); } + +void qstring_unref(QString *q) +{ + qobject_unref(q); +} --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165034841597071.04908641107636; Mon, 18 Apr 2022 23:06:55 -0700 (PDT) Received: from localhost ([::1]:52012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngh0o-0007fA-OW for importer@patchew.org; Tue, 19 Apr 2022 02:06:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglr-000198-Ak for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:28 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:42654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglo-0004P5-5L for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:26 -0400 Received: by mail-wr1-x42e.google.com with SMTP id bv16so3773485wrb.9 for ; Mon, 18 Apr 2022 22:51:23 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7M2WNmROKkrtDZu1zii2mflUNkB7rQ5DR5Wl2tCpzqI=; b=fnlOdhha+yDtRT/z8YXBNIgQ4lH9t80vrswsOfCaqz4e+bdiaqODJlkHj3rScCoD2/ GtAO5pS34zaN+THCsbQ4uQckrarC3JfHhZ2CkEEX9Y3uZ4tBCp7SXnL1Je5uhRZpzGwb oAyhfIxBQGQ8prrswwCpisPsAX1tIJLr2qQJw+u+YoU/7nwBJL3Y/O/FOEraY4ZieT/T zZVnZ4cDJsw/ODfScuGdnmXntWh69GnqupdMkNR3cGiApFdJm9RsaUQXWGJMLm7rOZkX mZRLp4NH5U85oR5z/aV+bEaHXfUYFNm1s/HJL1UMW18pzkMKsiuABefuuqRQ17NBGEMp MhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7M2WNmROKkrtDZu1zii2mflUNkB7rQ5DR5Wl2tCpzqI=; b=KClvkT35cvLoNMKLqP2RG11QLcwrdogfe/ZVqdMVwO85IakDXvaIPK+4tAL2s7XORP dPj/vKr+xGQXoHXqc01b5rcb+TbuIc8Zeyqeng1xpoExsmI8l6O1epvG0dL8qP7NXuiK y7TrHgTRaFSwcyqe32BzETZ74rwLZJZNQgGM4PQ8Fy1WNaD8h6NTvRS2VxK4lO/WRgSS px6y/2eq31aGPybiSc+kxjng2oXgYu/xU4n7tlyi92ZDFqaJuDAP+IG3RxQQWehzaun1 8dmOFqgZgqTlC9gH05D16nnL6UW0Cyz/V4qi3+gGzWeiNsJkuWTdYl1VJmuYaIsYHehG 2F5g== X-Gm-Message-State: AOAM533vkozySM9D/MYs798KWe6ZeqmmD2UEMz6xff5c4W9HhO17RV6a EhCgIeZHFqM9vJmjwmcBIDB9yJPm4nrlJw== X-Google-Smtp-Source: ABdhPJy6Q3Qx23Nxa/oFvRWjwNRP4UbPOZUsQovk5Iz/5hLKBLdfvF0Qjv15Z72Y8vJM8nTyyPJ0nA== X-Received: by 2002:a05:6000:1883:b0:205:c0cb:33c6 with SMTP id a3-20020a056000188300b00205c0cb33c6mr10807809wri.39.1650347482865; Mon, 18 Apr 2022 22:51:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/53] tests: replace free_all() usage with g_auto Date: Tue, 19 Apr 2022 07:50:31 +0200 Message-Id: <20220419055109.142788-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650348416243100001 From: Marc-Andr=C3=A9 Lureau Use more idiomatic glib/auto-style code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-11-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/unit/check-qobject.c | 127 ++++++++++++------------------------- 1 file changed, 40 insertions(+), 87 deletions(-) diff --git a/tests/unit/check-qobject.c b/tests/unit/check-qobject.c index c3d50e9994..7903ebf4cf 100644 --- a/tests/unit/check-qobject.c +++ b/tests/unit/check-qobject.c @@ -74,21 +74,6 @@ static void do_test_equality(bool expected, int _, ...) #define check_unequal(...) \ do_test_equality(false, 0, __VA_ARGS__, &test_equality_end_of_argument= s) =20 -static void do_free_all(int _, ...) -{ - va_list ap; - QObject *obj; - - va_start(ap, _); - while ((obj =3D va_arg(ap, QObject *)) !=3D NULL) { - qobject_unref(obj); - } - va_end(ap); -} - -#define free_all(...) \ - do_free_all(0, __VA_ARGS__, NULL) - static void qobject_is_equal_null_test(void) { check_unequal(qnull(), NULL); @@ -96,15 +81,14 @@ static void qobject_is_equal_null_test(void) =20 static void qobject_is_equal_num_test(void) { - QNum *u0, *i0, *d0, *dnan, *um42, *im42, *dm42; + g_autoptr(QNum) u0 =3D qnum_from_uint(0u); + g_autoptr(QNum) i0 =3D qnum_from_int(0); + g_autoptr(QNum) d0 =3D qnum_from_double(0.0); + g_autoptr(QNum) dnan =3D qnum_from_double(NAN); + g_autoptr(QNum) um42 =3D qnum_from_uint((uint64_t)-42); + g_autoptr(QNum) im42 =3D qnum_from_int(-42); + g_autoptr(QNum) dm42 =3D qnum_from_double(-42.0); =20 - u0 =3D qnum_from_uint(0u); - i0 =3D qnum_from_int(0); - d0 =3D qnum_from_double(0.0); - dnan =3D qnum_from_double(NAN); - um42 =3D qnum_from_uint((uint64_t)-42); - im42 =3D qnum_from_int(-42); - dm42 =3D qnum_from_double(-42.0); =20 /* Integers representing a mathematically equal number should * compare equal */ @@ -121,60 +105,45 @@ static void qobject_is_equal_num_test(void) check_unequal(um42, im42); check_unequal(um42, dm42); check_unequal(im42, dm42); - - free_all(u0, i0, d0, dnan, um42, im42, dm42); } =20 static void qobject_is_equal_bool_test(void) { - QBool *btrue_0, *btrue_1, *bfalse_0, *bfalse_1; - - btrue_0 =3D qbool_from_bool(true); - btrue_1 =3D qbool_from_bool(true); - bfalse_0 =3D qbool_from_bool(false); - bfalse_1 =3D qbool_from_bool(false); + g_autoptr(QBool) btrue_0 =3D qbool_from_bool(true); + g_autoptr(QBool) btrue_1 =3D qbool_from_bool(true); + g_autoptr(QBool) bfalse_0 =3D qbool_from_bool(false); + g_autoptr(QBool) bfalse_1 =3D qbool_from_bool(false); =20 check_equal(btrue_0, btrue_1); check_equal(bfalse_0, bfalse_1); check_unequal(btrue_0, bfalse_0); - - free_all(btrue_0, btrue_1, bfalse_0, bfalse_1); } =20 static void qobject_is_equal_string_test(void) { - QString *str_base, *str_whitespace_0, *str_whitespace_1, *str_whitespa= ce_2; - QString *str_whitespace_3, *str_case, *str_built; - - str_base =3D qstring_from_str("foo"); - str_whitespace_0 =3D qstring_from_str(" foo"); - str_whitespace_1 =3D qstring_from_str("foo "); - str_whitespace_2 =3D qstring_from_str("foo\b"); - str_whitespace_3 =3D qstring_from_str("fooo\b"); - str_case =3D qstring_from_str("Foo"); - + g_autoptr(QString) str_base =3D qstring_from_str("foo"); + g_autoptr(QString) str_whitespace_0 =3D qstring_from_str(" foo"); + g_autoptr(QString) str_whitespace_1 =3D qstring_from_str("foo "); + g_autoptr(QString) str_whitespace_2 =3D qstring_from_str("foo\b"); + g_autoptr(QString) str_whitespace_3 =3D qstring_from_str("fooo\b"); + g_autoptr(QString) str_case =3D qstring_from_str("Foo"); /* Should yield "foo" */ - str_built =3D qstring_from_substr("buffoon", 3, 6); + g_autoptr(QString) str_built =3D qstring_from_substr("buffoon", 3, 6); =20 check_unequal(str_base, str_whitespace_0, str_whitespace_1, str_whitespace_2, str_whitespace_3, str_case); =20 check_equal(str_base, str_built); - - free_all(str_base, str_whitespace_0, str_whitespace_1, str_whitespace_= 2, - str_whitespace_3, str_case, str_built); } =20 static void qobject_is_equal_list_test(void) { - QList *list_0, *list_1, *list_cloned; - QList *list_reordered, *list_longer, *list_shorter; - - list_0 =3D qlist_new(); - list_1 =3D qlist_new(); - list_reordered =3D qlist_new(); - list_longer =3D qlist_new(); - list_shorter =3D qlist_new(); + g_autoptr(QList) list_0 =3D qlist_new(); + g_autoptr(QList) list_1 =3D qlist_new(); + g_autoptr(QList) list_reordered =3D qlist_new(); + g_autoptr(QList) list_longer =3D qlist_new(); + g_autoptr(QList) list_shorter =3D qlist_new(); + g_autoptr(QList) list_cloned =3D NULL; =20 qlist_append_int(list_0, 1); qlist_append_int(list_0, 2); @@ -205,26 +174,20 @@ static void qobject_is_equal_list_test(void) * itself */ qlist_append(list_0, qnum_from_double(NAN)); g_assert(qobject_is_equal(QOBJECT(list_0), QOBJECT(list_0)) =3D=3D fal= se); - - free_all(list_0, list_1, list_cloned, list_reordered, list_longer, - list_shorter); } =20 static void qobject_is_equal_dict_test(void) { - QDict *dict_0, *dict_1, *dict_cloned; - QDict *dict_different_key, *dict_different_value, *dict_different_null= _key; - QDict *dict_longer, *dict_shorter, *dict_nested; - QDict *dict_crumpled; - - dict_0 =3D qdict_new(); - dict_1 =3D qdict_new(); - dict_different_key =3D qdict_new(); - dict_different_value =3D qdict_new(); - dict_different_null_key =3D qdict_new(); - dict_longer =3D qdict_new(); - dict_shorter =3D qdict_new(); - dict_nested =3D qdict_new(); + g_autoptr(QDict) dict_cloned =3D NULL; + g_autoptr(QDict) dict_crumpled =3D NULL; + g_autoptr(QDict) dict_0 =3D qdict_new(); + g_autoptr(QDict) dict_1 =3D qdict_new(); + g_autoptr(QDict) dict_different_key =3D qdict_new(); + g_autoptr(QDict) dict_different_value =3D qdict_new(); + g_autoptr(QDict) dict_different_null_key =3D qdict_new(); + g_autoptr(QDict) dict_longer =3D qdict_new(); + g_autoptr(QDict) dict_shorter =3D qdict_new(); + g_autoptr(QDict) dict_nested =3D qdict_new(); =20 qdict_put_int(dict_0, "f.o", 1); qdict_put_int(dict_0, "bar", 2); @@ -284,31 +247,21 @@ static void qobject_is_equal_dict_test(void) * itself */ qdict_put(dict_0, "NaN", qnum_from_double(NAN)); g_assert(qobject_is_equal(QOBJECT(dict_0), QOBJECT(dict_0)) =3D=3D fal= se); - - free_all(dict_0, dict_1, dict_cloned, dict_different_key, - dict_different_value, dict_different_null_key, dict_longer, - dict_shorter, dict_nested, dict_crumpled); } =20 static void qobject_is_equal_conversion_test(void) { - QNum *u0, *i0, *d0; - QString *s0, *s_empty; - QBool *bfalse; - - u0 =3D qnum_from_uint(0u); - i0 =3D qnum_from_int(0); - d0 =3D qnum_from_double(0.0); - s0 =3D qstring_from_str("0"); - s_empty =3D qstring_new(); - bfalse =3D qbool_from_bool(false); + g_autoptr(QNum) u0 =3D qnum_from_uint(0u); + g_autoptr(QNum) i0 =3D qnum_from_int(0); + g_autoptr(QNum) d0 =3D qnum_from_double(0.0); + g_autoptr(QString) s0 =3D qstring_from_str("0"); + g_autoptr(QString) s_empty =3D qstring_new(); + g_autoptr(QBool) bfalse =3D qbool_from_bool(false); =20 /* No automatic type conversion */ check_unequal(u0, s0, s_empty, bfalse, qnull(), NULL); check_unequal(i0, s0, s_empty, bfalse, qnull(), NULL); check_unequal(d0, s0, s_empty, bfalse, qnull(), NULL); - - free_all(u0, i0, d0, s0, s_empty, bfalse); } =20 int main(int argc, char **argv) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350818564908.3301242189539; Mon, 18 Apr 2022 23:46:58 -0700 (PDT) Received: from localhost ([::1]:39032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghdG-000537-Mf for importer@patchew.org; Tue, 19 Apr 2022 02:46:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglv-0001A0-4h for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:37 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:40573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglp-0004PY-Ap for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:30 -0400 Received: by mail-wm1-x329.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso775111wme.5 for ; Mon, 18 Apr 2022 22:51:24 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5l64JsBkq79lvEdquHrQ7OTDQaYERqBbR1PUAAHIzo0=; b=PJt+lmacbru7/AOHKxSTlfN7TOl/zgxxu8ZmrVAFRK7NOviHG6vBygLhlA5TSlwjOA vJJEEOD4s+aSWWjk+3ZioPWKLL1TCRj+ygN50YtgGXviGYvTrdw3yAXujD3Pd55V0rG+ 3U+/j8Xpt1ALlQLQxvDXkDgWmDb2BYkuI3TnREJk0J2dsyAG4rThWTtjdSk2b2nUe3tT eSCiNUaNQ/zKQAWPadtum1v2iIUZ1VmvQXo8P5WJgYvKe+2MQ419ykkGfn7U+36YUyTo 6dA0zG9+fgykZBVFy65Astw9V6iIJj85IAOWKPOocgchkYhVcLotAsHnFI9E2VuPjxLC iS/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5l64JsBkq79lvEdquHrQ7OTDQaYERqBbR1PUAAHIzo0=; b=H6atWS0km+eyDVnWh/IaJfL4Oli116Hpj7VSrj3qLQc27d4ymrLP0nEciLO0ELaaiV 6/dHfENMRO5cX5lSWXD6w+H6FHnpNnPZOu9dE3Aw9x49y/AKBoDhZ8DarsKqbTXjpSes nESnP81myvQj5ttmIw76PNONSgzMuvL8SUziY+/wwqDARQAwXWzThTiZ/BGXGfO+GdMO oBE9RrR/5ZAFXAAi12o2iJzLz7HI2xipFHc2B4FjZkh04lrLlsElTri7wEehF4OksudD LWKAHMdyWcnB06yYPxrVPUx5qRHIGdRunZMZiOufEHT8NxvymtdeShtsVKyKieNN5AHW xGuw== X-Gm-Message-State: AOAM531O2OGrnbJrfoOcteKiNx/x4+XzIx+cn2ARouIwHY7VS1i/n++b deC7Asdgb8/ATfmILpTUgpzqIQTgIvs3zg== X-Google-Smtp-Source: ABdhPJyX80r+9NjcePZNVfXNvSe3azV0sFQXBJSRbNytp8j1xm2hQfMgwOgXTygD6NC+EcLig1XQQg== X-Received: by 2002:a05:600c:4313:b0:38e:b150:2f8e with SMTP id p19-20020a05600c431300b0038eb1502f8emr18278645wme.198.1650347483700; Mon, 18 Apr 2022 22:51:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/53] Replace qemu_real_host_page variables with inlined functions Date: Tue, 19 Apr 2022 07:50:32 +0200 Message-Id: <20220419055109.142788-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::329; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350819828100001 From: Marc-Andr=C3=A9 Lureau Replace the global variables with inlined helper functions. getpagesize() i= s very likely annotated with a "const" function attribute (at least with glibc), a= nd thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/hvf/hvf-accel-ops.c | 2 +- accel/kvm/kvm-all.c | 20 ++++++++++---------- backends/hostmem.c | 2 +- block.c | 4 ++-- block/file-posix.c | 6 +++--- block/io.c | 2 +- block/nvme.c | 22 +++++++++++----------- block/parallels.c | 2 +- block/qcow2-cache.c | 2 +- bsd-user/elfload.c | 2 +- bsd-user/mmap.c | 2 +- contrib/vhost-user-gpu/vugbm.c | 2 +- cpu.c | 2 +- hw/display/qxl.c | 2 +- hw/intc/s390_flic_kvm.c | 2 +- hw/nvram/fw_cfg.c | 6 +++--- hw/ppc/mac_newworld.c | 2 +- hw/ppc/spapr_pci.c | 2 +- hw/rdma/vmw/pvrdma_main.c | 2 +- hw/scsi/scsi-generic.c | 2 +- hw/tpm/tpm_ppi.c | 2 +- hw/vfio/common.c | 24 ++++++++++++------------ hw/vfio/pci.c | 10 +++++----- hw/vfio/spapr.c | 8 ++++---- hw/virtio/vhost-iova-tree.c | 4 ++-- hw/virtio/vhost-shadow-virtqueue.c | 8 ++++---- hw/virtio/vhost-user.c | 4 ++-- hw/virtio/vhost-vdpa.c | 6 +++--- hw/virtio/virtio-mem.c | 10 +++++----- include/exec/cpu-common.h | 2 +- include/exec/ram_addr.h | 2 +- include/qemu/osdep.h | 15 +++++++++++---- linux-user/elfload.c | 4 ++-- linux-user/mmap.c | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 4 ++-- monitor/misc.c | 2 +- scripts/checkpatch.pl | 4 ++-- softmmu/physmem.c | 6 +++--- target/i386/hax/hax-mem.c | 10 +++++----- target/i386/nvmm/nvmm-all.c | 8 ++++---- target/i386/whpx/whpx-all.c | 8 ++++---- target/ppc/kvm.c | 2 +- tcg/region.c | 8 ++++---- tests/vhost-user-bridge.c | 8 ++++---- util/cutils.c | 4 ++-- util/meson.build | 1 - util/mmap-alloc.c | 10 +++++----- util/osdep.c | 4 ++-- util/oslib-posix.c | 8 ++++---- util/oslib-win32.c | 2 +- util/pagesize.c | 18 ------------------ util/vfio-helpers.c | 14 +++++++------- 53 files changed, 150 insertions(+), 162 deletions(-) delete mode 100644 util/pagesize.c diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 54457c76c2..a70e2eb375 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -122,7 +122,7 @@ static void hvf_set_phys_mem(MemoryRegionSection *secti= on, bool add) MemoryRegion *area =3D section->mr; bool writeable =3D !area->readonly && !area->rom_device; hv_memory_flags_t flags; - uint64_t page_size =3D qemu_real_host_page_size; + uint64_t page_size =3D qemu_real_host_page_size(); =20 if (!memory_region_is_ram(area)) { if (writeable) { diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 8d9d2367ee..32e177bd26 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -59,7 +59,7 @@ #ifdef PAGE_SIZE #undef PAGE_SIZE #endif -#define PAGE_SIZE qemu_real_host_page_size +#define PAGE_SIZE qemu_real_host_page_size() =20 #ifndef KVM_GUESTDBG_BLOCKIRQ #define KVM_GUESTDBG_BLOCKIRQ 0 @@ -324,14 +324,14 @@ static hwaddr kvm_align_section(MemoryRegionSection *= section, with sub-page size and unaligned start address. Pad the start address to next and truncate size to previous page boundary. */ aligned =3D ROUND_UP(section->offset_within_address_space, - qemu_real_host_page_size); + qemu_real_host_page_size()); delta =3D aligned - section->offset_within_address_space; *start =3D aligned; if (delta > size) { return 0; } =20 - return (size - delta) & qemu_real_host_page_mask; + return (size - delta) & qemu_real_host_page_mask(); } =20 int kvm_physical_memory_addr_from_host(KVMState *s, void *ram, @@ -626,7 +626,7 @@ static void kvm_log_stop(MemoryListener *listener, static void kvm_slot_sync_dirty_pages(KVMSlot *slot) { ram_addr_t start =3D slot->ram_start_offset; - ram_addr_t pages =3D slot->memory_size / qemu_real_host_page_size; + ram_addr_t pages =3D slot->memory_size / qemu_real_host_page_size(); =20 cpu_physical_memory_set_dirty_lebitmap(slot->dirty_bmap, start, pages); } @@ -662,7 +662,7 @@ static void kvm_slot_init_dirty_bitmap(KVMSlot *mem) * And mem->memory_size is aligned to it (otherwise this mem can't * be registered to KVM). */ - hwaddr bitmap_size =3D ALIGN(mem->memory_size / qemu_real_host_page_si= ze, + hwaddr bitmap_size =3D ALIGN(mem->memory_size / qemu_real_host_page_si= ze(), /*HOST_LONG_BITS*/ 64) / 8; mem->dirty_bmap =3D g_malloc0(bitmap_size); mem->dirty_bmap_size =3D bitmap_size; @@ -707,7 +707,7 @@ static void kvm_dirty_ring_mark_page(KVMState *s, uint3= 2_t as_id, mem =3D &kml->slots[slot_id]; =20 if (!mem->memory_size || offset >=3D - (mem->memory_size / qemu_real_host_page_size)) { + (mem->memory_size / qemu_real_host_page_size())) { return; } =20 @@ -895,7 +895,7 @@ static void kvm_physical_sync_dirty_bitmap(KVMMemoryLis= tener *kml, =20 /* Alignment requirement for KVM_CLEAR_DIRTY_LOG - 64 pages */ #define KVM_CLEAR_LOG_SHIFT 6 -#define KVM_CLEAR_LOG_ALIGN (qemu_real_host_page_size << KVM_CLEAR_LOG_SH= IFT) +#define KVM_CLEAR_LOG_ALIGN (qemu_real_host_page_size() << KVM_CLEAR_LOG_= SHIFT) #define KVM_CLEAR_LOG_MASK (-KVM_CLEAR_LOG_ALIGN) =20 static int kvm_log_clear_one_slot(KVMSlot *mem, int as_id, uint64_t start, @@ -904,7 +904,7 @@ static int kvm_log_clear_one_slot(KVMSlot *mem, int as_= id, uint64_t start, KVMState *s =3D kvm_state; uint64_t end, bmap_start, start_delta, bmap_npages; struct kvm_clear_dirty_log d; - unsigned long *bmap_clear =3D NULL, psize =3D qemu_real_host_page_size; + unsigned long *bmap_clear =3D NULL, psize =3D qemu_real_host_page_size= (); int ret; =20 /* @@ -1335,7 +1335,7 @@ kvm_check_extension_list(KVMState *s, const KVMCapabi= lityInfo *list) void kvm_set_max_memslot_size(hwaddr max_slot_size) { g_assert( - ROUND_UP(max_slot_size, qemu_real_host_page_size) =3D=3D max_slot_= size + ROUND_UP(max_slot_size, qemu_real_host_page_size()) =3D=3D max_slo= t_size ); kvm_max_slot_size =3D max_slot_size; } @@ -2341,7 +2341,7 @@ static int kvm_init(MachineState *ms) * even with KVM. TARGET_PAGE_SIZE is assumed to be the minimum * page size for the system though. */ - assert(TARGET_PAGE_SIZE <=3D qemu_real_host_page_size); + assert(TARGET_PAGE_SIZE <=3D qemu_real_host_page_size()); =20 s->sigmask_len =3D 8; =20 diff --git a/backends/hostmem.c b/backends/hostmem.c index b2a5e905e8..a7bae3d713 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -319,7 +319,7 @@ size_t host_memory_backend_pagesize(HostMemoryBackend *= memdev) #else size_t host_memory_backend_pagesize(HostMemoryBackend *memdev) { - return qemu_real_host_page_size; + return qemu_real_host_page_size(); } #endif =20 diff --git a/block.c b/block.c index 718e4cae8b..8cd16e757e 100644 --- a/block.c +++ b/block.c @@ -135,7 +135,7 @@ size_t bdrv_opt_mem_align(BlockDriverState *bs) { if (!bs || !bs->drv) { /* page size or 4k (hdd sector size) should be on the safe side */ - return MAX(4096, qemu_real_host_page_size); + return MAX(4096, qemu_real_host_page_size()); } IO_CODE(); =20 @@ -146,7 +146,7 @@ size_t bdrv_min_mem_align(BlockDriverState *bs) { if (!bs || !bs->drv) { /* page size or 4k (hdd sector size) should be on the safe side */ - return MAX(4096, qemu_real_host_page_size); + return MAX(4096, qemu_real_host_page_size()); } IO_CODE(); =20 diff --git a/block/file-posix.c b/block/file-posix.c index 39a3d6dbe6..61b02d85eb 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -386,7 +386,7 @@ static void raw_probe_alignment(BlockDriverState *bs, i= nt fd, Error **errp) { BDRVRawState *s =3D bs->opaque; char *buf; - size_t max_align =3D MAX(MAX_BLOCKSIZE, qemu_real_host_page_size); + size_t max_align =3D MAX(MAX_BLOCKSIZE, qemu_real_host_page_size()); size_t alignments[] =3D {1, 512, 1024, 2048, 4096}; =20 /* For SCSI generic devices the alignment is not really used. @@ -1261,7 +1261,7 @@ static void raw_refresh_limits(BlockDriverState *bs, = Error **errp) raw_probe_alignment(bs, s->fd, errp); =20 bs->bl.min_mem_alignment =3D s->buf_align; - bs->bl.opt_mem_alignment =3D MAX(s->buf_align, qemu_real_host_page_siz= e); + bs->bl.opt_mem_alignment =3D MAX(s->buf_align, qemu_real_host_page_siz= e()); =20 /* * Maximum transfers are best effort, so it is okay to ignore any @@ -1886,7 +1886,7 @@ static int allocate_first_block(int fd, size_t max_si= ze) size_t write_size =3D (max_size < MAX_BLOCKSIZE) ? BDRV_SECTOR_SIZE : MAX_BLOCKSIZE; - size_t max_align =3D MAX(MAX_BLOCKSIZE, qemu_real_host_page_size); + size_t max_align =3D MAX(MAX_BLOCKSIZE, qemu_real_host_page_size()); void *buf; ssize_t n; int ret; diff --git a/block/io.c b/block/io.c index 3280144a17..9769ec53b0 100644 --- a/block/io.c +++ b/block/io.c @@ -201,7 +201,7 @@ void bdrv_refresh_limits(BlockDriverState *bs, Transact= ion *tran, Error **errp) =20 if (!have_limits) { bs->bl.min_mem_alignment =3D 512; - bs->bl.opt_mem_alignment =3D qemu_real_host_page_size; + bs->bl.opt_mem_alignment =3D qemu_real_host_page_size(); =20 /* Safe default since most protocols use readv()/writev()/etc */ bs->bl.max_iov =3D IOV_MAX; diff --git a/block/nvme.c b/block/nvme.c index 552029931d..01fb28aa63 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -169,9 +169,9 @@ static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue= *q, size_t bytes; int r; =20 - bytes =3D ROUND_UP(nentries * entry_bytes, qemu_real_host_page_size); + bytes =3D ROUND_UP(nentries * entry_bytes, qemu_real_host_page_size()); q->head =3D q->tail =3D 0; - q->queue =3D qemu_try_memalign(qemu_real_host_page_size, bytes); + q->queue =3D qemu_try_memalign(qemu_real_host_page_size(), bytes); if (!q->queue) { error_setg(errp, "Cannot allocate queue"); return false; @@ -232,8 +232,8 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeSt= ate *s, trace_nvme_create_queue_pair(idx, q, size, aio_context, event_notifier_get_fd(s->irq_notifier)); bytes =3D QEMU_ALIGN_UP(s->page_size * NVME_NUM_REQS, - qemu_real_host_page_size); - q->prp_list_pages =3D qemu_try_memalign(qemu_real_host_page_size, byte= s); + qemu_real_host_page_size()); + q->prp_list_pages =3D qemu_try_memalign(qemu_real_host_page_size(), by= tes); if (!q->prp_list_pages) { error_setg(errp, "Cannot allocate PRP page list"); goto fail; @@ -533,9 +533,9 @@ static bool nvme_identify(BlockDriverState *bs, int nam= espace, Error **errp) .opcode =3D NVME_ADM_CMD_IDENTIFY, .cdw10 =3D cpu_to_le32(0x1), }; - size_t id_size =3D QEMU_ALIGN_UP(sizeof(*id), qemu_real_host_page_size= ); + size_t id_size =3D QEMU_ALIGN_UP(sizeof(*id), qemu_real_host_page_size= ()); =20 - id =3D qemu_try_memalign(qemu_real_host_page_size, id_size); + id =3D qemu_try_memalign(qemu_real_host_page_size(), id_size); if (!id) { error_setg(errp, "Cannot allocate buffer for identify response"); goto out; @@ -1048,7 +1048,7 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriver= State *bs, NvmeCmd *cmd, bool retry =3D true; uint64_t iova; size_t len =3D QEMU_ALIGN_UP(qiov->iov[i].iov_len, - qemu_real_host_page_size); + qemu_real_host_page_size()); try_map: r =3D qemu_vfio_dma_map(s->vfio, qiov->iov[i].iov_base, @@ -1224,8 +1224,8 @@ static inline bool nvme_qiov_aligned(BlockDriverState= *bs, =20 for (i =3D 0; i < qiov->niov; ++i) { if (!QEMU_PTR_IS_ALIGNED(qiov->iov[i].iov_base, - qemu_real_host_page_size) || - !QEMU_IS_ALIGNED(qiov->iov[i].iov_len, qemu_real_host_page_siz= e)) { + qemu_real_host_page_size()) || + !QEMU_IS_ALIGNED(qiov->iov[i].iov_len, qemu_real_host_page_siz= e())) { trace_nvme_qiov_unaligned(qiov, i, qiov->iov[i].iov_base, qiov->iov[i].iov_len, s->page_size); return false; @@ -1241,7 +1241,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, int r; QEMU_AUTO_VFREE uint8_t *buf =3D NULL; QEMUIOVector local_qiov; - size_t len =3D QEMU_ALIGN_UP(bytes, qemu_real_host_page_size); + size_t len =3D QEMU_ALIGN_UP(bytes, qemu_real_host_page_size()); assert(QEMU_IS_ALIGNED(offset, s->page_size)); assert(QEMU_IS_ALIGNED(bytes, s->page_size)); assert(bytes <=3D s->max_transfer); @@ -1251,7 +1251,7 @@ static int nvme_co_prw(BlockDriverState *bs, uint64_t= offset, uint64_t bytes, } s->stats.unaligned_accesses++; trace_nvme_prw_buffered(s, offset, bytes, qiov->niov, is_write); - buf =3D qemu_try_memalign(qemu_real_host_page_size, len); + buf =3D qemu_try_memalign(qemu_real_host_page_size(), len); =20 if (!buf) { return -ENOMEM; diff --git a/block/parallels.c b/block/parallels.c index cd23e02d06..8879b7027a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -870,7 +870,7 @@ static int parallels_open(BlockDriverState *bs, QDict *= options, int flags, } } =20 - s->bat_dirty_block =3D 4 * qemu_real_host_page_size; + s->bat_dirty_block =3D 4 * qemu_real_host_page_size(); s->bat_dirty_bmap =3D bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block)); =20 diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 8a0105911f..539f9ca2d5 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -75,7 +75,7 @@ static void qcow2_cache_table_release(Qcow2Cache *c, int = i, int num_tables) /* Using MADV_DONTNEED to discard memory is a Linux-specific feature */ #ifdef CONFIG_LINUX void *t =3D qcow2_cache_get_table_addr(c, i); - int align =3D qemu_real_host_page_size; + int align =3D qemu_real_host_page_size(); size_t mem_size =3D (size_t) c->table_size * num_tables; size_t offset =3D QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t; size_t length =3D QEMU_ALIGN_DOWN(mem_size - offset, align); diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 142a5bfac2..f8edb22f2a 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -246,7 +246,7 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_b= ss) * patch target_mmap(), but it is more complicated as the file * size must be known. */ - if (qemu_real_host_page_size < qemu_host_page_size) { + if (qemu_real_host_page_size() < qemu_host_page_size) { abi_ulong end_addr, end_addr1; end_addr1 =3D REAL_HOST_PAGE_ALIGN(elf_bss); end_addr =3D HOST_PAGE_ALIGN(elf_bss); diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 13cb32dba1..07aa0a634d 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -515,7 +515,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t prot, * up to the targets page boundary. */ =20 - if ((qemu_real_host_page_size < qemu_host_page_size) && fd !=3D -1) { + if ((qemu_real_host_page_size() < qemu_host_page_size) && fd !=3D -1) { struct stat sb; =20 if (fstat(fd, &sb) =3D=3D -1) { diff --git a/contrib/vhost-user-gpu/vugbm.c b/contrib/vhost-user-gpu/vugbm.c index fb15d0372c..503d0a4566 100644 --- a/contrib/vhost-user-gpu/vugbm.c +++ b/contrib/vhost-user-gpu/vugbm.c @@ -53,7 +53,7 @@ struct udmabuf_create { static size_t udmabuf_get_size(struct vugbm_buffer *buf) { - return ROUND_UP(buf->width * buf->height * 4, qemu_real_host_page_size= ); + return ROUND_UP(buf->width * buf->height * 4, qemu_real_host_page_size= ()); } =20 static bool diff --git a/cpu.c b/cpu.c index d34c3439bb..ab2c7c81e4 100644 --- a/cpu.c +++ b/cpu.c @@ -481,7 +481,7 @@ void page_size_init(void) /* NOTE: we can always suppose that qemu_host_page_size >=3D TARGET_PAGE_SIZE */ if (qemu_host_page_size =3D=3D 0) { - qemu_host_page_size =3D qemu_real_host_page_size; + qemu_host_page_size =3D qemu_real_host_page_size(); } if (qemu_host_page_size < TARGET_PAGE_SIZE) { qemu_host_page_size =3D TARGET_PAGE_SIZE; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index adbdbcaeb6..2db34714fb 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -320,7 +320,7 @@ static ram_addr_t qxl_rom_size(void) #define QXL_ROM_SZ 8192 =20 QEMU_BUILD_BUG_ON(QXL_REQUIRED_SZ > QXL_ROM_SZ); - return QEMU_ALIGN_UP(QXL_REQUIRED_SZ, qemu_real_host_page_size); + return QEMU_ALIGN_UP(QXL_REQUIRED_SZ, qemu_real_host_page_size()); } =20 static void init_qxl_rom(PCIQXLDevice *d) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index efe5054182..4e86d2d436 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -24,7 +24,7 @@ #include "trace.h" #include "qom/object.h" =20 -#define FLIC_SAVE_INITIAL_SIZE qemu_real_host_page_size +#define FLIC_SAVE_INITIAL_SIZE qemu_real_host_page_size() #define FLIC_FAILED (-1UL) #define FLIC_SAVEVM_VERSION 1 =20 diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index e5f3c98184..ea2d56f9f2 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -622,9 +622,9 @@ static bool fw_cfg_acpi_mr_restore(void *opaque) FWCfgState *s =3D opaque; bool mr_aligned; =20 - mr_aligned =3D QEMU_IS_ALIGNED(s->table_mr_size, qemu_real_host_page_s= ize) && - QEMU_IS_ALIGNED(s->linker_mr_size, qemu_real_host_page_si= ze) && - QEMU_IS_ALIGNED(s->rsdp_mr_size, qemu_real_host_page_size= ); + mr_aligned =3D QEMU_IS_ALIGNED(s->table_mr_size, qemu_real_host_page_s= ize()) && + QEMU_IS_ALIGNED(s->linker_mr_size, qemu_real_host_page_si= ze()) && + QEMU_IS_ALIGNED(s->rsdp_mr_size, qemu_real_host_page_size= ()); return s->acpi_mr_restore && !mr_aligned; } =20 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 4bddb529c2..7b5a205309 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -456,7 +456,7 @@ static void ppc_core99_init(MachineState *machine) } =20 /* The NewWorld NVRAM is not located in the MacIO device */ - if (kvm_enabled() && qemu_real_host_page_size > 4096) { + if (kvm_enabled() && qemu_real_host_page_size() > 4096) { /* We can't combine read-write and read-only in a single page, so move the NVRAM out of ROM again for KVM */ nvram_addr =3D 0xFFE00000; diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 5bfd4aa9e5..b2f5fbef0c 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1978,7 +1978,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) * our memory slot is of page size granularity. */ if (kvm_enabled()) { - msi_window_size =3D qemu_real_host_page_size; + msi_window_size =3D qemu_real_host_page_size(); } =20 memory_region_init_io(&sphb->msiwindow, OBJECT(sphb), &spapr_msi_ops, = spapr, diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 91206dbb8e..27a7622432 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -608,7 +608,7 @@ static void pvrdma_realize(PCIDevice *pdev, Error **err= p) rdma_info_report("Initializing device %s %x.%x", pdev->name, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); =20 - if (TARGET_PAGE_SIZE !=3D qemu_real_host_page_size) { + if (TARGET_PAGE_SIZE !=3D qemu_real_host_page_size()) { error_setg(errp, "Target page size must be the same as host page s= ize"); return; } diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 0306ccc7b1..0ab00ef85c 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -183,7 +183,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r,= SCSIDevice *s, int len) uint32_t max_iov =3D blk_get_max_hw_iov(s->conf.blk); =20 assert(max_transfer); - max_transfer =3D MIN_NON_ZERO(max_transfer, max_iov * qemu_rea= l_host_page_size) + max_transfer =3D MIN_NON_ZERO(max_transfer, max_iov * qemu_rea= l_host_page_size()) / s->blocksize; stl_be_p(&r->buf[8], max_transfer); /* Also take care of the opt xfer len. */ diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c index c89ac53e65..7f74e26ec6 100644 --- a/hw/tpm/tpm_ppi.c +++ b/hw/tpm/tpm_ppi.c @@ -47,7 +47,7 @@ void tpm_ppi_reset(TPMPPI *tpmppi) void tpm_ppi_init(TPMPPI *tpmppi, MemoryRegion *m, hwaddr addr, Object *obj) { - tpmppi->buf =3D qemu_memalign(qemu_real_host_page_size, + tpmppi->buf =3D qemu_memalign(qemu_real_host_page_size(), HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE)); memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi", TPM_PPI_ADDR_SIZE, tpmppi->buf); diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 080046e3f5..2b1f78fdfa 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -397,7 +397,7 @@ static int vfio_dma_unmap_bitmap(VFIOContainer *contain= er, { struct vfio_iommu_type1_dma_unmap *unmap; struct vfio_bitmap *bitmap; - uint64_t pages =3D REAL_HOST_PAGE_ALIGN(size) / qemu_real_host_page_si= ze; + uint64_t pages =3D REAL_HOST_PAGE_ALIGN(size) / qemu_real_host_page_si= ze(); int ret; =20 unmap =3D g_malloc0(sizeof(*unmap) + sizeof(*bitmap)); @@ -414,7 +414,7 @@ static int vfio_dma_unmap_bitmap(VFIOContainer *contain= er, * to qemu_real_host_page_size. */ =20 - bitmap->pgsize =3D qemu_real_host_page_size; + bitmap->pgsize =3D qemu_real_host_page_size(); bitmap->size =3D ROUND_UP(pages, sizeof(__u64) * BITS_PER_BYTE) / BITS_PER_BYTE; =20 @@ -882,8 +882,8 @@ static void vfio_listener_region_add(MemoryListener *li= stener, } =20 if (unlikely((section->offset_within_address_space & - ~qemu_real_host_page_mask) !=3D - (section->offset_within_region & ~qemu_real_host_page_mas= k))) { + ~qemu_real_host_page_mask()) !=3D + (section->offset_within_region & ~qemu_real_host_page_mas= k()))) { error_report("%s received unaligned region", __func__); return; } @@ -891,7 +891,7 @@ static void vfio_listener_region_add(MemoryListener *li= stener, iova =3D REAL_HOST_PAGE_ALIGN(section->offset_within_address_space); llend =3D int128_make64(section->offset_within_address_space); llend =3D int128_add(llend, section->size); - llend =3D int128_and(llend, int128_exts64(qemu_real_host_page_mask)); + llend =3D int128_and(llend, int128_exts64(qemu_real_host_page_mask())); =20 if (int128_ge(int128_make64(iova), llend)) { if (memory_region_is_ram_device(section->mr)) { @@ -899,7 +899,7 @@ static void vfio_listener_region_add(MemoryListener *li= stener, memory_region_name(section->mr), section->offset_within_address_space, int128_getlo(section->size), - qemu_real_host_page_size); + qemu_real_host_page_size()); } return; } @@ -1118,8 +1118,8 @@ static void vfio_listener_region_del(MemoryListener *= listener, } =20 if (unlikely((section->offset_within_address_space & - ~qemu_real_host_page_mask) !=3D - (section->offset_within_region & ~qemu_real_host_page_mas= k))) { + ~qemu_real_host_page_mask()) !=3D + (section->offset_within_region & ~qemu_real_host_page_mas= k()))) { error_report("%s received unaligned region", __func__); return; } @@ -1150,7 +1150,7 @@ static void vfio_listener_region_del(MemoryListener *= listener, iova =3D REAL_HOST_PAGE_ALIGN(section->offset_within_address_space); llend =3D int128_make64(section->offset_within_address_space); llend =3D int128_add(llend, section->size); - llend =3D int128_and(llend, int128_exts64(qemu_real_host_page_mask)); + llend =3D int128_and(llend, int128_exts64(qemu_real_host_page_mask())); =20 if (int128_ge(int128_make64(iova), llend)) { return; @@ -1272,9 +1272,9 @@ static int vfio_get_dirty_bitmap(VFIOContainer *conta= iner, uint64_t iova, * qemu_real_host_page_size to mark those dirty. Hence set bitmap's pg= size * to qemu_real_host_page_size. */ - range->bitmap.pgsize =3D qemu_real_host_page_size; + range->bitmap.pgsize =3D qemu_real_host_page_size(); =20 - pages =3D REAL_HOST_PAGE_ALIGN(range->size) / qemu_real_host_page_size; + pages =3D REAL_HOST_PAGE_ALIGN(range->size) / qemu_real_host_page_size= (); range->bitmap.size =3D ROUND_UP(pages, sizeof(__u64) * BITS_PER_BYTE) / BITS_PER_BYTE; range->bitmap.data =3D g_try_malloc0(range->bitmap.size); @@ -1970,7 +1970,7 @@ static void vfio_get_iommu_info_migration(VFIOContain= er *container, * cpu_physical_memory_set_dirty_lebitmap() supports pages in bitmap of * qemu_real_host_page_size to mark those dirty. */ - if (cap_mig->pgsize_bitmap & qemu_real_host_page_size) { + if (cap_mig->pgsize_bitmap & qemu_real_host_page_size()) { container->dirty_pages_supported =3D true; container->max_dirty_bitmap_size =3D cap_mig->max_dirty_bitmap_siz= e; container->dirty_pgsizes =3D cap_mig->pgsize_bitmap; diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 67a183f17b..9fd9faee1d 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1087,8 +1087,8 @@ static void vfio_sub_page_bar_update_mapping(PCIDevic= e *pdev, int bar) =20 /* If BAR is mapped and page aligned, update to fill PAGE_SIZE */ if (bar_addr !=3D PCI_BAR_UNMAPPED && - !(bar_addr & ~qemu_real_host_page_mask)) { - size =3D qemu_real_host_page_size; + !(bar_addr & ~qemu_real_host_page_mask())) { + size =3D qemu_real_host_page_size(); } =20 memory_region_transaction_begin(); @@ -1204,7 +1204,7 @@ void vfio_pci_write_config(PCIDevice *pdev, for (bar =3D 0; bar < PCI_ROM_SLOT; bar++) { if (old_addr[bar] !=3D pdev->io_regions[bar].addr && vdev->bars[bar].region.size > 0 && - vdev->bars[bar].region.size < qemu_real_host_page_size) { + vdev->bars[bar].region.size < qemu_real_host_page_size()) { vfio_sub_page_bar_update_mapping(pdev, bar); } } @@ -1292,7 +1292,7 @@ static void vfio_pci_fixup_msix_region(VFIOPCIDevice = *vdev) } =20 /* MSI-X table start and end aligned to host page size */ - start =3D vdev->msix->table_offset & qemu_real_host_page_mask; + start =3D vdev->msix->table_offset & qemu_real_host_page_mask(); end =3D REAL_HOST_PAGE_ALIGN((uint64_t)vdev->msix->table_offset + (vdev->msix->entries * PCI_MSIX_ENTRY_SIZE)= ); =20 @@ -2478,7 +2478,7 @@ static int vfio_pci_load_config(VFIODevice *vbasedev,= QEMUFile *f) */ if (old_addr[bar] !=3D pdev->io_regions[bar].addr && vdev->bars[bar].region.size > 0 && - vdev->bars[bar].region.size < qemu_real_host_page_size) { + vdev->bars[bar].region.size < qemu_real_host_page_size()) { vfio_sub_page_bar_update_mapping(pdev, bar); } } diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c index 04c6e67f8f..9ec1e95f6d 100644 --- a/hw/vfio/spapr.c +++ b/hw/vfio/spapr.c @@ -44,7 +44,7 @@ static void vfio_prereg_listener_region_add(MemoryListene= r *listener, const hwaddr gpa =3D section->offset_within_address_space; hwaddr end; int ret; - hwaddr page_mask =3D qemu_real_host_page_mask; + hwaddr page_mask =3D qemu_real_host_page_mask(); struct vfio_iommu_spapr_register_memory reg =3D { .argsz =3D sizeof(reg), .flags =3D 0, @@ -102,7 +102,7 @@ static void vfio_prereg_listener_region_del(MemoryListe= ner *listener, const hwaddr gpa =3D section->offset_within_address_space; hwaddr end; int ret; - hwaddr page_mask =3D qemu_real_host_page_mask; + hwaddr page_mask =3D qemu_real_host_page_mask(); struct vfio_iommu_spapr_register_memory reg =3D { .argsz =3D sizeof(reg), .flags =3D 0, @@ -199,12 +199,12 @@ int vfio_spapr_create_window(VFIOContainer *container, * Below we look at qemu_real_host_page_size as TCEs are allocated from * system pages. */ - bits_per_level =3D ctz64(qemu_real_host_page_size) + 8; + bits_per_level =3D ctz64(qemu_real_host_page_size()) + 8; create.levels =3D bits_total / bits_per_level; if (bits_total % bits_per_level) { ++create.levels; } - max_levels =3D (64 - create.page_shift) / ctz64(qemu_real_host_page_si= ze); + max_levels =3D (64 - create.page_shift) / ctz64(qemu_real_host_page_si= ze()); for ( ; create.levels <=3D max_levels; ++create.levels) { ret =3D ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_CREATE, &create); if (!ret) { diff --git a/hw/virtio/vhost-iova-tree.c b/hw/virtio/vhost-iova-tree.c index 55fed1fefb..67bf6d57ab 100644 --- a/hw/virtio/vhost-iova-tree.c +++ b/hw/virtio/vhost-iova-tree.c @@ -11,7 +11,7 @@ #include "qemu/iova-tree.h" #include "vhost-iova-tree.h" =20 -#define iova_min_addr qemu_real_host_page_size +#define iova_min_addr qemu_real_host_page_size() =20 /** * VhostIOVATree, able to: @@ -86,7 +86,7 @@ const DMAMap *vhost_iova_tree_find_iova(const VhostIOVATr= ee *tree, int vhost_iova_tree_map_alloc(VhostIOVATree *tree, DMAMap *map) { /* Some vhost devices do not like addr 0. Skip first page */ - hwaddr iova_first =3D tree->iova_first ?: qemu_real_host_page_size; + hwaddr iova_first =3D tree->iova_first ?: qemu_real_host_page_size(); =20 if (map->translated_addr + map->size < map->translated_addr || map->perm =3D=3D IOMMU_NONE) { diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index b232803d1b..1e5cfe2af6 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -471,14 +471,14 @@ size_t vhost_svq_driver_area_size(const VhostShadowVi= rtqueue *svq) size_t avail_size =3D offsetof(vring_avail_t, ring) + sizeof(uint16_t) * svq->vring= .num; =20 - return ROUND_UP(desc_size + avail_size, qemu_real_host_page_size); + return ROUND_UP(desc_size + avail_size, qemu_real_host_page_size()); } =20 size_t vhost_svq_device_area_size(const VhostShadowVirtqueue *svq) { size_t used_size =3D offsetof(vring_used_t, ring) + sizeof(vring_used_elem_t) * svq->vring= .num; - return ROUND_UP(used_size, qemu_real_host_page_size); + return ROUND_UP(used_size, qemu_real_host_page_size()); } =20 /** @@ -533,11 +533,11 @@ void vhost_svq_start(VhostShadowVirtqueue *svq, VirtI= ODevice *vdev, svq->vring.num =3D virtio_queue_get_num(vdev, virtio_get_queue_index(v= q)); driver_size =3D vhost_svq_driver_area_size(svq); device_size =3D vhost_svq_device_area_size(svq); - svq->vring.desc =3D qemu_memalign(qemu_real_host_page_size, driver_siz= e); + svq->vring.desc =3D qemu_memalign(qemu_real_host_page_size(), driver_s= ize); desc_size =3D sizeof(vring_desc_t) * svq->vring.num; svq->vring.avail =3D (void *)((char *)svq->vring.desc + desc_size); memset(svq->vring.desc, 0, driver_size); - svq->vring.used =3D qemu_memalign(qemu_real_host_page_size, device_siz= e); + svq->vring.used =3D qemu_memalign(qemu_real_host_page_size(), device_s= ize); memset(svq->vring.used, 0, device_size); svq->ring_id_maps =3D g_new0(VirtQueueElement *, svq->vring.num); for (unsigned i =3D 0; i < svq->vring.num - 1; i++) { diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 6abbc9da32..9c4f84f35f 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1166,7 +1166,7 @@ static int vhost_user_set_vring_num(struct vhost_dev = *dev, static void vhost_user_host_notifier_free(VhostUserHostNotifier *n) { assert(n && n->unmap_addr); - munmap(n->unmap_addr, qemu_real_host_page_size); + munmap(n->unmap_addr, qemu_real_host_page_size()); n->unmap_addr =3D NULL; } =20 @@ -1503,7 +1503,7 @@ static int vhost_user_slave_handle_vring_host_notifie= r(struct vhost_dev *dev, int fd) { int queue_idx =3D area->u64 & VHOST_USER_VRING_IDX_MASK; - size_t page_size =3D qemu_real_host_page_size; + size_t page_size =3D qemu_real_host_page_size(); struct vhost_user *u =3D dev->opaque; VhostUserState *user =3D u->user; VirtIODevice *vdev =3D dev->vdev; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8adf7c0b92..bc54f9fc44 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -468,7 +468,7 @@ err: static void vhost_vdpa_host_notifier_uninit(struct vhost_dev *dev, int queue_index) { - size_t page_size =3D qemu_real_host_page_size; + size_t page_size =3D qemu_real_host_page_size(); struct vhost_vdpa *v =3D dev->opaque; VirtIODevice *vdev =3D dev->vdev; VhostVDPAHostNotifier *n; @@ -485,7 +485,7 @@ static void vhost_vdpa_host_notifier_uninit(struct vhos= t_dev *dev, =20 static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_= index) { - size_t page_size =3D qemu_real_host_page_size; + size_t page_size =3D qemu_real_host_page_size(); struct vhost_vdpa *v =3D dev->opaque; VirtIODevice *vdev =3D dev->vdev; VhostVDPAHostNotifier *n; @@ -875,7 +875,7 @@ static bool vhost_vdpa_svq_unmap_ring(struct vhost_vdpa= *v, return false; } =20 - size =3D ROUND_UP(result->size, qemu_real_host_page_size); + size =3D ROUND_UP(result->size, qemu_real_host_page_size()); r =3D vhost_vdpa_dma_unmap(v, result->iova, size); return r =3D=3D 0; } diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index f55dcf61f2..35cbf1f219 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -53,11 +53,11 @@ static uint32_t virtio_mem_default_thp_size(void) #if defined(__x86_64__) || defined(__arm__) || defined(__powerpc64__) default_thp_size =3D 2 * MiB; #elif defined(__aarch64__) - if (qemu_real_host_page_size =3D=3D 4 * KiB) { + if (qemu_real_host_page_size() =3D=3D 4 * KiB) { default_thp_size =3D 2 * MiB; - } else if (qemu_real_host_page_size =3D=3D 16 * KiB) { + } else if (qemu_real_host_page_size() =3D=3D 16 * KiB) { default_thp_size =3D 32 * MiB; - } else if (qemu_real_host_page_size =3D=3D 64 * KiB) { + } else if (qemu_real_host_page_size() =3D=3D 64 * KiB) { default_thp_size =3D 512 * MiB; } #endif @@ -120,7 +120,7 @@ static uint64_t virtio_mem_default_block_size(RAMBlock = *rb) const uint64_t page_size =3D qemu_ram_pagesize(rb); =20 /* We can have hugetlbfs with a page size smaller than the THP size. */ - if (page_size =3D=3D qemu_real_host_page_size) { + if (page_size =3D=3D qemu_real_host_page_size()) { return MAX(page_size, virtio_mem_thp_size()); } return MAX(page_size, VIRTIO_MEM_MIN_BLOCK_SIZE); @@ -135,7 +135,7 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb) * fresh page, consuming actual memory. */ return !qemu_ram_is_shared(rb) && rb->fd < 0 && - qemu_ram_pagesize(rb) =3D=3D qemu_real_host_page_size; + qemu_ram_pagesize(rb) =3D=3D qemu_real_host_page_size(); } #endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */ =20 diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index c7d50fac95..5979fc1f8e 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -26,7 +26,7 @@ extern uintptr_t qemu_host_page_size; extern intptr_t qemu_host_page_mask; =20 #define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size) -#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_si= ze) +#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_si= ze()) =20 /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */ void qemu_init_cpu_list(void); diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 64fb936c7c..f3e0c78161 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -343,7 +343,7 @@ static inline void cpu_physical_memory_set_dirty_lebitm= ap(unsigned long *bitmap, hwaddr addr; ram_addr_t ram_addr; unsigned long len =3D (pages + HOST_LONG_BITS - 1) / HOST_LONG_BITS; - unsigned long hpratio =3D qemu_real_host_page_size / TARGET_PAGE_SIZE; + unsigned long hpratio =3D qemu_real_host_page_size() / TARGET_PAGE_SIZ= E; unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); =20 /* start address is aligned at the start of a word? */ diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 95a14914d1..240b48707e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -431,9 +431,9 @@ extern int madvise(char *, size_t, int); /* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ # define QEMU_VMALLOC_ALIGN (256 * 4096) #elif defined(__linux__) && defined(__sparc__) -# define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size, SHMLBA) +# define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size(), SHMLBA) #else -# define QEMU_VMALLOC_ALIGN qemu_real_host_page_size +# define QEMU_VMALLOC_ALIGN qemu_real_host_page_size() #endif =20 #ifdef CONFIG_POSIX @@ -590,8 +590,15 @@ pid_t qemu_fork(Error **errp); /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even * when intptr_t is 32-bit and we are aligning a long long. */ -extern uintptr_t qemu_real_host_page_size; -extern intptr_t qemu_real_host_page_mask; +static inline uintptr_t qemu_real_host_page_size(void) +{ + return getpagesize(); +} + +static inline intptr_t qemu_real_host_page_mask(void) +{ + return -(intptr_t)qemu_real_host_page_size(); +} =20 /* * After using getopt or getopt_long, if you need to parse another set diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c501c246dc..d6bb1fc7ca 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1916,8 +1916,8 @@ static abi_ulong setup_arg_pages(struct linux_binprm = *bprm, size =3D STACK_LOWER_LIMIT; } guard =3D TARGET_PAGE_SIZE; - if (guard < qemu_real_host_page_size) { - guard =3D qemu_real_host_page_size; + if (guard < qemu_real_host_page_size()) { + guard =3D qemu_real_host_page_size(); } =20 error =3D target_mmap(0, size + guard, PROT_READ | PROT_WRITE, diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c125031b90..a861f1e1d1 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -494,7 +494,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, may need to truncate file maps at EOF and add extra anonymous pages up to the targets page boundary. */ =20 - if ((qemu_real_host_page_size < qemu_host_page_size) && + if ((qemu_real_host_page_size() < qemu_host_page_size) && !(flags & MAP_ANONYMOUS)) { struct stat sb; =20 diff --git a/migration/migration.c b/migration/migration.c index 695f0f2900..4dcb511bb6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2652,7 +2652,7 @@ static struct rp_cmd_args { static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rb= name, ram_addr_t start, size_t len) { - long our_host_ps =3D qemu_real_host_page_size; + long our_host_ps =3D qemu_real_host_page_size(); =20 trace_migrate_handle_rp_req_pages(rbname, start, len); =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 32c52f4b1d..a66dd536d9 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -319,7 +319,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncom= ingState *mis) return false; } =20 - if (qemu_real_host_page_size !=3D ram_pagesize_summary()) { + if (qemu_real_host_page_size() !=3D ram_pagesize_summary()) { bool have_hp =3D false; /* We've got a huge page */ #ifdef UFFD_FEATURE_MISSING_HUGETLBFS @@ -357,7 +357,7 @@ static int test_ramblock_postcopiable(RAMBlock *rb, voi= d *opaque) */ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { - long pagesize =3D qemu_real_host_page_size; + long pagesize =3D qemu_real_host_page_size(); int ufd =3D -1; bool ret =3D false; /* Error unless we change it */ void *testarea =3D NULL; diff --git a/monitor/misc.c b/monitor/misc.c index a756dbd6db..b0fc0e5843 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -720,7 +720,7 @@ static uint64_t vtop(void *ptr, Error **errp) uint64_t pinfo; uint64_t ret =3D -1; uintptr_t addr =3D (uintptr_t) ptr; - uintptr_t pagesize =3D qemu_real_host_page_size; + uintptr_t pagesize =3D qemu_real_host_page_size(); off_t offset =3D addr / pagesize * sizeof(pinfo); int fd; =20 diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ddc6003de2..910a6c74df 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2974,10 +2974,10 @@ sub process { ERROR("use memset() instead of bzero()\n" . $herecurr); } if ($line =3D~ /\bgetpagesize\(\)/) { - ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $here= curr); + ERROR("use qemu_real_host_page_size() instead of getpagesize()\n" . $he= recurr); } if ($line =3D~ /\bsysconf\(_SC_PAGESIZE\)/) { - ERROR("use qemu_real_host_page_size instead of sysconf(_SC_PAGESIZE)\n"= . $herecurr); + ERROR("use qemu_real_host_page_size() instead of sysconf(_SC_PAGESIZE)\= n" . $herecurr); } my $non_exit_glib_asserts =3D qr{g_assert_cmpstr| g_assert_cmpint| diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 4e1b27a20e..cdf0db733e 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -1383,11 +1383,11 @@ long qemu_maxrampagesize(void) #else long qemu_minrampagesize(void) { - return qemu_real_host_page_size; + return qemu_real_host_page_size(); } long qemu_maxrampagesize(void) { - return qemu_real_host_page_size; + return qemu_real_host_page_size(); } #endif =20 @@ -2163,7 +2163,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ra= m_addr_t max_size, new_block->max_length =3D max_size; assert(max_size >=3D size); new_block->fd =3D -1; - new_block->page_size =3D qemu_real_host_page_size; + new_block->page_size =3D qemu_real_host_page_size(); new_block->host =3D host; new_block->flags =3D ram_flags; ram_block_add(new_block, &local_err); diff --git a/target/i386/hax/hax-mem.c b/target/i386/hax/hax-mem.c index a226d174d8..05dbe8cce3 100644 --- a/target/i386/hax/hax-mem.c +++ b/target/i386/hax/hax-mem.c @@ -188,15 +188,15 @@ static void hax_process_section(MemoryRegionSection *= section, uint8_t flags) /* Adjust start_pa and size so that they are page-aligned. (Cf * kvm_set_phys_mem() in kvm-all.c). */ - delta =3D qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_= mask); - delta &=3D ~qemu_real_host_page_mask; + delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); + delta &=3D ~qemu_real_host_page_mask(); if (delta > size) { return; } start_pa +=3D delta; size -=3D delta; - size &=3D qemu_real_host_page_mask; - if (!size || (start_pa & ~qemu_real_host_page_mask)) { + size &=3D qemu_real_host_page_mask(); + if (!size || (start_pa & ~qemu_real_host_page_mask())) { return; } =20 @@ -214,7 +214,7 @@ static void hax_process_section(MemoryRegionSection *se= ction, uint8_t flags) * call into the kernel. Instead, we split the mapping into smaller on= es, * and call hax_update_mapping() on each. */ - max_mapping_size =3D UINT32_MAX & qemu_real_host_page_mask; + max_mapping_size =3D UINT32_MAX & qemu_real_host_page_mask(); while (size > max_mapping_size) { hax_update_mapping(start_pa, max_mapping_size, host_va, flags); start_pa +=3D max_mapping_size; diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index b97d091a50..9f94041331 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -1075,15 +1075,15 @@ nvmm_process_section(MemoryRegionSection *section, = int add) } =20 /* Adjust start_pa and size so that they are page-aligned. */ - delta =3D qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_= mask); - delta &=3D ~qemu_real_host_page_mask; + delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); + delta &=3D ~qemu_real_host_page_mask(); if (delta > size) { return; } start_pa +=3D delta; size -=3D delta; - size &=3D qemu_real_host_page_mask; - if (!size || (start_pa & ~qemu_real_host_page_mask)) { + size &=3D qemu_real_host_page_mask(); + if (!size || (start_pa & ~qemu_real_host_page_mask())) { return; } =20 diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 03ba52da89..68a4ebe909 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1572,15 +1572,15 @@ static void whpx_process_section(MemoryRegionSectio= n *section, int add) return; } =20 - delta =3D qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_= mask); - delta &=3D ~qemu_real_host_page_mask; + delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); + delta &=3D ~qemu_real_host_page_mask(); if (delta > size) { return; } start_pa +=3D delta; size -=3D delta; - size &=3D qemu_real_host_page_mask; - if (!size || (start_pa & ~qemu_real_host_page_mask)) { + size &=3D qemu_real_host_page_mask(); + if (!size || (start_pa & ~qemu_real_host_page_mask())) { return; } =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index d1f07c4f41..8644b85de8 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -418,7 +418,7 @@ void kvm_check_mmu(PowerPCCPU *cpu, Error **errp) * will be a normal mapping, not a special hugepage one used * for RAM. */ - if (qemu_real_host_page_size < 0x10000) { + if (qemu_real_host_page_size() < 0x10000) { error_setg(errp, "KVM can't supply 64kiB CI pages, which guest expec= ts"); } diff --git a/tcg/region.c b/tcg/region.c index 97ca5291d5..71ea81d671 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -488,14 +488,14 @@ static int alloc_code_gen_buffer(size_t tb_size, int = splitwx, Error **errp) /* page-align the beginning and end of the buffer */ buf =3D static_code_gen_buffer; end =3D static_code_gen_buffer + sizeof(static_code_gen_buffer); - buf =3D QEMU_ALIGN_PTR_UP(buf, qemu_real_host_page_size); - end =3D QEMU_ALIGN_PTR_DOWN(end, qemu_real_host_page_size); + buf =3D QEMU_ALIGN_PTR_UP(buf, qemu_real_host_page_size()); + end =3D QEMU_ALIGN_PTR_DOWN(end, qemu_real_host_page_size()); =20 size =3D end - buf; =20 /* Honor a command-line option limiting the size of the buffer. */ if (size > tb_size) { - size =3D QEMU_ALIGN_DOWN(tb_size, qemu_real_host_page_size); + size =3D QEMU_ALIGN_DOWN(tb_size, qemu_real_host_page_size()); } =20 region.start_aligned =3D buf; @@ -729,7 +729,7 @@ static int alloc_code_gen_buffer(size_t size, int split= wx, Error **errp) */ void tcg_region_init(size_t tb_size, int splitwx, unsigned max_cpus) { - const size_t page_size =3D qemu_real_host_page_size; + const size_t page_size =3D qemu_real_host_page_size(); size_t region_size; int have_prot, need_prot; =20 diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 35088dd67f..9b1dab2f28 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -468,8 +468,8 @@ vubr_queue_set_started(VuDev *dev, int qidx, bool start= ed) =20 if (started && vubr->notifier.fd >=3D 0) { vu_set_queue_host_notifier(dev, vq, vubr->notifier.fd, - qemu_real_host_page_size, - qidx * qemu_real_host_page_size); + qemu_real_host_page_size(), + qidx * qemu_real_host_page_size()); } =20 if (qidx % 2 =3D=3D 1) { @@ -601,7 +601,7 @@ static void *notifier_thread(void *arg) { VuDev *dev =3D (VuDev *)arg; VubrDev *vubr =3D container_of(dev, VubrDev, vudev); - int pagesize =3D qemu_real_host_page_size; + int pagesize =3D qemu_real_host_page_size(); int qidx; =20 while (true) { @@ -637,7 +637,7 @@ vubr_host_notifier_setup(VubrDev *dev) void *addr; int fd; =20 - length =3D qemu_real_host_page_size * VHOST_USER_BRIDGE_MAX_QUEUES; + length =3D qemu_real_host_page_size() * VHOST_USER_BRIDGE_MAX_QUEUES; =20 fd =3D mkstemp(template); if (fd < 0) { diff --git a/util/cutils.c b/util/cutils.c index 0d475ec4cd..1173ce3b88 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -175,7 +175,7 @@ int qemu_fdatasync(int fd) int qemu_msync(void *addr, size_t length, int fd) { #ifdef CONFIG_POSIX - size_t align_mask =3D ~(qemu_real_host_page_size - 1); + size_t align_mask =3D ~(qemu_real_host_page_size() - 1); =20 /** * There are no strict reqs as per the length of mapping @@ -183,7 +183,7 @@ int qemu_msync(void *addr, size_t length, int fd) * alignment changes. Additionally - round the size to the multiple * of PAGE_SIZE */ - length +=3D ((uintptr_t)addr & (qemu_real_host_page_size - 1)); + length +=3D ((uintptr_t)addr & (qemu_real_host_page_size() - 1)); length =3D (length + ~align_mask) & align_mask; =20 addr =3D (void *)((uintptr_t)addr & align_mask); diff --git a/util/meson.build b/util/meson.build index f8f0643318..2d71ab57a4 100644 --- a/util/meson.build +++ b/util/meson.build @@ -42,7 +42,6 @@ if have_membarrier util_ss.add(files('sys_membarrier.c')) endif util_ss.add(files('log.c')) -util_ss.add(files('pagesize.c')) util_ss.add(files('qdist.c')) util_ss.add(files('qht.c')) util_ss.add(files('qsp.c')) diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 893d864354..5b90cb68ea 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -50,7 +50,7 @@ size_t qemu_fd_getpagesize(int fd) #endif #endif =20 - return qemu_real_host_page_size; + return qemu_real_host_page_size(); } =20 size_t qemu_mempath_getpagesize(const char *mem_path) @@ -81,7 +81,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) #endif #endif =20 - return qemu_real_host_page_size; + return qemu_real_host_page_size(); } =20 #define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory" @@ -101,7 +101,7 @@ static bool map_noreserve_effective(int fd, uint32_t qe= mu_map_flags) * MAP_NORESERVE. * b) MAP_NORESERVE is not affected by /proc/sys/vm/overcommit_memory. */ - if (qemu_fd_getpagesize(fd) !=3D qemu_real_host_page_size) { + if (qemu_fd_getpagesize(fd) !=3D qemu_real_host_page_size()) { return true; } =20 @@ -166,7 +166,7 @@ static void *mmap_reserve(size_t size, int fd) * We do this unless we are using the system page size, in which case * anonymous memory is OK. */ - if (fd =3D=3D -1 || qemu_fd_getpagesize(fd) =3D=3D qemu_real_host_page= _size) { + if (fd =3D=3D -1 || qemu_fd_getpagesize(fd) =3D=3D qemu_real_host_page= _size()) { fd =3D -1; flags |=3D MAP_ANONYMOUS; } else { @@ -243,7 +243,7 @@ static inline size_t mmap_guard_pagesize(int fd) /* Mappings in the same segment must share the same page size */ return qemu_fd_getpagesize(fd); #else - return qemu_real_host_page_size; + return qemu_real_host_page_size(); #endif } =20 diff --git a/util/osdep.c b/util/osdep.c index 84575ec218..97dc9bc65b 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -69,8 +69,8 @@ int qemu_madvise(void *addr, size_t len, int advice) =20 static int qemu_mprotect__osdep(void *addr, size_t size, int prot) { - g_assert(!((uintptr_t)addr & ~qemu_real_host_page_mask)); - g_assert(!(size & ~qemu_real_host_page_mask)); + g_assert(!((uintptr_t)addr & ~qemu_real_host_page_mask())); + g_assert(!(size & ~qemu_real_host_page_mask())); =20 #ifdef _WIN32 DWORD old_protect; diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 2ebfb75057..577c855612 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -767,7 +767,7 @@ void *qemu_alloc_stack(size_t *sz) #ifdef CONFIG_DEBUG_STACK_USAGE void *ptr2; #endif - size_t pagesz =3D qemu_real_host_page_size; + size_t pagesz =3D qemu_real_host_page_size(); #ifdef _SC_THREAD_STACK_MIN /* avoid stacks smaller than _SC_THREAD_STACK_MIN */ long min_stack_sz =3D sysconf(_SC_THREAD_STACK_MIN); @@ -829,7 +829,7 @@ void qemu_free_stack(void *stack, size_t sz) unsigned int usage; void *ptr; =20 - for (ptr =3D stack + qemu_real_host_page_size; ptr < stack + sz; + for (ptr =3D stack + qemu_real_host_page_size(); ptr < stack + sz; ptr +=3D sizeof(uint32_t)) { if (*(uint32_t *)ptr !=3D 0xdeadbeaf) { break; @@ -927,10 +927,10 @@ size_t qemu_get_host_physmem(void) #ifdef _SC_PHYS_PAGES long pages =3D sysconf(_SC_PHYS_PAGES); if (pages > 0) { - if (pages > SIZE_MAX / qemu_real_host_page_size) { + if (pages > SIZE_MAX / qemu_real_host_page_size()) { return SIZE_MAX; } else { - return pages * qemu_real_host_page_size; + return pages * qemu_real_host_page_size(); } } #endif diff --git a/util/oslib-win32.c b/util/oslib-win32.c index f139c069ae..3555b02350 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -319,7 +319,7 @@ void os_mem_prealloc(int fd, char *area, size_t memory,= int smp_cpus, Error **errp) { int i; - size_t pagesize =3D qemu_real_host_page_size; + size_t pagesize =3D qemu_real_host_page_size(); =20 memory =3D (memory + pagesize - 1) & -pagesize; for (i =3D 0; i < memory / pagesize; i++) { diff --git a/util/pagesize.c b/util/pagesize.c deleted file mode 100644 index 998632cf6e..0000000000 --- a/util/pagesize.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * pagesize.c - query the host about its page size - * - * Copyright (C) 2017, Emilio G. Cota - * License: GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" - -uintptr_t qemu_real_host_page_size; -intptr_t qemu_real_host_page_mask; - -static void __attribute__((constructor)) init_real_host_page_size(void) -{ - qemu_real_host_page_size =3D getpagesize(); - qemu_real_host_page_mask =3D -(intptr_t)qemu_real_host_page_size; -} diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index b037d5faa5..5ba01177bf 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -163,7 +163,7 @@ void *qemu_vfio_pci_map_bar(QEMUVFIOState *s, int index, Error **errp) { void *p; - assert(QEMU_IS_ALIGNED(offset, qemu_real_host_page_size)); + assert(QEMU_IS_ALIGNED(offset, qemu_real_host_page_size())); assert_bar_index_valid(s, index); p =3D mmap(NULL, MIN(size, s->bar_region_info[index].size - offset), prot, MAP_SHARED, @@ -591,9 +591,9 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState= *s, IOVAMapping m =3D {.host =3D host, .size =3D size, .iova =3D iova}; IOVAMapping *insert; =20 - assert(QEMU_IS_ALIGNED(size, qemu_real_host_page_size)); - assert(QEMU_IS_ALIGNED(s->low_water_mark, qemu_real_host_page_size)); - assert(QEMU_IS_ALIGNED(s->high_water_mark, qemu_real_host_page_size)); + assert(QEMU_IS_ALIGNED(size, qemu_real_host_page_size())); + assert(QEMU_IS_ALIGNED(s->low_water_mark, qemu_real_host_page_size())); + assert(QEMU_IS_ALIGNED(s->high_water_mark, qemu_real_host_page_size())= ); trace_qemu_vfio_new_mapping(s, host, size, index, iova); =20 assert(index >=3D 0); @@ -644,7 +644,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IO= VAMapping *mapping, =20 index =3D mapping - s->mappings; assert(mapping->size > 0); - assert(QEMU_IS_ALIGNED(mapping->size, qemu_real_host_page_size)); + assert(QEMU_IS_ALIGNED(mapping->size, qemu_real_host_page_size())); assert(index >=3D 0 && index < s->nr_mappings); if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) { error_setg_errno(errp, errno, "VFIO_UNMAP_DMA failed"); @@ -752,8 +752,8 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, siz= e_t size, IOVAMapping *mapping; uint64_t iova0; =20 - assert(QEMU_PTR_IS_ALIGNED(host, qemu_real_host_page_size)); - assert(QEMU_IS_ALIGNED(size, qemu_real_host_page_size)); + assert(QEMU_PTR_IS_ALIGNED(host, qemu_real_host_page_size())); + assert(QEMU_IS_ALIGNED(size, qemu_real_host_page_size())); trace_qemu_vfio_dma_map(s, host, size, temporary, iova); QEMU_LOCK_GUARD(&s->lock); mapping =3D qemu_vfio_find_mapping(s, host, &index); --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349296906334.35515332549744; Mon, 18 Apr 2022 23:21:36 -0700 (PDT) Received: from localhost ([::1]:41086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghF1-00035W-P3 for importer@patchew.org; Tue, 19 Apr 2022 02:21:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggls-00019J-VN for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:29 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglr-0004Pd-0H for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:28 -0400 Received: by mail-wr1-x42d.google.com with SMTP id x18so13071015wrc.0 for ; Mon, 18 Apr 2022 22:51:25 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wKAqJ3g+AyG1lYS8lbxSbCBSzbr7Sx+wsfehcGPklv8=; b=Il4FXmGi/tvgRUVljDn8+MaJmqC01hxUTyss7ebuNOHkK7TD/W8RgdW1bZke+1X2Xw NJlzmKNs/WKbt3A5GDjM0Ye9fV6gduguOhUdIvbRy3tTyYVqMElU3+BkhubhPRNjRDhC zuS2yZCRN+RwoWbFZyw1Fdi0wR2TM7uuYw/lZ79eWUmyL/vV0mSSoUKHNXQSe843do5z hx7cm3Af1y0FnJe7Fp/vRLADRgY9COyneHU/YCciUlJMXZxTHE+OtjzSPDo4SATcBLrG UMy38hdsXSBrqv7xZa5EhaO4sI2nnTGTwlpzfNdHNclXTMqfBc1TKNOR63IkcNWsu4cv nauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wKAqJ3g+AyG1lYS8lbxSbCBSzbr7Sx+wsfehcGPklv8=; b=XBHl5kXfoQ4VGwVaoFiRH/rxX5W9zaqAUpBq/dbuwyLYbfdSNNDeZTUmOh880f/BFU qgGqb4+iPIxXoGLa5O1oM7k7KZKPTRzKZwjaidjsLGEAh/5rGsDIEOiXTVM079ChxcbS goPpCT7Vtox0oc6XAjlUGXETSkJjaoKEqYu+QKaDZWPQgu1qCAKCvWtrklh781N4N2o3 b30cEwT7RxZxV2KNFZZfHHL6RJzvG35A+4Q0j5WOTfWgnAcWoo4jd1C9MKeF1VLZOJCw m5vTZRcoTkJStYUnhErEFjC2TlIB6r/1/DC3CQnXfwM36sAtLSqxE2nxdSEUgTdAytYB M0bg== X-Gm-Message-State: AOAM531eFu+TNpJQXY6tYx+tDag/0AvXLZ/85lal5IKxRMvMw2/WNq9l J0i5QqtNaYgOuzW2lW6RCHVthXNoZ+vTsA== X-Google-Smtp-Source: ABdhPJwg/bAAVbAISt4Qg18Edot/k0NGw9sqqlm1NaOd1/lbSlTOLq8Qy5fVTxL7bccTeaYCWdqAOA== X-Received: by 2002:a05:6000:2cb:b0:20a:88c4:ec9f with SMTP id o11-20020a05600002cb00b0020a88c4ec9fmr9490743wry.43.1650347484430; Mon, 18 Apr 2022 22:51:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 17/53] qga: replace deprecated g_get_current_time() Date: Tue, 19 Apr 2022 07:50:33 +0200 Message-Id: <20220419055109.142788-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349297875100001 From: Marc-Andr=C3=A9 Lureau According to GLib API: g_get_current_time has been deprecated since version 2.62 and should not be used in newly-written code. GTimeVal is not year-2038-safe. Use g_get_real_time() instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-13-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- qga/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qga/main.c b/qga/main.c index b9dd19918e..1deb0ee2fb 100644 --- a/qga/main.c +++ b/qga/main.c @@ -314,7 +314,6 @@ static void ga_log(const gchar *domain, GLogLevelFlags = level, const gchar *msg, gpointer opaque) { GAState *s =3D opaque; - GTimeVal time; const char *level_str =3D ga_log_level_str(level); =20 if (!ga_logging_enabled(s)) { @@ -329,9 +328,11 @@ static void ga_log(const gchar *domain, GLogLevelFlags= level, #else if (level & s->log_level) { #endif - g_get_current_time(&time); + gint64 t =3D g_get_real_time(); fprintf(s->log_file, - "%lu.%lu: %s: %s\n", time.tv_sec, time.tv_usec, level_str,= msg); + "%" G_GINT64_FORMAT ".%" G_GINT64_FORMAT + ": %s: %s\n", t / G_USEC_PER_SEC, t % G_USEC_PER_SEC, + level_str, msg); fflush(s->log_file); } } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349344036595.6671361095384; Mon, 18 Apr 2022 23:22:24 -0700 (PDT) Received: from localhost ([::1]:41430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghFm-0003JK-H6 for importer@patchew.org; Tue, 19 Apr 2022 02:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglt-00019M-0z for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:34 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:38826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglr-0004Pq-25 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:28 -0400 Received: by mail-wr1-x432.google.com with SMTP id p18so20086252wru.5 for ; Mon, 18 Apr 2022 22:51:26 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZukFrAOHSquEoKlieban8PRU7JBlDTXLluy9Ey5A1Jo=; b=dAyWLLdnaRDSrm+QHYjmEnk2sy4wrfV50Dch3OaNryiKFTH3ievGtSpiWhu77zA4hU Jyhrbhfe4yGhMU58jcDd0jUhdCmvHUbos97AjSgJxCvVLu2wsFPZrDnSY0CiHrLrvVJg eoZ9cFH0ZRti5uBcmPsfD9qATpJJxOE+k9Kf2vhYWbU8aRN54GjHBpEXVBqXhA7bf9R5 +Hb7iFSruGMcaJXdEPu9iTpnWUHes/6AIe+MX2LccxW9j97bdNYv3kxHPjV6CET6PJ08 fbNYffAT8wOCKg91BiX9Xujqg00knrzippt32tfkd+ki1QUp4LZmks1q99fKVQRkw2TJ /BSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ZukFrAOHSquEoKlieban8PRU7JBlDTXLluy9Ey5A1Jo=; b=pBcvkD6pgwN1KY/l72fhILCRoASlGGtzc1sbak6YMP8Uv63ZxELla0d3C2wbYNhQCG aGIb8a3rQtHoCeCM7f6gOLm1lMWsXo2dhNx/SiqEnb2wbalfuK1SIwrkIFeVuJrylQCV Y0JKsA4XeNzxQD+rWJf6w3RdX64Vw1T75EUr7GV7Ii7dbXYpup/gm+UkKl6kxMyTijVa 6JXHiXgLuaCnMzE6dmTF/biVYtFBqJ8QXWgX64TsM0U2jaKXb2zpudUHDGCeNRUq8HoL D3S74grmlpK4cxKRPZfVDdtAM9u2Ym0uk14tHq2jMEtrI68MQRkfOxhjE2MhGj7B/1ye XyTw== X-Gm-Message-State: AOAM533cu5IBV4TuyiurXV85CTJUMtmZQO6nGICyzS/96yUVPM61cT2n FsYLYUgmqJoVaH4l9u73sdr5lGjI4WOhbQ== X-Google-Smtp-Source: ABdhPJzgOwfl/CE1Q4YyfbMGSLCd3Cb72NwdaqQP8Qh0HWWpTEx5XcyS/bWz7SciGJOGAe5L5aqTgg== X-Received: by 2002:a05:6000:1f15:b0:207:afd5:44ab with SMTP id bv21-20020a0560001f1500b00207afd544abmr10449241wrb.478.1650347485106; Mon, 18 Apr 2022 22:51:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 18/53] error-report: replace deprecated g_get_current_time() with glib >= 2.62 Date: Tue, 19 Apr 2022 07:50:34 +0200 Message-Id: <20220419055109.142788-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::432; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349346100100001 From: Marc-Andr=C3=A9 Lureau According to GLib API: g_get_current_time has been deprecated since version 2.62 and should not be used in newly-written code. GTimeVal is not year-2038-safe. Use g_get_real_time() instead. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-14-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/glib-compat.h | 10 ++++++++++ util/qemu-error.c | 17 ++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/glib-compat.h b/include/glib-compat.h index 3113a7d2af..dc14d3ec0d 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -145,6 +145,16 @@ qemu_g_test_slow(void) #define g_test_thorough() qemu_g_test_slow() #define g_test_quick() (!qemu_g_test_slow()) =20 +#if GLIB_CHECK_VERSION(2,62,0) +static inline gchar * +g_date_time_format_iso8601_compat(GDateTime *datetime) +{ + return g_date_time_format_iso8601(datetime); +} + +#define g_date_time_format_iso8601 g_date_time_format_iso8601_compat +#endif + #pragma GCC diagnostic pop =20 #endif diff --git a/util/qemu-error.c b/util/qemu-error.c index 7769aee8e7..71ce3ee700 100644 --- a/util/qemu-error.c +++ b/util/qemu-error.c @@ -180,6 +180,19 @@ static void print_loc(void) } } =20 +static char * +real_time_iso8601(void) +{ +#if GLIB_CHECK_VERSION(2, 62, 0) + g_autoptr(GDateTime) dt =3D g_date_time_new_from_unix_utc(g_get_real_t= ime()); + return g_date_time_format_iso8601(dt); +#else + GTimeVal tv; + g_get_current_time(&tv); + return g_time_val_to_iso8601(&tv); +#endif +} + /* * Print a message to current monitor if we have one, else to stderr. * @report_type is the type of message: error, warning or informational. @@ -189,12 +202,10 @@ static void print_loc(void) */ static void vreport(report_type type, const char *fmt, va_list ap) { - GTimeVal tv; gchar *timestr; =20 if (message_with_timestamp && !monitor_cur()) { - g_get_current_time(&tv); - timestr =3D g_time_val_to_iso8601(&tv); + timestr =3D real_time_iso8601(); error_printf("%s ", timestr); g_free(timestr); } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349660491594.2762487553937; Mon, 18 Apr 2022 23:27:40 -0700 (PDT) Received: from localhost ([::1]:48978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghKq-0000BX-VB for importer@patchew.org; Tue, 19 Apr 2022 02:27:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggls-00019K-VC for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:29 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglr-0004Pv-2J for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:28 -0400 Received: by mail-wr1-x42e.google.com with SMTP id q3so20282540wrj.7 for ; Mon, 18 Apr 2022 22:51:26 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BCtb5iRKmFrpWSFDMJ54PwgAElhJqFeKD3Ys1qpVYa8=; b=jR7SzxD8uThp6R0yl4AZYRCwjBHlR0R+1At5dUalDh2XEAQnZGHN/ULiYv373WzLqf o09jCWQnYIE8ojSCzbW29F5gG7SeZsHxbcVrhQoS8FMpRvQiikQALt5kEtkND71QKgbg 9b3PY7kPUX7AT+dRG1Jq0c83ZY5/UkBaousI5k2CYct2GKckRVWKCcNVm1jDYMTbyzV8 t6DIal9v4oGh9CFdRsTtjTTi9mbMFukDQ0uiDjG2ei70fQxClPCr8NpFiyoUb1vbit+p DBVEAfuZIiXNXuwtuECAEidwb21EQ6b7aEx9C5BdZCBXMJAvcvHrDYsOm1KikCHoiZyc TJAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BCtb5iRKmFrpWSFDMJ54PwgAElhJqFeKD3Ys1qpVYa8=; b=frbQ/GYlNw9g3p0cIyl63IDRt3XRTFeBvOSKAs7d6i2V+KxsbiQchPe/UzuW/1M6wq 2Mi4Jx4DLcpYAbodoVCMWWMlm1md0SFzbJiJOLnC/UBF23iuPlNo1yfSDP2je9/hbpKx PadhqofbTIMDFf0BgvxFB7OBMMObv8n2/CeRxVmWu1/GbwI+vZBy8qfUF1F4ickurrQl pAa59G1gqJku6b/f9qoes6nf1bdxVTz2SBRZ4KU/hWLEAzcFf+hAZG2X0pB7OXxpPKKv LspuP3aWOc8HkzMdBw8V5b6VDDe6JB+rzffENXIzpoH/zTka4qzOv7lY1rPz48B7xwy1 NHXg== X-Gm-Message-State: AOAM531RTvsVMNsAqI+as2iZPg2qG2nN6aRbSU9PYVQjJB3jyFEHYJhi uiMzqXtcs9SaDfIW9i16N3TOTsK+GpTjzQ== X-Google-Smtp-Source: ABdhPJyIpAYVB3xUNaqbGXlIFYwCSZlD76pMxDQ4MuTmaRDDmUvGLBBymEm6ILGtu6ZPbmJUWYabHA== X-Received: by 2002:a5d:47c1:0:b0:20a:9f14:c128 with SMTP id o1-20020a5d47c1000000b0020a9f14c128mr3871490wrc.507.1650347485825; Mon, 18 Apr 2022 22:51:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 19/53] util: rename qemu-error.c to match its header name Date: Tue, 19 Apr 2022 07:50:35 +0200 Message-Id: <20220419055109.142788-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349662674100001 From: Marc-Andr=C3=A9 Lureau The header name is more appropriate. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-15-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- util/{qemu-error.c =3D> error-report.c} | 0 util/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename util/{qemu-error.c =3D> error-report.c} (100%) diff --git a/util/qemu-error.c b/util/error-report.c similarity index 100% rename from util/qemu-error.c rename to util/error-report.c diff --git a/util/meson.build b/util/meson.build index 2d71ab57a4..82eec004e2 100644 --- a/util/meson.build +++ b/util/meson.build @@ -28,7 +28,7 @@ util_ss.add(files('host-utils.c')) util_ss.add(files('bitmap.c', 'bitops.c')) util_ss.add(files('fifo8.c')) util_ss.add(files('cacheinfo.c', 'cacheflush.c')) -util_ss.add(files('error.c', 'qemu-error.c')) +util_ss.add(files('error.c', 'error-report.c')) util_ss.add(files('qemu-print.c')) util_ss.add(files('id.c')) util_ss.add(files('qemu-config.c', 'notify.c')) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350221711227.72747627963315; Mon, 18 Apr 2022 23:37:01 -0700 (PDT) Received: from localhost ([::1]:58394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghTw-0006xt-B3 for importer@patchew.org; Tue, 19 Apr 2022 02:37:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglv-0001A1-4b for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:36 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:38827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggls-0004Q0-KP for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:29 -0400 Received: by mail-wr1-x433.google.com with SMTP id p18so20086313wru.5 for ; Mon, 18 Apr 2022 22:51:27 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GmjyLZQYsGB/Vh7JMnCX3wvH/I72Pbuvc/SQfMglBh4=; b=gMAzO56zSXPGsVtUuIzZhBaqFOv40fCPQWL8xDd7SayVqfhMS+KsKoLIjCFqMs8gMA S1RrshRH0GyOA7jqcPwqjDIYVrcAK5h518Dc8ZxRWiTYUhAX4djrqFyMqAwikbQUsljc nIHGEldSnnNPce2ok4lfpIrFnHmHKn6/XPDI8oe+26X1uBtcD3fT/ta5vm9xF2pghrqP A4aBOoDF5npQLjCZy9KIzle+P6kFeP3P01vU+pijKiBFbhLSQIuvaYcgzOq+CGRduOkt he+Uf6UoxBqN+F0Onffdo+XsgeD2CqquqBQupkwoR2noIYVfj9wGspC3unyH5DTpGj+b RTYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GmjyLZQYsGB/Vh7JMnCX3wvH/I72Pbuvc/SQfMglBh4=; b=7qNQPZLndJFMVbj1E3+IX28nKcLTVC7WQcsK+q/cXgvMdJuewMby1uHrdd1iBtZ9oH WvKo6POZYmbiIsNHMjzPq9cPI+cNP70YjjuBUcTLNQU7xw9lpiJwJcuHn3xwcGMbx/NL adUp/gUSX7hH/dhQF42YnzRPVetQqwjAhYg6aS7hHNnx1E3cssF5l+C5/M5DnxCcuIfj qiPgrSDnX+3vAhVdaxbJ7g2h5xWSGfgstsZVx+0hTA2A236+eXVk6ipIhrV+mYDg97yc WMADhiTbNFCMzPDOhrngQdnMJ7dpxjb/svivyswqXFkuolWSuoIHoInLs07o0+++pmB0 wOew== X-Gm-Message-State: AOAM533VYNzbBcnpFy0rpsFbLPRboxRnljFUJJ16FCW/oAeQ7h6BdIiZ v5FJvZZQWG/KWm7NbZ3rQDtPLEGMi7h9zw== X-Google-Smtp-Source: ABdhPJzO+WaG/HHIuHkEe4xucmIEvSDseI/+khIDZlKHbpkz4d0JriFw2tEvGdW5bneRttoGRjyFJA== X-Received: by 2002:a5d:6d8f:0:b0:20a:a699:874d with SMTP id l15-20020a5d6d8f000000b0020aa699874dmr1225901wrs.386.1650347486409; Mon, 18 Apr 2022 22:51:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/53] error-report: use error_printf() for program prefix Date: Tue, 19 Apr 2022 07:50:36 +0200 Message-Id: <20220419055109.142788-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::433; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350222248100001 From: Marc-Andr=C3=A9 Lureau For consistency with other calls in the function, let's use error_printf(). (it will use stderr since !monitor_cur()) Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-16-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- util/error-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/error-report.c b/util/error-report.c index 71ce3ee700..d9d3ac30cf 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -156,7 +156,7 @@ static void print_loc(void) const char *const *argp; =20 if (!monitor_cur() && g_get_prgname()) { - fprintf(stderr, "%s:", g_get_prgname()); + error_printf("%s:", g_get_prgname()); sep =3D " "; } switch (cur_loc->kind) { --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349728562865.3195469456193; Mon, 18 Apr 2022 23:28:48 -0700 (PDT) Received: from localhost ([::1]:49892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghLz-0000q9-3D for importer@patchew.org; Tue, 19 Apr 2022 02:28:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglv-00019z-4W for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:36 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:39830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggls-0004QG-Kp for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:29 -0400 Received: by mail-wr1-x430.google.com with SMTP id m14so20920516wrb.6 for ; Mon, 18 Apr 2022 22:51:28 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MsfA/9glINbwkIjZMRchO6BQDlKZM5vNXBQVpYPOsoc=; b=KWvVAUMl+cDewc0Tw7y6SwbZeqMmTUzwFhh5k8NgGhc2lf8RPfqSkexiNLgo73+/lr IsoNYI/EUL/2cayNrTx70D5ivkUTqXUqCFjKu+c5WeK/XejdMkfSyk02+aIPIfzxEbIF +H8ppapBtT1YWxoAS/Y9yVgaqnwRqQLx/hND5JnRhl7lmbP7n1A9uammOTTZzkNt9Aj8 Cx0GrPo7ZjJilQYwQ8FIFbCwwZcDGufX/Sc5XCSuqZ/TGq5B4ABcrBxmXTDRPkc6NSVv s+f6ONDo0bnwqh3NeMW3j0/mogQpM6BjVt33X3ZRlwuWw4tGEn75+r0xjAjifqewIWDx 6bjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=MsfA/9glINbwkIjZMRchO6BQDlKZM5vNXBQVpYPOsoc=; b=ZJ4/3xA9D1FcQxx2AEL6Z9KapA9rn+kIHCxD2aAWHHaQTV40+LF0L8NT8n/MKoxZpV C7gyerHpUxT+XHPK/vbiGHF7XVAYVJVjGxJoo9fBBZqWtWkGXF7sE08LwEuOSQMvRWBQ 8TpXeEcxJr3ynws4kYE5/zSBSlrhoSM07C4DT03+gfEnNqJfDvrEhu2+kvWFhWMowL64 Y1Wk1pzlGRkIzKOskiJvxLi6UknbFOmAw48WuQY7gMfnwWK0oBjM/6ihFoQjYzaATBUO uE8hTtE1J6AaXliG7EqZjb/vcvKsXxqrL/6TF71lSM/IbYOVU9Bk0saopJQIUl24jP0g VtVw== X-Gm-Message-State: AOAM5328Oxu4xQqdWNyMXo7D+f15yAtYj0+dSu6HmE45WDvh+fwe28qi u0vW0/vxlwgZKoIFpcTLFPyMq55NodS8jA== X-Google-Smtp-Source: ABdhPJxn7S9BhvmcZmePes8qAUbQvCsqokoZ/EbozI2Xnk08uZj9DKPVZ7NZA5D7ETuz6QU2h7kolw== X-Received: by 2002:a5d:66d0:0:b0:207:a53f:5c2d with SMTP id k16-20020a5d66d0000000b00207a53f5c2dmr10347509wrw.440.1650347487038; Mon, 18 Apr 2022 22:51:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 21/53] include: move TFR to osdep.h Date: Tue, 19 Apr 2022 07:50:37 +0200 Message-Id: <20220419055109.142788-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::430; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349730646100005 From: Marc-Andr=C3=A9 Lureau The macro requires EINTR, which has its header included in osdep.h. (Not sure what TFR stands for, perhaps "Test For Retry". Rename it ?) Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-17-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 2 -- include/qemu/osdep.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index f9b3f85b81..db8b03be51 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -10,8 +10,6 @@ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H =20 -#define TFR(expr) do { if ((expr) !=3D -1) break; } while (errno =3D=3D EI= NTR) - /* Copyright string for -version arguments, About dialogs, etc */ #define QEMU_COPYRIGHT "Copyright (c) 2003-2022 " \ "Fabrice Bellard and the QEMU Project developers" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 240b48707e..489a5d1aad 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -226,6 +226,8 @@ extern "C" { #define ESHUTDOWN 4099 #endif =20 +#define TFR(expr) do { if ((expr) !=3D -1) break; } while (errno =3D=3D EI= NTR) + /* time_t may be either 32 or 64 bits depending on the host OS, and * can be either signed or unsigned, so we can't just hardcode a * specific maximum value. This is not a C preprocessor constant, --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349034343970.6601701774161; Mon, 18 Apr 2022 23:17:14 -0700 (PDT) Received: from localhost ([::1]:35186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghAn-0007No-8J for importer@patchew.org; Tue, 19 Apr 2022 02:17:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglv-0001A2-Fd for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:37 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglt-0004QM-23 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:31 -0400 Received: by mail-wr1-x430.google.com with SMTP id t1so20933529wra.4 for ; Mon, 18 Apr 2022 22:51:28 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LPN+3jG6P55TcAsaux9fgkoAhIOtmmMBmGdDsBMbcZQ=; b=Rx5d8awkAWkjJvTbL4HlIySb0+bYp9JDXTXeMYcHWddBzK0yTRBoSszcqvn8zBN9+A h8j0URPg0JIGmm/VL2YphDlPREOwu0vYCvXgJYc8hRnvmzuY76oS0D6/pvUABgsfPlWl AQRg9aOhwLg2tByXVTF1Wic3b1Rg04z11agP6pie4oA5BBxQrQALSG9eWhTzrxVl32Dc O3l7nc/yv4iMs9gN9gXap2PQgPY03p29LWAIUn4PtDxmtlySI+jixS2XJrUiZU0nB0rV CXJ4eYtVGEfrY7fyhQ0/cNCwv0j51B08aTgCVjzoLswIMpDZm2PWum07MlSsOk3oV94H wqgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LPN+3jG6P55TcAsaux9fgkoAhIOtmmMBmGdDsBMbcZQ=; b=eTzHkyobrQ0t3qJzjzAmqscGwYz/HFYpqSYk0IvQrV13Rk3gEH/Dd/lc3TTWykHVY9 BoLadj2M2Wr1Cz+PUEViZynIS/DY2HeZY+XWTQ9kfTkwFH2X/hFBoQQ2hiMOig2KE4CF a97xAn5T8aPFIBVGJEgR4CuWC12W9ozSyKU7hH/kCjpOQt+1iiw0e5AiWww5mhWtB8HH LyAzIpKZwTB4ms23DSvmIUQvWM+PmrrbFmM4R5bMNIufCYX57Tpt7CSI3dA8YXT2QuPK zvDock3HAO6MPcj2KfWl9VRtXdZVocc/8R6Y9S0jdkyVZT6+5CwbT5ygn0lJZ6K40rAI N1Qw== X-Gm-Message-State: AOAM533MSN0XcD/v+d1OBklYICUPyelVlglihZOXAdlHQI16JyOjpW34 gVwwLbdc6ldFQyHHE64PfFDMbnDMD0wdlw== X-Google-Smtp-Source: ABdhPJxBCkr9OYn6TDoK8MIdR4CCjMM96eCDWFXqImnP7CjKlptN6VkZMVf0wZRFKrzjZIOdXyIKUw== X-Received: by 2002:adf:b745:0:b0:205:b8e2:f470 with SMTP id n5-20020adfb745000000b00205b8e2f470mr10204486wre.91.1650347487736; Mon, 18 Apr 2022 22:51:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 22/53] include: move qemu_write_full() declaration to osdep.h Date: Tue, 19 Apr 2022 07:50:38 +0200 Message-Id: <20220419055109.142788-23-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::430; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349036632100001 From: Marc-Andr=C3=A9 Lureau Closer to other IO functions. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-18-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 3 --- include/qemu/osdep.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index db8b03be51..c6f3ed94bc 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,9 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -ssize_t qemu_write_full(int fd, const void *buf, size_t count) - G_GNUC_WARN_UNUSED_RESULT; - #ifndef _WIN32 int qemu_pipe(int pipefd[2]); #endif diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 489a5d1aad..259436ff53 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -527,6 +527,9 @@ static inline void qemu_timersub(const struct timeval *= val1, #define qemu_timersub timersub #endif =20 +ssize_t qemu_write_full(int fd, const void *buf, size_t count) + G_GNUC_WARN_UNUSED_RESULT; + void qemu_set_cloexec(int fd); =20 void fips_set_state(bool requested); --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350193809278.10267742814347; Mon, 18 Apr 2022 23:36:33 -0700 (PDT) Received: from localhost ([::1]:58274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghTU-0006tL-MX for importer@patchew.org; Tue, 19 Apr 2022 02:36:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglw-0001A3-5r for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:36 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:34572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglt-0004QW-Pv for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:31 -0400 Received: by mail-wr1-x42e.google.com with SMTP id c10so20947458wrb.1 for ; Mon, 18 Apr 2022 22:51:29 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dTOCe+fx+0QlZrMhUIaxDBklKAMEi+ux1ML0cki4e7U=; b=OKmLr+Sgd1rAWNnyV1ZbjZI8mkBSR+Fek1SeMUbxc/63w+rb1cycYKZR/RRNahZ8+c dM5cR6oE563BZR5r7zhOaaf3dS8gJjPqzUYAT89PxDkwpHEbtby7LZr4kEnarEAXCEP4 9x3KumuFX2+tBedfQXEDpsaNmdSMmIued4GQLPf6k7qYMV8lMUsb89sSqd9KAnQwAvqu 7GYlOVrcmlHC6nYzq32ehMe7VdIviD/rQdbft8HdAmXTdhjxz9CD9XQmvM34ieJzhsAS Zb3GRgXULMVUgmnTkTwHigvqc1wIJ/20KG9HTPalRxoro1iFDbkewjxoMC/0svwyGPfa nvzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dTOCe+fx+0QlZrMhUIaxDBklKAMEi+ux1ML0cki4e7U=; b=61OugcX3os+s9+bRtwWF5fASYaiuGLqj/R3ItldGIPgY+P4Y7DyNcfORodzOMvRm6Y N8R3MHQbh5smOhGteZGxTfir4dU8sT4ZMzVY7QzIHIwdwo1zQ1mb0Pvo5TGWIln22NaY W+plqBj4J5H1hEoHVc30lS4JhD1KIEBH/oJEkkwMh//F7M2G6Bt+A3JN10DNZ1UMM3Mq bcQytB6TejjWJzMlyPxRfhZyfqzPYQuuyC5VYwbktJhgLtoC46cWHjv1mKzQNstDY0j6 iYyUWm198rjrRNiwNIpzRdx18a9eka6qVT8DqY5rAJ+CTmIE5esGieqYWIa/EQU9C1f+ vJtg== X-Gm-Message-State: AOAM532Bdd7bB2Gbrq/RK9n21pcKmqe8Re5o+GIj9XxsHVaz43w0KOzd AawRyVU6ZKbVkl8A3CJL4n1jo1NAJhZRwA== X-Google-Smtp-Source: ABdhPJz2LfSVh1T0p2iwxyhGTGkCcs3m2l0JubQk73HIYpBUIbH24RqF4AZSiB7O2lBVvuPLS+VNIw== X-Received: by 2002:a5d:64ed:0:b0:20a:a5ea:e0cd with SMTP id g13-20020a5d64ed000000b0020aa5eae0cdmr1575694wri.520.1650347488384; Mon, 18 Apr 2022 22:51:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 23/53] include: move qemu_pipe() to osdep.h Date: Tue, 19 Apr 2022 07:50:39 +0200 Message-Id: <20220419055109.142788-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350195935100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 4 ---- include/qemu/osdep.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index c6f3ed94bc..2e1e76014a 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,10 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -#ifndef _WIN32 -int qemu_pipe(int pipefd[2]); -#endif - void cpu_exec_init_all(void); void cpu_exec_step_atomic(CPUState *cpu); =20 diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 259436ff53..a733294710 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -530,6 +530,10 @@ static inline void qemu_timersub(const struct timeval = *val1, ssize_t qemu_write_full(int fd, const void *buf, size_t count) G_GNUC_WARN_UNUSED_RESULT; =20 +#ifndef _WIN32 +int qemu_pipe(int pipefd[2]); +#endif + void qemu_set_cloexec(int fd); =20 void fips_set_state(bool requested); --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351261906222.41754252445958; Mon, 18 Apr 2022 23:54:21 -0700 (PDT) Received: from localhost ([::1]:47710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghki-0002l5-5u for importer@patchew.org; Tue, 19 Apr 2022 02:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglz-0001AC-11 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:38 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglu-0004Qv-Sy for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:32 -0400 Received: by mail-wr1-x431.google.com with SMTP id k22so20924239wrd.2 for ; Mon, 18 Apr 2022 22:51:30 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=54DtW3V9fXKiMM8ZvlFi5rLnJng8Z0PQBdNNEZOkJFU=; b=PtZ9TUslypFyaLhFQzGkR0CZtL+efLQpfonqczAWiq9sy49l/OO0N9VKHFUiARIsjD 7swKxn3OKOy4VVMuMPP3DsQfYL4voDvzkFrU9Libp9R0p2hB29wCJ4ygMtRUt4U8Zi03 SXLgSO6UWwQnTRjhkota9GwzEP1ktM5le/DL3/4xlYX/wsxyXostvtbL+UrGiNM2DXDx YyU5dvjNynow5O6RVXLIbUoelxXPaQ2mS1VUiYapOaBLnFXQzOE/CD+l/8DDyju0kk4E k1UhHgo9vVw2f2sgpehMKBo2eCbTcJAC+Iz13ohs6dbMBuHa2vE+Q3JNnDUu5dWqIvxl hqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=54DtW3V9fXKiMM8ZvlFi5rLnJng8Z0PQBdNNEZOkJFU=; b=x1zXQNhq3pEGDCnZskwbfdAb8H8nyQTtD8HtHR8bx4DKTe6LG1bMRd/Jym68H/nkrD mUXnNwR88d5gXoy9uaFZWqVTOpBRaxwi8XE7OMyd7s0k1YQIsl19cPBbr+hX0M9wl497 P2ZZNGAyAHcDaFD0lP6wgiwmRvQQT7lhSntN2Yp+ymN/XoncObhpl1fVfWoyHBYu1Cc4 l3pIjoNZwEo6XO6IWRPhhEYgHlNGSIDqGHgrlhjptzaFqTIHvqs+OD+825l8b4CceoYG 8LYlzMwLJT4JL+2ZpjVe/2S6ENkBNpDAi01nGFuOirLvwyNw4Z4nV5D/cOYUK9erTtnG pNqA== X-Gm-Message-State: AOAM531b3n66PWjJE77w0ycSnkGzVPFHkQcEgrK0Bwuacz/uPbNf2mjb 3TgUbRdP7CyzD5AeyzD026ErFveiIg9Fwg== X-Google-Smtp-Source: ABdhPJwljDg76rmbWVoLJQMvDsd8hbCa6q2OBxrB7LSDlQzxGC2+Bo11M1gFuO1oUwyL86D0/a0cEg== X-Received: by 2002:a5d:49c1:0:b0:20a:a65b:4648 with SMTP id t1-20020a5d49c1000000b0020aa65b4648mr1374632wrs.707.1650347489143; Mon, 18 Apr 2022 22:51:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 24/53] include: move coroutine IO functions to coroutine.h Date: Tue, 19 Apr 2022 07:50:40 +0200 Message-Id: <20220419055109.142788-25-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::431; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351262430100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-20-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 23 ----------------------- include/qemu/coroutine.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 2e1e76014a..fdb0b16166 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -45,29 +45,6 @@ bool set_preferred_target_page_bits(int bits); */ void finalize_target_page_bits(void); =20 -/** - * Sends a (part of) iovec down a socket, yielding when the socket is full= , or - * Receives data into a (part of) iovec from a socket, - * yielding when there is no data in the socket. - * The same interface as qemu_sendv_recvv(), with added yielding. - * XXX should mark these as coroutine_fn - */ -ssize_t qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cn= t, - size_t offset, size_t bytes, bool do_send); -#define qemu_co_recvv(sockfd, iov, iov_cnt, offset, bytes) \ - qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, false) -#define qemu_co_sendv(sockfd, iov, iov_cnt, offset, bytes) \ - qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, true) - -/** - * The same as above, but with just a single buffer - */ -ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_sen= d); -#define qemu_co_recv(sockfd, buf, bytes) \ - qemu_co_send_recv(sockfd, buf, bytes, false) -#define qemu_co_send(sockfd, buf, bytes) \ - qemu_co_send_recv(sockfd, buf, bytes, true) - void qemu_progress_init(int enabled, float min_skip); void qemu_progress_end(void); void qemu_progress_print(float delta, int max); diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index c828a95ee0..284571badb 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -343,4 +343,27 @@ void qemu_coroutine_decrease_pool_batch_size(unsigned = int additional_pool_size); =20 #include "qemu/lockable.h" =20 +/** + * Sends a (part of) iovec down a socket, yielding when the socket is full= , or + * Receives data into a (part of) iovec from a socket, + * yielding when there is no data in the socket. + * The same interface as qemu_sendv_recvv(), with added yielding. + * XXX should mark these as coroutine_fn + */ +ssize_t qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cn= t, + size_t offset, size_t bytes, bool do_send); +#define qemu_co_recvv(sockfd, iov, iov_cnt, offset, bytes) \ + qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, false) +#define qemu_co_sendv(sockfd, iov, iov_cnt, offset, bytes) \ + qemu_co_sendv_recvv(sockfd, iov, iov_cnt, offset, bytes, true) + +/** + * The same as above, but with just a single buffer + */ +ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_sen= d); +#define qemu_co_recv(sockfd, buf, bytes) \ + qemu_co_send_recv(sockfd, buf, bytes, false) +#define qemu_co_send(sockfd, buf, bytes) \ + qemu_co_send_recv(sockfd, buf, bytes, true) + #endif /* QEMU_COROUTINE_H */ --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349411197786.648817678611; Mon, 18 Apr 2022 23:23:31 -0700 (PDT) Received: from localhost ([::1]:43792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghGr-00051a-QR for importer@patchew.org; Tue, 19 Apr 2022 02:23:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngglz-0001AG-2R for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:38 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:36666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglu-0004R5-Vj for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:32 -0400 Received: by mail-wr1-x42a.google.com with SMTP id u3so20941560wrg.3 for ; Mon, 18 Apr 2022 22:51:30 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DPaV3Nf/LakxybSDuUjA/jXWl5Jzg2SwVgqYYAm5Mhg=; b=gxjfTTFXyRQRwmUErPZpw/gJ7FOrRt8GXPuXLBtGmaY7YA7jM9LxWSk4nwqnsuO/Ai yiPVmpg+56/IqZ3w8FfGljW3ABa3NIcTjoWOILsJ2JhkPKVA3QQ1BnMcTdc1lCVf1RqN cgnVRth5uWIUWzQPh4iFoacj0c7SglfThLAqOrVlnipwTC9rXWk9WPNElea28lxRiRQZ aD7df2uwAUH9NoDMM9lbGfiW80WKrokl6NZyqWWZmsGOzFOeTGPb1AvpCH3ZOKzk6iQT I/Ehq6jjPGaBAXVa1msxBpduNJzelGb0sl2ydTXQeeR6RXY6Jj8KbcKu3F+luA/8AOJO tGFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DPaV3Nf/LakxybSDuUjA/jXWl5Jzg2SwVgqYYAm5Mhg=; b=zG1dcomLAv4OSygdeSyBN8s1DR+k4USmdHSwlukp7Wvhl16tsFOhZ6Uqk7IFVWyjeb FcmgnAQ3ReLHggiQuhtYgUAXNOLC0glR2FLaRVFsviHQqTLPQY8bAO6vI4n5D/l9wkqb 3DcTW6yKVmmk1Uhm2tQwK95xUm2ZvZVg+Sv5GHZj/vQSQovQrwyul6Bp3VYZlb8iYaFF 52KxxBEpiW/E9V8ckGBaBpczNYp2btX9ufIM4L8q50ktmra+tV2Pm4AilVAzVjhPwBuW W6VCjMNtW/mH+haA/SeUe1y4DGAR3d28EkhfoW5ykS83UqrFdNfLlj0ByYtrPhfyAj52 v+vQ== X-Gm-Message-State: AOAM531A3rcH6vcyrMSlpgCDFUF3YCn19Riu2iRatWGJYlSDjW90xopv sPG09NOnLLfgTGTV0fPlxCBsyqHEAXUOqw== X-Google-Smtp-Source: ABdhPJy1bLOgwDlGh4SB0pAPHnjw6aWXPJhPG0jqOJKiOPv0dcWfXKwjkaWVx1wLccz+rFpu6giWaQ== X-Received: by 2002:a5d:6c66:0:b0:20a:847e:10b9 with SMTP id r6-20020a5d6c66000000b0020a847e10b9mr11132563wrz.82.1650347489823; Mon, 18 Apr 2022 22:51:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 25/53] include: move dump_in_progress() to runstate.h Date: Tue, 19 Apr 2022 07:50:41 +0200 Message-Id: <20220419055109.142788-26-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42a; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349412434100001 From: Marc-Andr=C3=A9 Lureau Along with other state tracking functions. Rename it for consistency. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-21-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- dump/dump.c | 4 ++-- include/qemu-common.h | 4 ---- include/sysemu/runstate.h | 1 + monitor/qmp-cmds.c | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index f57ed76fa7..5d71c47d06 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1564,7 +1564,7 @@ static void dump_state_prepare(DumpState *s) *s =3D (DumpState) { .status =3D DUMP_STATUS_ACTIVE }; } =20 -bool dump_in_progress(void) +bool qemu_system_dump_in_progress(void) { DumpState *state =3D &dump_state_global; return (qatomic_read(&state->status) =3D=3D DUMP_STATUS_ACTIVE); @@ -1930,7 +1930,7 @@ void qmp_dump_guest_memory(bool paging, const char *f= ile, =20 /* if there is a dump in background, we should wait until the dump * finished */ - if (dump_in_progress()) { + if (qemu_system_dump_in_progress()) { error_setg(errp, "There is a dump in process, please wait."); return; } diff --git a/include/qemu-common.h b/include/qemu-common.h index fdb0b16166..5f53a0e112 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -76,8 +76,4 @@ int parse_debug_env(const char *name, int max, int initia= l); =20 void page_size_init(void); =20 -/* returns non-zero if dump is in progress, otherwise zero is - * returned. */ -bool dump_in_progress(void); - #endif diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index a535691573..c3f445dd26 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -69,6 +69,7 @@ void qemu_system_killed(int signal, pid_t pid); void qemu_system_reset(ShutdownCause reason); void qemu_system_guest_panicked(GuestPanicInformation *info); void qemu_system_guest_crashloaded(GuestPanicInformation *info); +bool qemu_system_dump_in_progress(void); =20 #endif =20 diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 0b04855ce8..883cf1ca4b 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -85,7 +85,7 @@ void qmp_stop(Error **errp) { /* if there is a dump in background, we should wait until the dump * finished */ - if (dump_in_progress()) { + if (qemu_system_dump_in_progress()) { error_setg(errp, "There is a dump in process, please wait."); return; } @@ -115,7 +115,7 @@ void qmp_cont(Error **errp) =20 /* if there is a dump in background, we should wait until the dump * finished */ - if (dump_in_progress()) { + if (qemu_system_dump_in_progress()) { error_setg(errp, "There is a dump in process, please wait."); return; } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650349873468615.7308578182588; Mon, 18 Apr 2022 23:31:13 -0700 (PDT) Received: from localhost ([::1]:52224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghOK-0002V4-DK for importer@patchew.org; Tue, 19 Apr 2022 02:31:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggm1-0001AE-1r for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:39 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:35648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngglv-0004RC-Mz for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:33 -0400 Received: by mail-wr1-x433.google.com with SMTP id k22so20924277wrd.2 for ; Mon, 18 Apr 2022 22:51:31 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=doPYRJXO4FIrj8QeZrC5l66bCm+FyhPuKeiN1xstxHU=; b=ZuF9/23aKKC/zTTgo4hVe0DL/YRA53J7lB8hxAMuplVzA81fnFGjVb/hpK5dA1YiL8 tYLqabpy1WnG20I/cDt1kt7Jcuv1IODkDyTpH/+37+YKO58KE8NsK56pYmsAeWcbNL+Z EKBwnKpy9TRDR/t7hQkNHn5DKaI0YgDYVIGaJdUrJr5mLqQl/03ClBoY2tPTpB3Gy2lH /ypBqAz3wWbVTmUx4xjr6D9B8DlJhGmAoOY64mqB1SbZv4hzUkmIfcxYFFhYXRA92B6v vnjNjUmSoCnv7HoVedkxBHdSBgpiCk81jAIUGXge1yjHjy7q1wqfJN1fPFZYQdUbuM5M Xq/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=doPYRJXO4FIrj8QeZrC5l66bCm+FyhPuKeiN1xstxHU=; b=BowN7uXyuyHF1ji7Z8uoyaT8skSy9j63hQj3pd92BxBQbgNc6yoEf88VcUy+Syv5Fj 94d9NnLA+0Kq3Z6QXv2KnquS7J2wk0dQrZUAg7KYhSG2HV/kUMPuT2Jc4DOyiQYR7hb0 QEoNDaaB+Z8zFOLDJw/BvAX06Cvv3NVXLZjiRnbbCLUyio29fSmDrSpQ4sN4XkH+weie yuwDxEjmqDEWTcQvOHGiW1gowPy8n4+LjNviZrkJERLsIRv4NfSX5epZdMMzYBdX6TQp EZ4DHSWaXXANxOzN2x+BwXo4yB7U4FTlcbbWY9I+tMCMHQUGO9NdBcZr11cpuwr2VQuP 9FQQ== X-Gm-Message-State: AOAM533bkY7i4B3gJ64mmKSXVzsEyO0DazJsW30x+hbFllyAWDmIljha fHj7OAA9RN9nwzB4ncwZbTO7Lx4EThadGw== X-Google-Smtp-Source: ABdhPJxw/uimt23pKAo/NxsQLh6mc4c3Y7p5voDxYSu1DiJEDyRa9On+ACoYFd6kAhja4SQxpVnO+A== X-Received: by 2002:a05:6000:1002:b0:207:a28a:c86a with SMTP id a2-20020a056000100200b00207a28ac86amr10349904wrx.361.1650347490409; Mon, 18 Apr 2022 22:51:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 26/53] include: move C/util-related declarations to cutils.h Date: Tue, 19 Apr 2022 07:50:42 +0200 Message-Id: <20220419055109.142788-27-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::433; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650349874188100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-22-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- hw/dma/xlnx_dpdma.c | 2 +- hw/usb/ccid-card-passthru.c | 2 +- hw/usb/dev-smartcard-reader.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/vhost-vdpa.c | 2 +- include/qemu-common.h | 20 -------------------- include/qemu/cutils.h | 20 ++++++++++++++++++++ net/announce.c | 2 +- tests/qtest/npcm7xx_rng-test.c | 2 +- util/hexdump.c | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hw/dma/xlnx_dpdma.c b/hw/dma/xlnx_dpdma.c index 2d7eae72cd..dd66be5265 100644 --- a/hw/dma/xlnx_dpdma.c +++ b/hw/dma/xlnx_dpdma.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/log.h" #include "qemu/module.h" #include "hw/dma/xlnx_dpdma.h" diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index fa3040fb71..f530ab2565 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/units.h" #include #include "chardev/char-fe.h" diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 91ffd9f8ae..28164d89be 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -37,7 +37,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "hw/qdev-properties.h" diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 8692ea2561..3bc4dee7fe 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -26,7 +26,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/units.h" #include "qapi/error.h" #include "qemu/timer.h" diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index bc54f9fc44..b57be529c7 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -20,10 +20,10 @@ #include "hw/virtio/vhost-shadow-virtqueue.h" #include "hw/virtio/vhost-vdpa.h" #include "exec/address-spaces.h" +#include "qemu/cutils.h" #include "qemu/main-loop.h" #include "cpu.h" #include "trace.h" -#include "qemu-common.h" #include "qapi/error.h" =20 /* diff --git a/include/qemu-common.h b/include/qemu-common.h index 5f53a0e112..08f40a9d1e 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -54,26 +54,6 @@ const char *qemu_get_vm_name(void); void os_setup_early_signal_handling(void); int os_parse_cmd_args(int index, const char *optarg); =20 -/* - * Hexdump a line of a byte buffer into a hexadecimal/ASCII buffer - */ -#define QEMU_HEXDUMP_LINE_BYTES 16 /* Number of bytes to dump */ -#define QEMU_HEXDUMP_LINE_LEN 75 /* Number of characters in line */ -void qemu_hexdump_line(char *line, unsigned int b, const void *bufptr, - unsigned int len, bool ascii); - -/* - * Hexdump a buffer to a file. An optional string prefix is added to every= line - */ - -void qemu_hexdump(FILE *fp, const char *prefix, - const void *bufptr, size_t size); - -/* - * helper to parse debug environment variables - */ -int parse_debug_env(const char *name, int max, int initial); - void page_size_init(void); =20 #endif diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index 320543950c..2137e65260 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -214,4 +214,24 @@ static inline const char *yes_no(bool b) return b ? "yes" : "no"; } =20 +/* + * helper to parse debug environment variables + */ +int parse_debug_env(const char *name, int max, int initial); + +/* + * Hexdump a line of a byte buffer into a hexadecimal/ASCII buffer + */ +#define QEMU_HEXDUMP_LINE_BYTES 16 /* Number of bytes to dump */ +#define QEMU_HEXDUMP_LINE_LEN 75 /* Number of characters in line */ +void qemu_hexdump_line(char *line, unsigned int b, const void *bufptr, + unsigned int len, bool ascii); + +/* + * Hexdump a buffer to a file. An optional string prefix is added to every= line + */ + +void qemu_hexdump(FILE *fp, const char *prefix, + const void *bufptr, size_t size); + #endif diff --git a/net/announce.c b/net/announce.c index 3b9e2f1f14..62c60192a3 100644 --- a/net/announce.c +++ b/net/announce.c @@ -7,7 +7,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "net/announce.h" #include "net/net.h" #include "qapi/clone-visitor.h" diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c index 797f832e53..35b1c1f5f6 100644 --- a/tests/qtest/npcm7xx_rng-test.c +++ b/tests/qtest/npcm7xx_rng-test.c @@ -20,7 +20,7 @@ =20 #include "libqtest-single.h" #include "qemu/bitops.h" -#include "qemu-common.h" +#include "qemu/cutils.h" =20 #define RNG_BASE_ADDR 0xf000b000 =20 diff --git a/util/hexdump.c b/util/hexdump.c index 2c105a8846..9921114b3c 100644 --- a/util/hexdump.c +++ b/util/hexdump.c @@ -14,7 +14,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" =20 void qemu_hexdump_line(char *line, unsigned int b, const void *bufptr, unsigned int len, bool ascii) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350152480551.880967002363; Mon, 18 Apr 2022 23:35:52 -0700 (PDT) Received: from localhost ([::1]:57460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghSp-0006LR-9s for importer@patchew.org; Tue, 19 Apr 2022 02:35:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggm2-0001Am-4P for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:39 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:33917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggly-0004RW-P6 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:35 -0400 Received: by mail-wm1-x32d.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so449007wmb.1 for ; Mon, 18 Apr 2022 22:51:31 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hxPhwL6qgxcmhMQ66xzVRzRdrcl35BPxtCNFTsQVnNU=; b=ILHn1ZSZcAvvhMJeIzdjWtRVW2oPqH2DIJpp6+AU7lAOoZDFc2FUdUQs93oiwj0+Kv 2q4EapY6sp4tqsdMmEI++i9IRhQrl/h/Y+YK/5LZiB3Q6+iLpRJe679v9UF7rbsG5y6s M8UtPWMiwa/KQnC5+szJtm3vIsFL2ar0cF438gwVljTI22XGWZbpQ/Dp1D0e40XVpQvY YcN9NIWPHdFl72lFo4FS1zKHd0egBhlp60cZpAZ24QfaxtP6soi/aqz2lR9qR50yInag nc08mYPLl4I3quzg+aI3hHCOmAsYyNxgJZ+XGCGhqGleRFktKbQBEJF7OVs4iHsFZDE+ zGdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hxPhwL6qgxcmhMQ66xzVRzRdrcl35BPxtCNFTsQVnNU=; b=dd7bvYi8Yo2oShJa0NoXY8SmbC5ikOJ7XM8nnRUpnv0css9XIGB32UPSnT7EM998Rb DgZ7pnPUQ8Wgwg2BtMLbmeTRBTuw5CmNTDm90CywKpZdLgVfyLGQrcD+UV1M/ZAVxCFv PHicVh6+EJjv2crwanaDktBHzi7mFApE52tpo4JMYA7g2OcmaswnRe5fh0wWEpLiBcnJ LWGEtcGgZ19kSB8pqgH6X2IIJ46i91l2tQwItJmPDJR+c+v7mv5UKNUjeyxZNAp/8mux thWTO4f//lerdjMY5NsxbxtEXUxObrAIJLDlBlYkFYJcUp4lOMARrZ72SoSdEdM52Kn5 xU4A== X-Gm-Message-State: AOAM532qcSPPs9Wi68gAK1kyRU9XeJeRI/A1i16a4UkxbwJEOk/Elsq9 oeDP4EYaAmEbXajvdU3a0X7lBkkB0Nsqrg== X-Google-Smtp-Source: ABdhPJzHcg4rjAuMF9PSzR2uV4chkyCax2ZkjQAsAiO/S5zEZsRCTXvlXvd6i2mSokRvhOr76thidw== X-Received: by 2002:a05:600c:1584:b0:38e:c80e:b8b5 with SMTP id r4-20020a05600c158400b0038ec80eb8b5mr18098727wmf.99.1650347491030; Mon, 18 Apr 2022 22:51:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 27/53] include: move cpu_exec* declarations to cpu-common.h Date: Tue, 19 Apr 2022 07:50:43 +0200 Message-Id: <20220419055109.142788-28-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350153635100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-23-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/cpu-common.h | 3 +++ include/qemu-common.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 5979fc1f8e..5968551a05 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -19,6 +19,9 @@ typedef uint64_t vaddr; #define VADDR_PRIX PRIX64 #define VADDR_MAX UINT64_MAX =20 +void cpu_exec_init_all(void); +void cpu_exec_step_atomic(CPUState *cpu); + /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even * when intptr_t is 32-bit and we are aligning a long long. */ diff --git a/include/qemu-common.h b/include/qemu-common.h index 08f40a9d1e..ced260d08b 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,9 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -void cpu_exec_init_all(void); -void cpu_exec_step_atomic(CPUState *cpu); - /** * set_preferred_target_page_bits: * @bits: number of bits needed to represent an address within the page --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350362978605.9614511445277; Mon, 18 Apr 2022 23:39:22 -0700 (PDT) Received: from localhost ([::1]:60790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghWD-0000IE-UD for importer@patchew.org; Tue, 19 Apr 2022 02:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmF-0001FA-G8 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggly-0004Rj-Pf for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:51 -0400 Received: by mail-wr1-x434.google.com with SMTP id e21so20911117wrc.8 for ; Mon, 18 Apr 2022 22:51:32 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+i7r/TfTxXm7W7xbct2uv6xQtR/0n9zjhJWiUVcwXM8=; b=U2v73/aUFPUvivjBH7haiWst8CXhIt3zVcfQCEMOsM/3XBwjAVLThYixigZdajgNxf bhnX1MmvVXFG6W52UWqmsQHw8M+wWfCyr6VS12F9w6H4TLsWnks+obFBwuecZ02IvwV4 QCvf5HVNp4L2X4CGIKQuN1p8cpSl4RFVR8M/DsrgiIj3DGHxKD7y1r32UneGM9ga55Oi WhwLNhuHXQnM39EeoHGK+B2xITu5AiL1JjD0xFiipLBfz3VcQ5QRb6kxzBQWIRMy6eJW TK7x9Z9d+9Z5NFI1pETr37PDQyshcipTMPDT/FdIUPwdoUBz+aHz1VlgknJhPb45M7Lh iOxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+i7r/TfTxXm7W7xbct2uv6xQtR/0n9zjhJWiUVcwXM8=; b=CmlZsl20UXT+k/z+k3iv9f3HuHYIWS16uOC0j55VmKPBPgFSXUdAeAh0FqMzETqPwP 0DTDIw92WazantxR8kxPrGZQlXJ86LGFgJIUa9M8nVloz0RU5yYk6Gm4YP0aPtomwbUe V3AqhcXGr/rdj9yv1nSLlbfRi/QIDKtxP12VubKy1+fINkrjJdfD8lTJtP1Nane/0J/J T4MJzZUI0UHeaye+QhtUybnQId1ui1l7wis1/wBL6GqFiIVDYSlEBmqRbnRSZSZXwDFq Ax2XS8PVgPhQuAU+6pH7GAGICnyhSAPFPtvOWl4oVVuaVfFLaltpJX8IPUclmAumWbq7 oXLg== X-Gm-Message-State: AOAM531b0r+bLO+p5yCG0FmREemPq59dOPowcRKcHYQscl9iZy3k5wgj ESFu0UKFqopmNxnKr5XQwww18KVW+ZzVVQ== X-Google-Smtp-Source: ABdhPJwBX3AvDUp6keRGAOcqckgDi+QOPAw7hMEy7qZqmKVsTCB5oV89ceG1thUdLHG1sI/ZRldUMw== X-Received: by 2002:a5d:6487:0:b0:20a:a600:c512 with SMTP id o7-20020a5d6487000000b0020aa600c512mr1476880wri.560.1650347491893; Mon, 18 Apr 2022 22:51:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 28/53] include: move target page bits declaration to page-vary.h Date: Tue, 19 Apr 2022 07:50:44 +0200 Message-Id: <20220419055109.142788-29-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350363804100001 From: Marc-Andr=C3=A9 Lureau Since the implementation unit is page-vary.c. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-24-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/page-vary.h | 18 ++++++++++++++++++ include/qemu-common.h | 17 ----------------- page-vary.c | 2 +- softmmu/physmem.c | 2 +- softmmu/vl.c | 1 + target/arm/cpu.c | 2 +- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/exec/page-vary.h b/include/exec/page-vary.h index c22a7a742e..ebbe9b169b 100644 --- a/include/exec/page-vary.h +++ b/include/exec/page-vary.h @@ -31,4 +31,22 @@ extern bool set_preferred_target_page_bits_common(int bi= ts); extern void finalize_target_page_bits_common(int min); #endif =20 +/** + * set_preferred_target_page_bits: + * @bits: number of bits needed to represent an address within the page + * + * Set the preferred target page size (the actual target page + * size may be smaller than any given CPU's preference). + * Returns true on success, false on failure (which can only happen + * if this is called after the system has already finalized its + * choice of page size and the requested page size is smaller than that). + */ +bool set_preferred_target_page_bits(int bits); + +/** + * finalize_target_page_bits: + * Commit the final value set by set_preferred_target_page_bits. + */ +void finalize_target_page_bits(void); + #endif /* EXEC_PAGE_VARY_H */ diff --git a/include/qemu-common.h b/include/qemu-common.h index ced260d08b..bc73daecb4 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,23 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -/** - * set_preferred_target_page_bits: - * @bits: number of bits needed to represent an address within the page - * - * Set the preferred target page size (the actual target page - * size may be smaller than any given CPU's preference). - * Returns true on success, false on failure (which can only happen - * if this is called after the system has already finalized its - * choice of page size and the requested page size is smaller than that). - */ -bool set_preferred_target_page_bits(int bits); - -/** - * finalize_target_page_bits: - * Commit the final value set by set_preferred_target_page_bits. - */ -void finalize_target_page_bits(void); =20 void qemu_progress_init(int enabled, float min_skip); void qemu_progress_end(void); diff --git a/page-vary.c b/page-vary.c index 057c7f1815..343b4adb95 100644 --- a/page-vary.c +++ b/page-vary.c @@ -20,7 +20,7 @@ #define IN_PAGE_VARY 1 =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "exec/page-vary.h" #include "exec/exec-all.h" =20 bool set_preferred_target_page_bits(int bits) diff --git a/softmmu/physmem.c b/softmmu/physmem.c index cdf0db733e..657841eed0 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -18,7 +18,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "exec/page-vary.h" #include "qapi/error.h" =20 #include "qemu/cutils.h" diff --git a/softmmu/vl.c b/softmmu/vl.c index 6f646531a0..46aba6a039 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -27,6 +27,7 @@ #include "qemu/datadir.h" #include "qemu/units.h" #include "exec/cpu-common.h" +#include "exec/page-vary.h" #include "hw/qdev-properties.h" #include "qapi/compat-policy.h" #include "qapi/error.h" diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0980d33901..3609de0888 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -22,7 +22,7 @@ #include "qemu/qemu-print.h" #include "qemu/timer.h" #include "qemu/log.h" -#include "qemu-common.h" +#include "exec/page-vary.h" #include "target/arm/idau.h" #include "qemu/module.h" #include "qapi/error.h" --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350985069577.1927599961214; Mon, 18 Apr 2022 23:49:45 -0700 (PDT) Received: from localhost ([::1]:41114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghgG-0006Zs-2P for importer@patchew.org; Tue, 19 Apr 2022 02:49:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmF-0001F6-Es for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:35651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggly-0004Rl-PW for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:51 -0400 Received: by mail-wr1-x436.google.com with SMTP id k22so20924349wrd.2 for ; Mon, 18 Apr 2022 22:51:33 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hXRtQ2q38QfPSpgZNZm47aH6FCiJbFi6LLcyuNfmZqM=; b=OC+oEfnLLjQCWnW3AguBrtfw3IrCKyJUfqWGmlKDSBGMFGQ8RHWvwN0POOlPEU+RN4 uROpW6OBmTTzSQVNMVWNr0aP0TZzDriH+nd5VDnX7tBtcgu5wCV6TCT9R5XYP4Cz5KXh wDJKjVjoPLt7+NieWM4LOHtKJKDFOjo8CX4PnDAawG1Q1SbwRVb+nrONwiblBwae9ovy ra204WceQA9/W58LsEc1bayg7px4Z0wDxslPfVoDJMzxPuFIPr2KOHFPQcDHY/oWVI1E t9zp3uQARK7tatd20/iKJHNj5FUiFx0hrWk8hk3oK0cTA9g2duxbynT1s20cAX2bZD2h eTtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hXRtQ2q38QfPSpgZNZm47aH6FCiJbFi6LLcyuNfmZqM=; b=aEpRymX/I0idUKaM86/arslaYCjr6vmahFFehGPsmvxoi+KJr2dx5eh6cHXg3oZi3m Lefs3mH28j7syU51piVheBbIKWJCOdqq9wOiF/+oMPs68+cpjj02FQRwVOFvvj5eZWKp C79w6UQNpRWuYtnFL6UQENI2zxhEwf3X4Od76CgYbn3Ua0x0GxNjTJkVKyFtVxwWkxtA s6KmZuNDosEKmbJ4ZsWU4TbzkTYSV4A9nP21GHxLHxAjT1nYundtIJWg+2SshlcZKt7R spMtYQR1ZV8I8lYXprcwMRB81byEHRR1GeOt968gnsc0TNH33gO1QqIKEjc6KROZ7Sz0 g6Wg== X-Gm-Message-State: AOAM531AQExgICh9Dhz9LtW+zUT3dHOUVdvavgg0OSLQbr5BW+YV6sF/ A5bMpXtSUH4/A6r3S1eI3NLhsK0IjJ83lg== X-Google-Smtp-Source: ABdhPJyA3GEL72PjdmBdnXb/PaCXgkUKK+ACB5Zjc+ygFCgTxrs/a0OGd+q5z8oTObmqu1lapBiHNA== X-Received: by 2002:a05:6000:2c8:b0:20a:9587:76c1 with SMTP id o8-20020a05600002c800b0020a958776c1mr6205431wry.335.1650347492438; Mon, 18 Apr 2022 22:51:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 29/53] include: move progress API to qemu-progress.h Date: Tue, 19 Apr 2022 07:50:45 +0200 Message-Id: <20220419055109.142788-30-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::436; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350987153100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-25-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 4 ---- include/qemu/qemu-progress.h | 8 ++++++++ qemu-img.c | 1 + util/qemu-progress.c | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 include/qemu/qemu-progress.h diff --git a/include/qemu-common.h b/include/qemu-common.h index bc73daecb4..fee2181af2 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,10 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 - -void qemu_progress_init(int enabled, float min_skip); -void qemu_progress_end(void); -void qemu_progress_print(float delta, int max); const char *qemu_get_vm_name(void); =20 /* OS specific functions */ diff --git a/include/qemu/qemu-progress.h b/include/qemu/qemu-progress.h new file mode 100644 index 0000000000..137e1c316f --- /dev/null +++ b/include/qemu/qemu-progress.h @@ -0,0 +1,8 @@ +#ifndef QEMU_PROGRESS_H +#define QEMU_PROGRESS_H + +void qemu_progress_init(int enabled, float min_skip); +void qemu_progress_end(void); +void qemu_progress_print(float delta, int max); + +#endif /* QEMU_PROGRESS_H */ diff --git a/qemu-img.c b/qemu-img.c index cf63db7655..116e058675 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -26,6 +26,7 @@ #include =20 #include "qemu-common.h" +#include "qemu/qemu-progress.h" #include "qemu-version.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" diff --git a/util/qemu-progress.c b/util/qemu-progress.c index 20d51f8c12..aa994668f1 100644 --- a/util/qemu-progress.c +++ b/util/qemu-progress.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/qemu-progress.h" =20 struct progress_state { float current; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352614662839.14594559564; Tue, 19 Apr 2022 00:16:54 -0700 (PDT) Received: from localhost ([::1]:44696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngi6W-0003lv-R4 for importer@patchew.org; Tue, 19 Apr 2022 03:16:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmF-0001FB-H0 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:35713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggly-0004Rs-PX for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:51 -0400 Received: by mail-wm1-x32b.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso809236wma.0 for ; Mon, 18 Apr 2022 22:51:34 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cwsg4VyYoYNXnwQej3aaj/VEd3qtRkQw8m6My/RvkUk=; b=f7EPt9z3W54Pk3V3UJg+UCxnhyS79WKyLCkUPLr+rOtZkKkERrtd1pTaZ07x5bZwQR WXKrkvWSMWpwIZeYdDwOH3/viXkOkNGpnD3DZrGP26KocVHBezy7lLMcDIduxmT67oa3 H+GYU7JcJGspH6W0xCCtKLoHRGphisw8vu/FPZJNdKn8I26IhlFK7Rds/CbhrgvGy+q4 O5xVGAculAO88nxP/sXHLNfNBnuJRT4UQojntJz5q4sKP38hnPXEAbDmWBZZvdICUHhN kHWlvkjhRVqsu3BZLoCJj+k7zc7qcxTK3csjmXNSItsgCtUAhLqfY0aPXRDZ9ROtZ0mL a1zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cwsg4VyYoYNXnwQej3aaj/VEd3qtRkQw8m6My/RvkUk=; b=sGW1pXhIcZ5HqUYGyK3/X0zurDk2KWePe3K2YAtRCqA1H5yx0fL1EIprC0t4AHTW7R /3rwb8kOhDnjWX0MwEH/m9AfSjlpwv+Vgf4QG8DMTkJSuQBVhYDbNd+RM2Q6q/4b24YN xJ5zdYXh1z6W1U93r993k+3eE7YBbfJFn//6X2cv+2XL0B7TDN/hdgA2Frqr+JEr4ElN 5RykiXZmQg6k4nfn3eDi3UBstzzUsVfs3FYD+10j/Nl/MriHjzCpNpDTeY3tB500cBNl xvoN2URJTPfiy3lszPs7kq3T/nfq6lQFIUkqoMyAqU0LhlpAtURIfGSSOmZPeCgyD00f hhZw== X-Gm-Message-State: AOAM531RyBeWrrJucOhvAmT2Bu/asrvkPEPk1NbOnvXdLlvC7SnN9Xaq YovFWWk2G06eobLDVRHFAmRHA5MGRqGBQA== X-Google-Smtp-Source: ABdhPJzW9qVHaHehIU8njxM3R54Yn4L/d4kPlcEse9VtHiKRyv1zgsHNFkmMJB4R211a3Z0ARdoWwA== X-Received: by 2002:a1c:f211:0:b0:381:6c60:742f with SMTP id s17-20020a1cf211000000b003816c60742fmr14818388wmc.130.1650347493183; Mon, 18 Apr 2022 22:51:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 30/53] include: move qemu_get_vm_name() to sysemu.h Date: Tue, 19 Apr 2022 07:50:46 +0200 Message-Id: <20220419055109.142788-31-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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=paolo.bonzini@gmail.com; helo=mail-wm1-x32b.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352615997100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-26-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- audio/audio.c | 2 +- block/iscsi.c | 2 +- include/qemu-common.h | 2 -- include/sysemu/sysemu.h | 2 ++ stubs/get-vm-name.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 1c98964eb8..9e91a5a4f2 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -32,7 +32,7 @@ #include "qapi/qapi-visit-audio.h" #include "qemu/cutils.h" #include "qemu/module.h" -#include "qemu-common.h" +#include "sysemu/sysemu.h" #include "sysemu/replay.h" #include "sysemu/runstate.h" #include "ui/qemu-spice.h" diff --git a/block/iscsi.c b/block/iscsi.c index 51f2a5eeaa..d707d0b354 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -28,7 +28,7 @@ #include #include #include -#include "qemu-common.h" +#include "sysemu/sysemu.h" #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qemu/bitops.h" diff --git a/include/qemu-common.h b/include/qemu-common.h index fee2181af2..1fbc20e4bc 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,8 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -const char *qemu_get_vm_name(void); - /* OS specific functions */ void os_setup_early_signal_handling(void); int os_parse_cmd_args(int index, const char *optarg); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index b9421e03ff..10e283c170 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -13,6 +13,8 @@ extern const char *qemu_name; extern QemuUUID qemu_uuid; extern bool qemu_uuid_set; =20 +const char *qemu_get_vm_name(void); + void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); =20 diff --git a/stubs/get-vm-name.c b/stubs/get-vm-name.c index fa990136b0..0906303f73 100644 --- a/stubs/get-vm-name.c +++ b/stubs/get-vm-name.c @@ -1,5 +1,5 @@ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "sysemu/sysemu.h" =20 const char *qemu_get_vm_name(void) { --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351683832349.5803433100758; Tue, 19 Apr 2022 00:01:23 -0700 (PDT) Received: from localhost ([::1]:56264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghrT-0000Gb-OU for importer@patchew.org; Tue, 19 Apr 2022 03:01:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggm5-0001Bk-J4 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:47 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:44971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggm1-0004Rx-Qb for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:41 -0400 Received: by mail-wr1-x431.google.com with SMTP id b19so20893521wrh.11 for ; Mon, 18 Apr 2022 22:51:35 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tl9QZYAXBfOO9wSADBXfX+4Z4VSezO7/iMstqBw8M9c=; b=BTm0GJ2uXwm6G/pu6EDAWPm4AtcUG9Xv4pgKgzkgZ3joBd90jdtJC8ki+gMWipaIOJ EaHzBV5snouiFr6PhohgDHX2Ptgyp3mtv7qzQRx5jRakaMaYCK91FqDM6hvcUbS8aho8 b2Q6DTXrUACSi38wGLBO8sSq9ZEweLeIHm478qNUG8z4xNFx9/JhNy7cb+oBnrZd9Pzb +amWZzCFPsMHMt8Ci80Z+8ktR72Icn9NHVPUkKqHChiI72a4Mg0UL5d8Z4U4Dxs7IJzi 0zzerRmeccmDpdYFvgOKY//+K1r6fSVy7lCl3Uh1GTq7svDa/LT24ijfXhTPlm7GHSgr lDtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Tl9QZYAXBfOO9wSADBXfX+4Z4VSezO7/iMstqBw8M9c=; b=HyXMDMoGBqgxpQMWbccjgOnRpvmeN88SmSW8P8QY7gvCwsbROSMp8S88ktBZv0LyR1 9LxSXhloocKfbwkJRAlPX1MtvC1P4e8pjl5q/imrLbSK+T99iANHw+WQ1ftduvJOGiUl AmCVjPjkWqeYaP/2p/71rEJciPM+/cATruCmiE7D2WSSZpAjLw/z3YD/yeILOPZEbvVR 7uF31lFO8iie5We0LMjo1G6qBeRd2Odbla1DQTDNuyNC6P4txVTeK9sQhR49jW/GSvnd BEW26pOYPEHzmlUgUawR5WZgpVmbn0lOAb2QuWNvI24mnvgqyYI0l2FbBBKvvqSVvSUX DACA== X-Gm-Message-State: AOAM5312YkkSDF23AerDfFWzZY2sZ/j6zJJ5AFA/SzB7dqN8vmImLbqE EVjTaNmm16xJVKbqNWQH/bbvBtoSFZstMA== X-Google-Smtp-Source: ABdhPJzM80Vh1rEq5OspL8muq8b9CI8Y3Vv3LCHCqqIrQUTIXUD5q2mGknevPhcqPn7MSjjkef0dLQ== X-Received: by 2002:adf:e189:0:b0:207:a0e8:be49 with SMTP id az9-20020adfe189000000b00207a0e8be49mr10463261wrb.130.1650347494091; Mon, 18 Apr 2022 22:51:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 31/53] include: move os_*() to os-foo.h Date: Tue, 19 Apr 2022 07:50:47 +0200 Message-Id: <20220419055109.142788-32-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::431; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x431.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351684362100001 From: Marc-Andr=C3=A9 Lureau For consistency with other os_ functions that do not have POSIX implementation, declare an inline function for the stub in os-win32.h. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-27-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 4 ---- include/sysemu/os-posix.h | 2 ++ include/sysemu/os-win32.h | 4 +++- os-win32.c | 9 --------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 1fbc20e4bc..a271cac66a 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,10 +24,6 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -/* OS specific functions */ -void os_setup_early_signal_handling(void); -int os_parse_cmd_args(int index, const char *optarg); - void page_size_init(void); =20 #endif diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 23bd45457d..58de7c994d 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -42,7 +42,9 @@ extern "C" { #endif =20 +int os_parse_cmd_args(int index, const char *optarg); void os_set_line_buffering(void); +void os_setup_early_signal_handling(void); void os_set_proc_name(const char *s); void os_setup_signal_handling(void); void os_daemonize(void); diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index 1351d1d29e..3c74a78e33 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -62,8 +62,10 @@ struct tm *localtime_r(const time_t *timep, struct tm *r= esult); static inline void os_setup_signal_handling(void) {} static inline void os_daemonize(void) {} static inline void os_setup_post(void) {} -void os_set_line_buffering(void); static inline void os_set_proc_name(const char *dummy) {} +static inline int os_parse_cmd_args(int index, const char *optarg) { retur= n -1; } +void os_set_line_buffering(void); +void os_setup_early_signal_handling(void); =20 int getpagesize(void); =20 diff --git a/os-win32.c b/os-win32.c index e31c921983..6f21b57841 100644 --- a/os-win32.c +++ b/os-win32.c @@ -61,12 +61,3 @@ void os_set_line_buffering(void) setbuf(stdout, NULL); setbuf(stderr, NULL); } - -/* - * Parse OS specific command line options. - * return 0 if option handled, -1 otherwise - */ -int os_parse_cmd_args(int index, const char *optarg) -{ - return -1; -} --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350755102598.1288311048543; Mon, 18 Apr 2022 23:45:55 -0700 (PDT) Received: from localhost ([::1]:38616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghcX-0004g7-SN for importer@patchew.org; Tue, 19 Apr 2022 02:45:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggm3-0001BN-Ig for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:46 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:35716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggm1-0004SF-Eu for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:38 -0400 Received: by mail-wm1-x32e.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso809271wma.0 for ; Mon, 18 Apr 2022 22:51:35 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TvxQtTWLzyHP2NIr5QzKllEiV4ajbHEFOoL4RvQX0FA=; b=HVRtozMOBZPROVwcJdlzjl62dxzIdHSBTzS0UBHX5N5OsWme+oHkRtUcOgN49o2HVm l/XyPt39uIbkljfhUbP9+8cMWhI40uOI4rUwCbWgbJZ0o8iDYlqwMIHgoG4AlkALvR2g Rn2CodZP8RoemKM87iC0/LxlpqyJ/rhJxQNRmWe+4ny2kIXtiSQ38upa+G2KN41y+EhG 9Lp2S7aieKSd4dMZu7TF9vei5uXorg9Q/Pkt8YNZKF9ZWv1zxxJWXzUOgvgamefCQgzX UKlWgwkOSN7bX91FZ46PNVixr1vReXiGX6CuRQfOmbh0SkivpUJjzcJSM8EaEWYSS2LT dyfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TvxQtTWLzyHP2NIr5QzKllEiV4ajbHEFOoL4RvQX0FA=; b=gR9RSxVoYSKWCwqHC8hMAWXH52OHjuwA1BYulX67jGU9tl55TpzFVYjzPmGYlQnZZp QQqxH3V1YaR+99jT8/gyOXumHQWuWnFd766LTDg9KkVUH50JnjM+52UkTPsFeiEV7p3q eLB7MosRAGAQBo0r7qQlk/YjmrO6ThR/xQ6wYa5+6J7nitNw2F0YfS5rO/iCwaQdFVY5 NQeF9sRV+U107dKL0M382JZTGltJ9tEQC8yAdzRR/XzECK2vqG+4WbLJ97MynyNe8pBi hVQDA2qV3amY4JJCcDiAQ8GzKw5MXCFQabLK+dUClm9pX2/vQ+iLYsIjvsS0xxu81Zd3 v6bw== X-Gm-Message-State: AOAM531NNaNFc6N49MTehZLU7852VbgPov3eWoEVYj54LqL7pMl0spox rZwdlR/DbZJG3r4HnC3U1ivsrS5mZ6OATw== X-Google-Smtp-Source: ABdhPJwXgHfSU7RoesSH8IJtyPzfljfGTDZWylvK4v1kM0O43W5sryIM53hdCaqRdXfpWxTjEKJ1eA== X-Received: by 2002:a05:600c:1910:b0:392:9143:27d3 with SMTP id j16-20020a05600c191000b00392914327d3mr10577486wmq.206.1650347495004; Mon, 18 Apr 2022 22:51:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 32/53] include: move page_size_init() to include/hw/core/cpu.h Date: Tue, 19 Apr 2022 07:50:48 +0200 Message-Id: <20220419055109.142788-33-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32e; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350757685100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-28-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/hw/core/cpu.h | 2 ++ include/qemu-common.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 13adb251b2..466bed6047 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1035,6 +1035,8 @@ void cpu_exec_unrealizefn(CPUState *cpu); */ bool target_words_bigendian(void); =20 +void page_size_init(void); + #ifdef NEED_CPU_H =20 #ifdef CONFIG_SOFTMMU diff --git a/include/qemu-common.h b/include/qemu-common.h index a271cac66a..65483f70d4 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -24,6 +24,4 @@ int qemu_main(int argc, char **argv, char **envp); #endif =20 -void page_size_init(void); - #endif --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352215445342.3946563688155; Tue, 19 Apr 2022 00:10:15 -0700 (PDT) Received: from localhost ([::1]:36728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngi06-0006e8-CV for importer@patchew.org; Tue, 19 Apr 2022 03:10:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggm6-0001Bn-70 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:49 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:51905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggm3-0004SO-GI for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:41 -0400 Received: by mail-wm1-x32a.google.com with SMTP id q20so9939184wmq.1 for ; Mon, 18 Apr 2022 22:51:37 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Maj9x9vK/TMpGaFGhZ6yBeM1OJoIqE8ObWE/BKs+2Pw=; b=L2BdsWM0wC3LB/zXAAkjKb+OEvOMp6iSgCve+FTIB6z/XO8dgh41d/gyoIl11j9K+5 s9TaoU5DydWM9WuP/OefF+NK8651R6I5LmBf+tlJx/WVzUnvcpHYvx6wVKg40n6OQIKp YQSXYGoIbyUbpA1dHHS6VrLELCKchhNHM0TppF/AVLrKJfHFKV8WGKfwpPvyCw+ZLCi2 O8lSAzeoJljS/LZKzbNsk7SMAA8EOb7Lg8nLl+/K+ThDZWT3IasPQQq3j+Itu7JrIWDW v7jP+5JWe/LSiSvDFvCeC6HEGLoQ8TLtrlzia60ZvlCGhQoKGWjHFxoqRn69Fl0lK9F+ YKHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Maj9x9vK/TMpGaFGhZ6yBeM1OJoIqE8ObWE/BKs+2Pw=; b=zd/+9g7BlGDvddq1rGdwIv1kC84JfNrF3BpepJdP0Gx+5T9q1giLaT7H5xyiY8FNKx nqCS0Kjsevy3nXyY7mqf0cFqmyP59qR0xH9UJE30HuZ3gZoGTQ2ynZnXrTasusDuHHIy WE6yujT2hNcEzceVUAf+Zto5wSr7lQY8OVekbF8Etx6It42PV0mTBaL6NubOkUciyj+j p/4+qykBABKm40n3zI3+2ZpZjQIe8LnEdlOPa1valM5rE8ybSNTGC9AgjxPw3iGm5Yev p85pmRi3fM75DE2BwsX9fTLr1hcBjS9lmKGruNEBdc+hFNgapHtxTj1XtHwUEIOFVqpe zTPg== X-Gm-Message-State: AOAM533JPROVl4QI3lrmvQgRTStVV9ft+NQ8/+ZJuewiOQvu7WlOcqjw 0/tUkueA+2dSsspX9IXsHSxHVX6rfvIs0A== X-Google-Smtp-Source: ABdhPJzr8SdyI6AoJM/a9mJBYuJBWH8jMAIFclpXCPfR3FzMCUlHDsCP/AgY9jEWU9gjJq0ojgfINQ== X-Received: by 2002:a1c:f605:0:b0:37b:b5de:89a0 with SMTP id w5-20020a1cf605000000b0037bb5de89a0mr14047279wmc.88.1650347496004; Mon, 18 Apr 2022 22:51:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 33/53] Move CPU softfloat unions to cpu-float.h Date: Tue, 19 Apr 2022 07:50:49 +0200 Message-Id: <20220419055109.142788-34-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32a; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352217300100001 From: Marc-Andr=C3=A9 Lureau The types are no longer used in bswap.h since commit f930224fffe ("bswap.h: Remove unused float-access functions"), there isn't much sense in keeping it there and having a dependency on fpu/. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-29-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/bswap.h | 60 ------------------------------------ include/qemu/cpu-float.h | 64 +++++++++++++++++++++++++++++++++++++++ migration/vmstate-types.c | 1 + target/alpha/cpu.h | 1 + target/arm/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 2 +- target/openrisc/cpu.h | 1 + target/ppc/cpu.h | 1 + target/riscv/cpu.h | 2 +- target/rx/cpu.h | 1 + target/s390x/cpu.h | 1 + target/sh4/cpu.h | 1 + target/sparc/cpu.h | 1 + target/tricore/cpu.h | 1 + target/xtensa/cpu.h | 1 + 18 files changed, 80 insertions(+), 62 deletions(-) create mode 100644 include/qemu/cpu-float.h diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 9dff7c7dbb..346d05f2aa 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -19,8 +19,6 @@ extern "C" { #endif =20 -#include "fpu/softfloat-types.h" - #ifdef BSWAP_FROM_BYTESWAP static inline uint16_t bswap16(uint16_t x) { @@ -202,64 +200,6 @@ CPU_CONVERT(le, 64, uint64_t) # define const_le16(_x) (_x) #endif =20 -/* Unions for reinterpreting between floats and integers. */ - -typedef union { - float32 f; - uint32_t l; -} CPU_FloatU; - -typedef union { - float64 d; -#if HOST_BIG_ENDIAN - struct { - uint32_t upper; - uint32_t lower; - } l; -#else - struct { - uint32_t lower; - uint32_t upper; - } l; -#endif - uint64_t ll; -} CPU_DoubleU; - -typedef union { - floatx80 d; - struct { - uint64_t lower; - uint16_t upper; - } l; -} CPU_LDoubleU; - -typedef union { - float128 q; -#if HOST_BIG_ENDIAN - struct { - uint32_t upmost; - uint32_t upper; - uint32_t lower; - uint32_t lowest; - } l; - struct { - uint64_t upper; - uint64_t lower; - } ll; -#else - struct { - uint32_t lowest; - uint32_t lower; - uint32_t upper; - uint32_t upmost; - } l; - struct { - uint64_t lower; - uint64_t upper; - } ll; -#endif -} CPU_QuadU; - /* unaligned/endian-independent pointer access */ =20 /* diff --git a/include/qemu/cpu-float.h b/include/qemu/cpu-float.h new file mode 100644 index 0000000000..911099499f --- /dev/null +++ b/include/qemu/cpu-float.h @@ -0,0 +1,64 @@ +#ifndef QEMU_CPU_FLOAT_H_ +#define QEMU_CPU_FLOAT_H_ + +#include "fpu/softfloat-types.h" + +/* Unions for reinterpreting between floats and integers. */ + +typedef union { + float32 f; + uint32_t l; +} CPU_FloatU; + +typedef union { + float64 d; +#if HOST_BIG_ENDIAN + struct { + uint32_t upper; + uint32_t lower; + } l; +#else + struct { + uint32_t lower; + uint32_t upper; + } l; +#endif + uint64_t ll; +} CPU_DoubleU; + +typedef union { + floatx80 d; + struct { + uint64_t lower; + uint16_t upper; + } l; +} CPU_LDoubleU; + +typedef union { + float128 q; +#if HOST_BIG_ENDIAN + struct { + uint32_t upmost; + uint32_t upper; + uint32_t lower; + uint32_t lowest; + } l; + struct { + uint64_t upper; + uint64_t lower; + } ll; +#else + struct { + uint32_t lowest; + uint32_t lower; + uint32_t upper; + uint32_t upmost; + } l; + struct { + uint64_t lower; + uint64_t upper; + } ll; +#endif +} CPU_QuadU; + +#endif /* QEMU_CPU_FLOAT_H_ */ diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index bf4d440308..e83bfccb9e 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cpu-float.h" #include "qemu-file.h" #include "migration.h" #include "migration/vmstate.h" diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index 58f00b7814..994a018b91 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -22,6 +22,7 @@ =20 #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 /* Alpha processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ccf635ac5c..cb5359a747 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -21,6 +21,7 @@ #define ARM_CPU_H =20 #include "kvm-consts.h" +#include "qemu/cpu-float.h" #include "hw/registerfields.h" #include "cpu-qom.h" #include "exec/cpu-defs.h" diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 4cc936b6bf..c43b93a68f 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -22,6 +22,7 @@ =20 #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 /* PA-RISC 1.x processors have a strong memory model. */ /* ??? While we do not yet implement PA-RISC 2.0, those processors have diff --git a/target/i386/cpu.h b/target/i386/cpu.h index ccf627d2c5..8422f6c18e 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -25,6 +25,7 @@ #include "kvm/hyperv-proto.h" #include "exec/cpu-defs.h" #include "qapi/qapi-types-common.h" +#include "qemu/cpu-float.h" =20 /* The x86 has a strong memory model with some store-after-load re-orderin= g */ #define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 872e8ce637..9b3bf7a448 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -22,6 +22,7 @@ #define M68K_CPU_H =20 #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" #include "cpu-qom.h" =20 #define OS_BYTE 0 diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 0a0ce71b6a..67aa88b8db 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -22,7 +22,7 @@ =20 #include "cpu-qom.h" #include "exec/cpu-defs.h" -#include "fpu/softfloat-types.h" +#include "qemu/cpu-float.h" =20 typedef struct CPUArchState CPUMBState; #if !defined(CONFIG_USER_ONLY) diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index bdf29d2dc4..b9584f10d4 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -21,6 +21,7 @@ #define OPENRISC_CPU_H =20 #include "exec/cpu-defs.h" +#include "fpu/softfloat-types.h" #include "hw/core/cpu.h" #include "qom/object.h" =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 627e574127..473436a49e 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -21,6 +21,7 @@ #define PPC_CPU_H =20 #include "qemu/int128.h" +#include "qemu/cpu-float.h" #include "exec/cpu-defs.h" #include "cpu-qom.h" #include "qom/object.h" diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index c069fe85fa..e1d976bdef 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -23,7 +23,7 @@ #include "hw/core/cpu.h" #include "hw/registerfields.h" #include "exec/cpu-defs.h" -#include "fpu/softfloat-types.h" +#include "qemu/cpu-float.h" #include "qom/object.h" #include "qemu/int128.h" #include "cpu_bits.h" diff --git a/target/rx/cpu.h b/target/rx/cpu.h index b4abd90ccd..1c267f83bf 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -24,6 +24,7 @@ #include "cpu-qom.h" =20 #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 /* PSW define */ REG32(PSW, 0) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index c49c8466e7..7d6d01325b 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -28,6 +28,7 @@ #include "cpu-qom.h" #include "cpu_models.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 #define ELF_MACHINE_UNAME "S390X" =20 diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index c72a30edfd..14d490ac47 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -22,6 +22,7 @@ =20 #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 /* CPU Subtypes */ #define SH_CPU_SH7750 (1 << 0) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index abb38db674..dd9e2f5cdb 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -4,6 +4,7 @@ #include "qemu/bswap.h" #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" =20 #if !defined(TARGET_SPARC64) #define TARGET_DPREGS 16 diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index 108d6b8288..3b9c533a7c 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -22,6 +22,7 @@ =20 #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "qemu/cpu-float.h" #include "tricore-defs.h" =20 struct tricore_boot_info; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index f10cfabdc3..71142ea8f4 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -29,6 +29,7 @@ #define XTENSA_CPU_H =20 #include "cpu-qom.h" +#include "qemu/cpu-float.h" #include "exec/cpu-defs.h" #include "xtensa-isa.h" =20 --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351236737899.5194559531576; Mon, 18 Apr 2022 23:53:56 -0700 (PDT) Received: from localhost ([::1]:47088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghkJ-0002Ll-Ce for importer@patchew.org; Tue, 19 Apr 2022 02:53:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmB-0001D3-3a for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:49 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:43718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggm5-0004Sl-8j for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:43 -0400 Received: by mail-wm1-x32d.google.com with SMTP id n40-20020a05600c3ba800b0038ff1939b16so758651wms.2 for ; Mon, 18 Apr 2022 22:51:40 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LGTworkvhjNi4sRrBmXWX8Is+INO2oUvDU7KNrsBYxk=; b=pv3ayNRtdwobtHFMu40v5n2wGQMjtorWlOVw8+uyYY6KwimGdyln33k+N6DYDxU6MY F0KFLwVjmZFHppdGdsSM/F3JFQma2pM7+phtAkwKHmqJ4kwX15KZtgJVksDfeB+2mjnu JKlqAQi0jcbgtwzAi4Bc2yQYKkxjymvTFC5p50IQT27SEmjVnhMp6F4xMyP7/ALoztfH R7Ym1R1CsXMREfBxGpmlmFQ//BdSXtXlyu7jWgFj+CfSHmw4t7ZGNNhcMB9FNikpHmZc xqcLmGjEKtf8ZxNuQy6UcIqYpwM68XT3lfw9hgqZ3pZi/B+yV+gs5nahrbFpBboWAbTY 41Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LGTworkvhjNi4sRrBmXWX8Is+INO2oUvDU7KNrsBYxk=; b=faF+GPBy8V46AojuriQOFKg6eyJNOGNb2CHzQJiQKtBhK9zHqnYDDS6NklByD6g+pu YH2RyJt8OxPp/EKvXVnhzSXF7JIGW5Exxt2XnWSowkDXQ1dpePXrzt8gaCF8PVGqUbzj 1ktZNmYvXG4DIZ47vvVd3Isdf7/9A3cBpPAgEhG80Z4+UA/9RD2jfvI1KKqoaNw1QfKF C7TswfqtzOLMCThpsEL6xNXdHD2i4X5H9FXICD2zlHZUUEpLKVTYn86jwM0G91Q3hpKo w2iqHQ0A1cazv6u9S/keqaJ1vXZXm8hDh6e/i9/lyHZ7uNYG/6vkDlJ5g1OnHZXdttXQ yydw== X-Gm-Message-State: AOAM530GxqL88Mmx46w++uP1rwaaFz9tv6r/I/HAIScwFUHeEbZqAmQ7 DO77SAoJBSVYzy7CEIajNQyXx/+YK4r4ow== X-Google-Smtp-Source: ABdhPJx0hmH11maMZ23XkRdWADyXd5HwJ0OyK/jEEnvd2S3doaIFaJuupvDISIqu3bRMhsJxk60X8A== X-Received: by 2002:a1c:2942:0:b0:392:3aff:4fcd with SMTP id p63-20020a1c2942000000b003923aff4fcdmr14190457wmp.0.1650347498922; Mon, 18 Apr 2022 22:51:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 34/53] Move fcntl_setfl() to oslib-posix Date: Tue, 19 Apr 2022 07:50:50 +0200 Message-Id: <20220419055109.142788-35-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351238351100001 From: Marc-Andr=C3=A9 Lureau It is only implemented for POSIX anyway. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-30-marcandre.lureau@redhat.com> [Add braces around if statements. - Paolo] Signed-off-by: Paolo Bonzini --- include/qemu/cutils.h | 1 - include/sysemu/os-posix.h | 2 ++ util/cutils.c | 17 ----------------- util/oslib-posix.c | 15 +++++++++++++++ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index 2137e65260..e873bad366 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -131,7 +131,6 @@ const char *qemu_strchrnul(const char *s, int c); time_t mktimegm(struct tm *tm); int qemu_fdatasync(int fd); int qemu_msync(void *addr, size_t length, int fd); -int fcntl_setfl(int fd, int flag); int qemu_parse_fd(const char *param); int qemu_strtoi(const char *nptr, const char **endptr, int base, int *result); diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 58de7c994d..adbe19d3e4 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -96,6 +96,8 @@ static inline void qemu_funlockfile(FILE *f) funlockfile(f); } =20 +int fcntl_setfl(int fd, int flag); + #ifdef __cplusplus } #endif diff --git a/util/cutils.c b/util/cutils.c index 1173ce3b88..aaf2ced291 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -199,23 +199,6 @@ int qemu_msync(void *addr, size_t length, int fd) #endif /* CONFIG_POSIX */ } =20 -#ifndef _WIN32 -/* Sets a specific flag */ -int fcntl_setfl(int fd, int flag) -{ - int flags; - - flags =3D fcntl(fd, F_GETFL); - if (flags =3D=3D -1) - return -errno; - - if (fcntl(fd, F_SETFL, flags | flag) =3D=3D -1) - return -errno; - - return 0; -} -#endif - static int64_t suffix_mul(char suffix, int64_t unit) { switch (qemu_toupper(suffix)) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 577c855612..a069dbff69 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -936,3 +936,18 @@ size_t qemu_get_host_physmem(void) #endif return 0; } + +/* Sets a specific flag */ +int fcntl_setfl(int fd, int flag) +{ + int flags; + + flags =3D fcntl(fd, F_GETFL); + if (flags =3D=3D -1) { + return -errno; + } + if (fcntl(fd, F_SETFL, flags | flag) =3D=3D -1) { + return -errno; + } + return 0; +} --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352668142556.4516136425568; Tue, 19 Apr 2022 00:17:48 -0700 (PDT) Received: from localhost ([::1]:45380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngi7O-0004KE-Io for importer@patchew.org; Tue, 19 Apr 2022 03:17:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmB-0001D2-2r for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:49 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:51910) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggm5-0004Sn-9B for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:46 -0400 Received: by mail-wm1-x32f.google.com with SMTP id q20so9939251wmq.1 for ; Mon, 18 Apr 2022 22:51:40 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p4zJu+UCpzjbdE0k96aL3nBQu8Ujaw7AsMU86QsOaBE=; b=cvu7fi42YypuN327McoH/C82tdQIPp3lDSJ7G72DqGDKNuh9i2InPT2B83QjLsYzI/ gC3u+Dj1y9enMjD9TZnMFr9B3a3Y1MTJ+7mLiqd0W8u/F2VXSCcohj4Y1amLx09nvdfi j7ftY8M9/LQRkzedA0VgdNsw7wwqXfCa436ZYyUTNgl3k2pKxc1w60B+phietl2cqDXM ZxMpLmfvGLBmr0dW2STSKjtLg7rz6sgFq/zwlgsZytlf8IpRswXGkjpNX2bEnLhYEAhx RGvUum+eySXxA7b3ZrmNP58NCaNWMIHdQ1SKO4gMDV6SbSQO3HFhliLtlz72RbE9Ipry wAcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=p4zJu+UCpzjbdE0k96aL3nBQu8Ujaw7AsMU86QsOaBE=; b=R90VVHGs8DoT6vGQLnnmt35HiaMI8jZYp7YJYZ0Uv4g9y//19QiyU0WYfVRFhh54wA B19G0UJEUKTpnD7qFiVkYG42w89bO1439qy1QxGT8rqCBoy8/5Gyquy5FWTizUIze9P6 h2bwkSzymtxHsZLH97rWe5Xha1dv3WCekoy/jXwvYdHgTHg+uOsVIQTzxbrEz/mwI+Ia w+6Hn0i8ORt4rqw0spf4uqiwb5swcBB8KqW9Vz0fGIRqEK2jh6pTLfpWMzGct/ktooXM lj/VpF1ttitK82GozQ4eTcgM/gNw4Zac4Xu8RgObqaErO3eW6kYjhTLTJn9x3Yuk1rDX S+QQ== X-Gm-Message-State: AOAM531+Snr6L0CFGLVctCA1JDjBealTHmKnoob3v79awWMbHlQTGi63 eVyw/cO0uF9YVNwzEixfEy6qgHLOEFtw1w== X-Google-Smtp-Source: ABdhPJwh/DsoHAfYGBKTF+Iu7cunwXDo3AaO0658x5XI8dSV0rZHxJMkMmFR0Qf5/25oQ3YZkFDqJg== X-Received: by 2002:a7b:cb0d:0:b0:38e:aaf3:b08f with SMTP id u13-20020a7bcb0d000000b0038eaaf3b08fmr18665382wmj.12.1650347499589; Mon, 18 Apr 2022 22:51:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 35/53] qga: remove explicit environ argument from exec/spawn Date: Tue, 19 Apr 2022 07:50:51 +0200 Message-Id: <20220419055109.142788-36-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352669334100001 From: Marc-Andr=C3=A9 Lureau Environment is implicitly inherited from the current process "environ" variable for execl() or g_spawn_sync(), no need to be explicit about it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-31-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 2 -- qga/commands-posix.c | 24 +++++++----------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index 08f8183a66..a0b6de255c 100644 --- a/meson.build +++ b/meson.build @@ -1654,8 +1654,6 @@ config_host_data.set('CONFIG_BYTESWAP_H', cc.has_header_symbol('byteswap.h', 'bswap_32')) config_host_data.set('CONFIG_EPOLL_CREATE1', cc.has_header_symbol('sys/epoll.h', 'epoll_create1')) -config_host_data.set('CONFIG_HAS_ENVIRON', - cc.has_header_symbol('unistd.h', 'environ', prefix: g= nu_source_prefix)) config_host_data.set('CONFIG_FALLOCATE_PUNCH_HOLE', cc.has_header_symbol('linux/falloc.h', 'FALLOC_FL_PUN= CH_HOLE') and cc.has_header_symbol('linux/falloc.h', 'FALLOC_FL_KEE= P_SIZE')) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1e7b4656ed..84a3b912be 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -32,15 +32,6 @@ #include #endif =20 -#ifndef CONFIG_HAS_ENVIRON -#ifdef __APPLE__ -#include -#define environ (*_NSGetEnviron()) -#else -extern char **environ; -#endif -#endif - #if defined(__linux__) #include #include @@ -109,8 +100,8 @@ void qmp_guest_shutdown(bool has_mode, const char *mode= , Error **errp) reopen_fd_to_null(1); reopen_fd_to_null(2); =20 - execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", - "hypervisor initiated shutdown", (char *)NULL, environ); + execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + "hypervisor initiated shutdown", (char *)NULL); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(errp, errno, "failed to create child process"); @@ -193,8 +184,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns,= Error **errp) =20 /* Use '/sbin/hwclock -w' to set RTC from the system time, * or '/sbin/hwclock -s' to set the system time from RTC. */ - execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", - NULL, environ); + execl(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(errp, errno, "failed to create child process"); @@ -1560,7 +1550,7 @@ static void execute_fsfreeze_hook(FsfreezeHookArg arg= , Error **errp) reopen_fd_to_null(1); reopen_fd_to_null(2); =20 - execle(hook, hook, arg_str, NULL, environ); + execl(hook, hook, arg_str, NULL); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(errp, errno, "failed to create child process"); @@ -1874,7 +1864,7 @@ static int run_process_child(const char *command[], E= rror **errp) spawn_flag =3D G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL; =20 - success =3D g_spawn_sync(NULL, (char **)command, environ, spawn_flag, + success =3D g_spawn_sync(NULL, (char **)command, NULL, spawn_flag, NULL, NULL, NULL, NULL, &exit_status, &g_err); =20 @@ -2555,9 +2545,9 @@ void qmp_guest_set_user_password(const char *username, reopen_fd_to_null(2); =20 if (crypted) { - execle(passwd_path, "chpasswd", "-e", NULL, environ); + execl(passwd_path, "chpasswd", "-e", NULL); } else { - execle(passwd_path, "chpasswd", NULL, environ); + execl(passwd_path, "chpasswd", NULL); } _exit(EXIT_FAILURE); } else if (pid < 0) { --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650354175998698.5952109928643; Tue, 19 Apr 2022 00:42:55 -0700 (PDT) Received: from localhost ([::1]:51304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiVi-0003YO-6D for importer@patchew.org; Tue, 19 Apr 2022 03:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmG-0001FM-D1 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:52792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmA-0004TO-R0 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: by mail-wm1-x329.google.com with SMTP id y21so8442023wmi.2 for ; Mon, 18 Apr 2022 22:51:46 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9rhqbIK/woJelr8UXpLMJ1Z3I21oYj0e/aPsmV0FvPQ=; b=OSfR1mF9DS/mvlFO+K9WE9v2isqNv5HBell2ag87b8R+qsmjZBr18h0EgwhKouLCEM nv5uwhJ3H4i3DJPGnmz0Ge+bFCgY1e6Abmaw7u1X04M+EMqhO3LhpTDRwB1f1fkgreD5 O0OYkUxyF3a0jYAcLcVIRJQ4tAPlWVkpzkZjEa73bti8AIyvDvawAJ4rEz13f5dNeDon m/u4SsarXIqikLNuW9W7XKlavt5xVudOl87WY2CNNV16Lr2oPBQvlBv9IpMnHm8i+j/W YxA7paajSpLSp4frrwlXAezp9yU9KChsy4/KGAp0Rhic/DnDT9rbuXZ1KbKrHZDCfzvk tHFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=9rhqbIK/woJelr8UXpLMJ1Z3I21oYj0e/aPsmV0FvPQ=; b=NiamUGA7CgMYGmJEtb+/0iLk2kLJTwsvzcV4v27rzC+d4W4JKqGgCKIGb9FVrtuHNY +sOFecViSdUPqpEOowNcyF3BbBP0NgEugsQjbysbATycqrnTWpSyItKAxbAFco1W59+Y fj4Ty51BzNVgPZTHnnd1PPaa80DL383xMZTTUHigDK2LH4LDhSNrSuio0XblR8G6VTYH v8Qlpr0qchjM7jyF3noPuOZq0sYPmx9NE799xoqJHU8zGPlNPLvPM2/SvhEofej+0Aub p4fepOs2n0ms2CTRVx+a9W9Qk7HAn9K+nf3YiBY7BdQsCtUERtYQwUZmRRiJosjPhmD9 wQiA== X-Gm-Message-State: AOAM531zFY6eFjmRtzr2o6ui+R4TFVn3m4xPO7BWh4NfN6fICICzJSk+ OVnR3AYcluatT6bnlACTBi+WMjhQVC7VOQ== X-Google-Smtp-Source: ABdhPJyo/bxLtuFPrJ63Q4q4b6mWDQ4yRt5Cs0HoeTqF7cx2VFYLnrNQYcw1oIjaEVauMkEeSo+tXg== X-Received: by 2002:a1c:7415:0:b0:38e:bbbf:52d9 with SMTP id p21-20020a1c7415000000b0038ebbbf52d9mr18202635wmc.104.1650347504611; Mon, 18 Apr 2022 22:51:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 36/53] Remove qemu-common.h include from most units Date: Tue, 19 Apr 2022 07:50:52 +0200 Message-Id: <20220419055109.142788-37-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::329; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650354177307100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/hvf/hvf-all.c | 1 - accel/tcg/cpu-exec.c | 1 - accel/tcg/tcg-accel-ops-icount.c | 1 - accel/tcg/tcg-accel-ops-mttcg.c | 1 - accel/tcg/tcg-accel-ops-rr.c | 1 - accel/tcg/tcg-accel-ops.c | 1 - accel/tcg/tcg-all.c | 1 - accel/tcg/translate-all.c | 1 - audio/audio_win_int.c | 1 - backends/hostmem-epc.c | 1 - backends/tpm/tpm_passthrough.c | 1 - block/file-posix.c | 1 - block/io_uring.c | 1 - bsd-user/freebsd/os-syscall.c | 1 - bsd-user/mmap.c | 1 - chardev/char-fd.c | 1 - chardev/char-pipe.c | 1 - chardev/char-pty.c | 1 - cpu.c | 1 - crypto/cipher-afalg.c | 1 - crypto/hash-afalg.c | 1 - dump/dump.c | 1 - dump/win_dump.c | 1 - fsdev/virtfs-proxy-helper.c | 1 - gdbstub.c | 1 - hw/9pfs/9p-proxy.c | 1 - hw/alpha/dp264.c | 1 - hw/avr/boot.c | 1 - hw/core/loader.c | 1 - hw/display/artist.c | 1 - hw/display/cg3.c | 1 - hw/display/tcx.c | 1 - hw/display/virtio-gpu-udmabuf.c | 1 - hw/dma/pl330.c | 1 - hw/hppa/machine.c | 1 - hw/i386/pc_sysfw.c | 1 - hw/i386/x86.c | 1 - hw/input/vhost-user-input.c | 1 - hw/intc/xics_kvm.c | 1 - hw/m68k/mcf5208.c | 1 - hw/m68k/q800.c | 1 - hw/m68k/virt.c | 1 - hw/microblaze/boot.c | 1 - hw/mips/fuloong2e.c | 1 - hw/mips/jazz.c | 1 - hw/mips/loongson3_virt.c | 1 - hw/mips/malta.c | 1 - hw/mips/mipssim.c | 1 - hw/misc/sbsa_ec.c | 1 - hw/net/fsl_etsec/etsec.c | 1 - hw/net/fsl_etsec/rings.c | 1 - hw/net/msf2-emac.c | 1 - hw/net/npcm7xx_emc.c | 1 - hw/nios2/boot.c | 1 - hw/nios2/generic_nommu.c | 1 - hw/nvram/fw_cfg.c | 1 - hw/pci-host/mv64361.c | 1 - hw/pci-host/pnv_phb3.c | 1 - hw/pci-host/pnv_phb3_msi.c | 1 - hw/pci-host/pnv_phb3_pbcq.c | 1 - hw/pci-host/pnv_phb4.c | 1 - hw/pci-host/pnv_phb4_pec.c | 1 - hw/pci-host/raven.c | 1 - hw/pci-host/remote.c | 1 - hw/pci/pci.c | 1 - hw/ppc/e500.c | 1 - hw/ppc/mac_newworld.c | 1 - hw/ppc/mac_oldworld.c | 1 - hw/ppc/pegasos2.c | 1 - hw/ppc/pnv.c | 1 - hw/ppc/pnv_bmc.c | 1 - hw/ppc/ppc405_boards.c | 1 - hw/ppc/ppc440_bamboo.c | 1 - hw/ppc/sam460ex.c | 1 - hw/ppc/spapr.c | 1 - hw/ppc/spapr_numa.c | 1 - hw/ppc/spapr_pci_nvlink2.c | 1 - hw/ppc/spapr_tpm_proxy.c | 1 - hw/ppc/spapr_vof.c | 1 - hw/ppc/virtex_ml507.c | 1 - hw/ppc/vof.c | 1 - hw/remote/iohub.c | 1 - hw/remote/machine.c | 1 - hw/remote/memory.c | 1 - hw/remote/message.c | 1 - hw/remote/mpqemu-link.c | 1 - hw/remote/proxy-memory-listener.c | 1 - hw/remote/proxy.c | 1 - hw/remote/remote-obj.c | 1 - hw/riscv/boot.c | 1 - hw/rx/rx-gdbsim.c | 1 - hw/s390x/ipl.c | 1 - hw/sd/sd.c | 1 - hw/sparc/leon3.c | 1 - hw/sparc/sun4m.c | 1 - hw/sparc64/sun4u.c | 1 - hw/usb/dev-mtp.c | 1 - hw/virtio/virtio-iommu.c | 1 - hw/virtio/virtio-mem.c | 1 - hw/virtio/virtio-pmem.c | 1 - include/qemu-common.h | 9 --------- io/channel-socket.c | 1 - linux-user/aarch64/cpu_loop.c | 1 - linux-user/alpha/cpu_loop.c | 1 - linux-user/arm/cpu_loop.c | 1 - linux-user/cris/cpu_loop.c | 1 - linux-user/hexagon/cpu_loop.c | 1 - linux-user/i386/cpu_loop.c | 1 - linux-user/m68k/cpu_loop.c | 1 - linux-user/microblaze/cpu_loop.c | 1 - linux-user/mips/cpu_loop.c | 1 - linux-user/openrisc/cpu_loop.c | 1 - linux-user/ppc/cpu_loop.c | 1 - linux-user/riscv/cpu_loop.c | 1 - linux-user/s390x/cpu_loop.c | 1 - linux-user/sh4/cpu_loop.c | 1 - linux-user/sparc/cpu_loop.c | 1 - linux-user/uname.c | 1 - monitor/qmp-cmds.c | 1 - net/colo-compare.c | 1 - net/net.c | 1 - net/socket.c | 1 - net/tap-bsd.c | 1 - net/tap-linux.c | 1 - net/tap-solaris.c | 1 - net/tap-win32.c | 1 - net/tap.c | 1 - net/vde.c | 1 - os-posix.c | 1 - os-win32.c | 1 - page-vary-common.c | 1 - qga/commands-posix.c | 1 - softmmu/cpu-throttle.c | 1 - softmmu/cpu-timers.c | 1 - softmmu/cpus.c | 1 - softmmu/datadir.c | 1 - softmmu/icount.c | 1 - softmmu/runstate.c | 1 - stubs/monitor-core.c | 1 - target/arm/hvf/hvf.c | 1 - target/arm/kvm.c | 1 - target/arm/kvm64.c | 1 - target/hexagon/gdbstub.c | 1 - target/i386/hax/hax-all.c | 1 - target/i386/hvf/hvf.c | 1 - target/i386/hvf/x86.c | 1 - target/i386/hvf/x86_cpuid.c | 1 - target/i386/hvf/x86_decode.c | 1 - target/i386/hvf/x86_descr.c | 1 - target/i386/hvf/x86_emu.c | 1 - target/i386/hvf/x86_flags.c | 1 - target/i386/hvf/x86_mmu.c | 1 - target/i386/hvf/x86_task.c | 1 - target/i386/hvf/x86hvf.c | 1 - target/i386/kvm/sev-stub.c | 1 - target/i386/nvmm/nvmm-all.c | 1 - target/i386/whpx/whpx-all.c | 1 - target/i386/whpx/whpx-apic.c | 1 - target/mips/kvm.c | 1 - target/nios2/nios2-semi.c | 1 - target/ppc/kvm.c | 1 - target/riscv/kvm.c | 1 - target/rx/cpu.c | 1 - target/rx/gdbstub.c | 1 - target/s390x/kvm/kvm.c | 1 - target/s390x/tcg/vec_fpu_helper.c | 1 - target/s390x/tcg/vec_int_helper.c | 1 - target/s390x/tcg/vec_string_helper.c | 1 - target/tricore/gdbstub.c | 1 - target/xtensa/core-de233_fpu.c | 1 - target/xtensa/core-dsp3400.c | 1 - target/xtensa/core-test_mmuhifi_c3.c | 1 - target/xtensa/import_core.sh | 1 - tcg/tci.c | 1 - tests/qtest/acpi-utils.c | 1 - tests/qtest/ahci-test.c | 1 - tests/qtest/aspeed_hace-test.c | 1 - tests/qtest/bios-tables-test.c | 1 - tests/qtest/boot-sector.c | 1 - tests/qtest/cpu-plug-test.c | 1 - tests/qtest/dbus-display-test.c | 1 - tests/qtest/dbus-vmstate-test.c | 1 - tests/qtest/device-introspect-test.c | 1 - tests/qtest/e1000e-test.c | 2 -- tests/qtest/erst-test.c | 1 - tests/qtest/fdc-test.c | 1 - tests/qtest/fuzz/qos_fuzz.c | 1 - tests/qtest/hd-geo-test.c | 1 - tests/qtest/ide-test.c | 1 - tests/qtest/ipmi-bt-test.c | 1 - tests/qtest/ivshmem-test.c | 1 - tests/qtest/libqos/ahci.c | 1 - tests/qtest/libqos/malloc-pc.c | 2 -- tests/qtest/libqos/malloc-spapr.c | 2 -- tests/qtest/libqos/malloc.c | 1 - tests/qtest/libqtest.c | 1 - tests/qtest/machine-none-test.c | 1 - tests/qtest/npcm7xx_emc-test.c | 1 - tests/qtest/pxe-test.c | 1 - tests/qtest/qom-test.c | 1 - tests/qtest/rtl8139-test.c | 1 - tests/qtest/test-filter-mirror.c | 1 - tests/qtest/test-filter-redirector.c | 1 - tests/qtest/test-x86-cpuid-compat.c | 1 - tests/qtest/virtio-net-test.c | 1 - tests/unit/check-qjson.c | 1 - tests/unit/check-qnull.c | 1 - tests/unit/check-qnum.c | 1 - tests/unit/check-qobject.c | 1 - tests/unit/check-qstring.c | 1 - tests/unit/socket-helpers.c | 1 - tests/unit/test-clone-visitor.c | 1 - tests/unit/test-forward-visitor.c | 1 - tests/unit/test-iov.c | 1 - tests/unit/test-logging.c | 1 - tests/unit/test-qmp-event.c | 1 - tests/unit/test-qobject-input-visitor.c | 1 - tests/unit/test-qobject-output-visitor.c | 1 - tests/unit/test-string-input-visitor.c | 1 - tests/unit/test-string-output-visitor.c | 1 - tests/unit/test-thread-pool.c | 1 - tests/unit/test-util-sockets.c | 1 - tests/unit/test-visitor-serialization.c | 1 - tests/unit/test-xbzrle.c | 1 - ui/gtk-clipboard.c | 1 - ui/keymaps.c | 1 - ui/vdagent.c | 1 - ui/vnc-clipboard.c | 1 - ui/vnc-enc-tight.c | 2 +- ui/vnc.c | 1 - util/aio-win32.c | 1 - util/coroutine-sigaltstack.c | 1 - util/coroutine-win32.c | 1 - util/cutils.c | 1 - util/event_notifier-posix.c | 1 - util/event_notifier-win32.c | 1 - util/iov.c | 1 - util/osdep.c | 1 - util/oslib-posix.c | 1 - util/oslib-win32.c | 1 - util/qemu-coroutine-io.c | 1 - util/qemu-sockets.c | 1 - util/qemu-thread-win32.c | 1 - 243 files changed, 1 insertion(+), 254 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index f185b0830a..0043f4d308 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "sysemu/hvf.h" #include "sysemu/hvf_int.h" diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index c997c2e8e0..083ada76b1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/qemu-print.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" diff --git a/accel/tcg/tcg-accel-ops-icount.c b/accel/tcg/tcg-accel-ops-ico= unt.c index bdaf2c943b..6436cd9349 100644 --- a/accel/tcg/tcg-accel-ops-icount.c +++ b/accel/tcg/tcg-accel-ops-icount.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "sysemu/cpu-timers.h" diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttc= g.c index ea2b741deb..d50239e0e2 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "sysemu/cpu-timers.h" diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index b287110766..1a72149f0e 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "sysemu/cpu-timers.h" diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index ea7dcad674..684dc5a137 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -26,7 +26,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sysemu/tcg.h" #include "sysemu/replay.h" #include "sysemu/cpu-timers.h" diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index d6336a9c96..47952eecd7 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sysemu/tcg.h" #include "sysemu/cpu-timers.h" #include "tcg/tcg.h" diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5971cd53ab..a6e03c1e50 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #define NO_CPU_IO_DEFS #include "trace.h" diff --git a/audio/audio_win_int.c b/audio/audio_win_int.c index 5ea8157dfc..316f118f50 100644 --- a/audio/audio_win_int.c +++ b/audio/audio_win_int.c @@ -1,7 +1,6 @@ /* public domain */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #define AUDIO_CAP "win-int" #include diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c index b47f98b6a3..037292d267 100644 --- a/backends/hostmem-epc.c +++ b/backends/hostmem-epc.c @@ -12,7 +12,6 @@ #include =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qom/object_interfaces.h" #include "qapi/error.h" #include "sysemu/hostmem.h" diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c index d5558fae6c..5a2f74db1b 100644 --- a/backends/tpm/tpm_passthrough.c +++ b/backends/tpm/tpm_passthrough.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/sockets.h" diff --git a/block/file-posix.c b/block/file-posix.c index 61b02d85eb..bfd9b21111 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "qemu/error-report.h" diff --git a/block/io_uring.c b/block/io_uring.c index 782afdb433..0b401512b9 100644 --- a/block/io_uring.c +++ b/block/io_uring.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "block/aio.h" #include "qemu/queue.h" #include "block/block.h" diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index a17ff9f6ec..d272478e7b 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -37,7 +37,6 @@ #include =20 #include "qemu.h" -#include "qemu-common.h" #include "signal-common.h" #include "user/syscall-trace.h" =20 diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 07aa0a634d..e54e26de17 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" =20 #include "qemu.h" -#include "qemu-common.h" =20 static pthread_mutex_t mmap_mutex =3D PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; diff --git a/chardev/char-fd.c b/chardev/char-fd.c index 93c56913b4..6ec9682b22 100644 --- a/chardev/char-fd.c +++ b/chardev/char-fd.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/module.h" #include "qemu/sockets.h" #include "qapi/error.h" diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c index 7eca5d9a56..66d3b85091 100644 --- a/chardev/char-pipe.c +++ b/chardev/char-pipe.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/main-loop.h" #include "qemu/module.h" diff --git a/chardev/char-pty.c b/chardev/char-pty.c index d73d8b2390..1e2863f532 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "chardev/char.h" #include "io/channel-file.h" diff --git a/cpu.c b/cpu.c index ab2c7c81e4..0fef70e18e 100644 --- a/cpu.c +++ b/cpu.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" =20 #include "exec/target_page.h" diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c index c55cd28bf0..3df8fc54c0 100644 --- a/crypto/cipher-afalg.c +++ b/crypto/cipher-afalg.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" #include "qemu/sockets.h" -#include "qemu-common.h" #include "qapi/error.h" #include "crypto/cipher.h" #include "cipherpriv.h" diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c index 4ac18c7c1d..3ebea39292 100644 --- a/crypto/hash-afalg.c +++ b/crypto/hash-afalg.c @@ -13,7 +13,6 @@ #include "qemu/osdep.h" #include "qemu/iov.h" #include "qemu/sockets.h" -#include "qemu-common.h" #include "qapi/error.h" #include "crypto/hash.h" #include "crypto/hmac.h" diff --git a/dump/dump.c b/dump/dump.c index 5d71c47d06..e766ce1d7d 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -12,7 +12,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "elf.h" #include "exec/hwaddr.h" diff --git a/dump/win_dump.c b/dump/win_dump.c index c5eb5a9aac..fbdbb7bd93 100644 --- a/dump/win_dump.c +++ b/dump/win_dump.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "elf.h" #include "exec/hwaddr.h" diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index d06a0f7b83..2dde27922f 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -21,7 +21,6 @@ #include #endif #include -#include "qemu-common.h" #include "qemu/sockets.h" #include "qemu/xattr.h" #include "9p-iov-marshal.h" diff --git a/gdbstub.c b/gdbstub.c index c8375e3c3f..2c804d5066 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/ctype.h" diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index 4c5e0fc217..99d115ff0d 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -18,7 +18,6 @@ #include "qemu/osdep.h" #include #include -#include "qemu-common.h" #include "9p.h" #include "qapi/error.h" #include "qemu/cutils.h" diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index c78ed96d0e..f4349eba83 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -7,7 +7,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "elf.h" #include "hw/loader.h" diff --git a/hw/avr/boot.c b/hw/avr/boot.c index cbede775ce..617f3a144c 100644 --- a/hw/avr/boot.c +++ b/hw/avr/boot.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "hw/loader.h" #include "elf.h" diff --git a/hw/core/loader.c b/hw/core/loader.c index 8d9b2df6e7..8167301f04 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -43,7 +43,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" diff --git a/hw/display/artist.c b/hw/display/artist.c index 69a8f9eea8..8e121bb0b4 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -7,7 +7,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 4b7e78d919..2e9656ae1c 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "qemu/error-report.h" diff --git a/hw/display/tcx.c b/hw/display/tcx.c index d4d09d0df8..1b27b64f6d 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "ui/console.h" diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabu= f.c index 1597921c51..8bdf4bac6e 100644 --- a/hw/display/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" -#include "qemu-common.h" #include "qemu/iov.h" #include "ui/console.h" #include "hw/virtio/virtio-gpu.h" diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 31ce01b7c5..08e5938ec7 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -15,7 +15,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 98b30e0395..f7595c0857 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -4,7 +4,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "elf.h" diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index c8b17af953..0540047bad 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "sysemu/block-backend.h" #include "qemu/error-report.h" diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 4cf107baea..bb67272790 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -25,7 +25,6 @@ #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/units.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" diff --git a/hw/input/vhost-user-input.c b/hw/input/vhost-user-input.c index 273e96a7b1..aeb0624fe5 100644 --- a/hw/input/vhost-user-input.c +++ b/hw/input/vhost-user-input.c @@ -7,7 +7,6 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qapi/error.h" -#include "qemu-common.h" =20 #include "hw/virtio/virtio-input.h" =20 diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index f5bfc501bc..9719d98a17 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -27,7 +27,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "trace.h" #include "sysemu/kvm.h" #include "hw/ppc/spapr.h" diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 93812ee206..655207e393 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -11,7 +11,6 @@ #include "qemu/error-report.h" #include "qemu/log.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "hw/irq.h" diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 66ca5c0df6..099a758c6f 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -22,7 +22,6 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "sysemu/sysemu.h" #include "cpu.h" diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 8e630282e0..7de8b5f833 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -9,7 +9,6 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" -#include "qemu-common.h" #include "sysemu/sysemu.h" #include "cpu.h" #include "hw/boards.h" diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 03c030aa2c..8b92a9801a 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -25,7 +25,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "qemu/option.h" diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index c9f14e70a0..7b13098f9b 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -19,7 +19,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qapi/error.h" diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 4d6b44de34..6598d7dddd 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "hw/clock.h" #include "hw/mips/mips.h" diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index ae192db0c8..25534288dd 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/units.h" #include "qemu/cutils.h" #include "qemu/datadir.h" diff --git a/hw/mips/malta.c b/hw/mips/malta.c index c4474b927c..9ffdc5b8f1 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/bitops.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "hw/clock.h" #include "hw/southbridge/piix.h" diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 30bc1c4f08..39f64448f2 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -27,7 +27,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "hw/clock.h" #include "hw/mips/mips.h" diff --git a/hw/misc/sbsa_ec.c b/hw/misc/sbsa_ec.c index 83020fe9ac..8d939fe31b 100644 --- a/hw/misc/sbsa_ec.c +++ b/hw/misc/sbsa_ec.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/log.h" #include "hw/sysbus.h" #include "sysemu/runstate.h" diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index e7fc082518..6d50c39543 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -27,7 +27,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "hw/sysbus.h" #include "hw/irq.h" #include "hw/ptimer.h" diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c index 8f08446415..a32589e33b 100644 --- a/hw/net/fsl_etsec/rings.c +++ b/hw/net/fsl_etsec/rings.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "net/checksum.h" #include "qemu/log.h" #include "etsec.h" diff --git a/hw/net/msf2-emac.c b/hw/net/msf2-emac.c index 9278fdce0b..7ccd3e5142 100644 --- a/hw/net/msf2-emac.c +++ b/hw/net/msf2-emac.c @@ -29,7 +29,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/log.h" #include "qapi/error.h" #include "hw/registerfields.h" diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c index 9a2328935c..7c86bb52e5 100644 --- a/hw/net/npcm7xx_emc.c +++ b/hw/net/npcm7xx_emc.c @@ -32,7 +32,6 @@ /* For crc32 */ #include =20 -#include "qemu-common.h" #include "hw/irq.h" #include "hw/qdev-clock.h" #include "hw/qdev-properties.h" diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index e889595d5c..07b8d87633 100644 --- a/hw/nios2/boot.c +++ b/hw/nios2/boot.c @@ -30,7 +30,6 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/option.h" #include "qemu/config-file.h" diff --git a/hw/nios2/generic_nommu.c b/hw/nios2/generic_nommu.c index fbc18dbd04..48edb3ae37 100644 --- a/hw/nios2/generic_nommu.c +++ b/hw/nios2/generic_nommu.c @@ -28,7 +28,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" =20 #include "hw/char/serial.h" #include "hw/boards.h" diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index ea2d56f9f2..4125cbebcd 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h" diff --git a/hw/pci-host/mv64361.c b/hw/pci-host/mv64361.c index 00b3ff7d90..cc9c4d6d3b 100644 --- a/hw/pci-host/mv64361.c +++ b/hw/pci-host/mv64361.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/units.h" #include "qapi/error.h" #include "hw/hw.h" diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 6e9aa9d6ac..4e68ad4f03 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -10,7 +10,6 @@ #include "qemu/log.h" #include "qapi/visitor.h" #include "qapi/error.h" -#include "qemu-common.h" #include "hw/pci-host/pnv_phb3_regs.h" #include "hw/pci-host/pnv_phb3.h" #include "hw/pci/pcie_host.h" diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index 8bcbc2cc4f..2f4112907b 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "qapi/error.h" -#include "qemu-common.h" #include "hw/pci-host/pnv_phb3_regs.h" #include "hw/pci-host/pnv_phb3.h" #include "hw/ppc/pnv.h" diff --git a/hw/pci-host/pnv_phb3_pbcq.c b/hw/pci-host/pnv_phb3_pbcq.c index c7426cd27a..82f70efa43 100644 --- a/hw/pci-host/pnv_phb3_pbcq.c +++ b/hw/pci-host/pnv_phb3_pbcq.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/log.h" #include "target/ppc/cpu.h" #include "hw/ppc/fdt.h" diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 11c97e27eb..3c4c2dace0 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -10,7 +10,6 @@ #include "qemu/log.h" #include "qapi/visitor.h" #include "qapi/error.h" -#include "qemu-common.h" #include "monitor/monitor.h" #include "target/ppc/cpu.h" #include "hw/pci-host/pnv_phb4_regs.h" diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 6f1121a948..61bc0b503e 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/log.h" #include "target/ppc/cpu.h" #include "hw/ppc/fdt.h" diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 6e514f75eb..7a105e4a63 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qemu/log.h" diff --git a/hw/pci-host/remote.c b/hw/pci-host/remote.c index eee45444ef..bfb25ef6af 100644 --- a/hw/pci-host/remote.c +++ b/hw/pci-host/remote.c @@ -22,7 +22,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index dae9119bfe..e99417e501 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "hw/irq.h" diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index c7e6767f91..2bc3dce1fb 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -15,7 +15,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qapi/error.h" diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 7b5a205309..e8ef1a9e5d 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -47,7 +47,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "hw/ppc/ppc.h" diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 7016979a7c..fe2adb057b 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -25,7 +25,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qapi/error.h" diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index d45008ac71..56bf203dfd 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -8,7 +8,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/units.h" #include "qapi/error.h" #include "hw/hw.h" diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 00f57c9678..c5e48992d9 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qemu/cutils.h" diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index 75a22ce50b..99f1e8d7f9 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -17,7 +17,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "target/ppc/cpu.h" #include "qemu/log.h" diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 7e1a4ac955..32013b8983 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "hw/ppc/ppc.h" diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 7fb620b9a0..efa90ef5ba 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/error-report.h" #include "net/net.h" diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 0737234d66..2f24598f55 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/error-report.h" #include "qapi/error.h" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a4372ba189..cc11fcc8b2 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -25,7 +25,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/memalign.h" #include "qapi/error.h" diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index d7c0e212ba..a64098c375 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "hw/ppc/spapr_numa.h" #include "hw/pci-host/spapr.h" #include "hw/ppc/fdt.h" diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c index 4678c79235..63b476c8f7 100644 --- a/hw/ppc/spapr_pci_nvlink2.c +++ b/hw/ppc/spapr_pci_nvlink2.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "hw/pci/pci.h" #include "hw/pci-host/spapr.h" #include "hw/ppc/spapr_numa.h" diff --git a/hw/ppc/spapr_tpm_proxy.c b/hw/ppc/spapr_tpm_proxy.c index 2454086744..e10af35a18 100644 --- a/hw/ppc/spapr_tpm_proxy.c +++ b/hw/ppc/spapr_tpm_proxy.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/reset.h" diff --git a/hw/ppc/spapr_vof.c b/hw/ppc/spapr_vof.c index a33f940c32..09f29be0b9 100644 --- a/hw/ppc/spapr_vof.c +++ b/hw/ppc/spapr_vof.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 9c575403b8..b67a709ddc 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "cpu.h" diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index 2b63a62875..8d96593677 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -10,7 +10,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/timer.h" #include "qemu/range.h" #include "qemu/units.h" diff --git a/hw/remote/iohub.c b/hw/remote/iohub.c index 547d597f0f..40dfee4bad 100644 --- a/hw/remote/iohub.c +++ b/hw/remote/iohub.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/pci/pci.h" #include "hw/pci/pci_ids.h" diff --git a/hw/remote/machine.c b/hw/remote/machine.c index 952105eab5..92d71d47bb 100644 --- a/hw/remote/machine.c +++ b/hw/remote/machine.c @@ -14,7 +14,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/remote/machine.h" #include "exec/memory.h" diff --git a/hw/remote/memory.c b/hw/remote/memory.c index 6e21ab1a45..6d60da91e0 100644 --- a/hw/remote/memory.c +++ b/hw/remote/memory.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/remote/memory.h" #include "exec/ram_addr.h" diff --git a/hw/remote/message.c b/hw/remote/message.c index 11d729845c..50f6bf2d49 100644 --- a/hw/remote/message.c +++ b/hw/remote/message.c @@ -8,7 +8,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/remote/machine.h" #include "io/channel.h" diff --git a/hw/remote/mpqemu-link.c b/hw/remote/mpqemu-link.c index 7e841820e5..2a4aa651ca 100644 --- a/hw/remote/mpqemu-link.c +++ b/hw/remote/mpqemu-link.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "qemu/module.h" #include "hw/remote/mpqemu-link.h" diff --git a/hw/remote/proxy-memory-listener.c b/hw/remote/proxy-memory-lis= tener.c index 0e893f3189..eb9918fe72 100644 --- a/hw/remote/proxy-memory-listener.c +++ b/hw/remote/proxy-memory-listener.c @@ -7,7 +7,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "qemu/compiler.h" #include "qemu/int128.h" diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c index bad164299d..1c7786b52c 100644 --- a/hw/remote/proxy.c +++ b/hw/remote/proxy.c @@ -7,7 +7,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "hw/remote/proxy.h" #include "hw/pci/pci.h" diff --git a/hw/remote/remote-obj.c b/hw/remote/remote-obj.c index 4f21254219..333e5ac443 100644 --- a/hw/remote/remote-obj.c +++ b/hw/remote/remote-obj.c @@ -8,7 +8,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "qemu/error-report.h" #include "qemu/notify.h" diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index cae74fcbcd..0f179d3601 100644 --- a/hw/riscv/boot.c +++ b/hw/riscv/boot.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/units.h" #include "qemu/error-report.h" diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c index 75d1fec6ca..64f897e5b1 100644 --- a/hw/rx/rx-gdbsim.c +++ b/hw/rx/rx-gdbsim.c @@ -20,7 +20,6 @@ #include "qemu/cutils.h" #include "qemu/error-report.h" #include "qapi/error.h" -#include "qemu-common.h" #include "hw/loader.h" #include "hw/rx/rx62n.h" #include "sysemu/qtest.h" diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index eb7fc4c4ae..84971e537b 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -13,7 +13,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qapi/error.h" #include "sysemu/reset.h" diff --git a/hw/sd/sd.c b/hw/sd/sd.c index cd67a7bac8..8e6fa09151 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -47,7 +47,6 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "qemu/module.h" -#include "qemu-common.h" #include "sdmmc-internal.h" #include "trace.h" =20 diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index a9f2496827..1e39d2e2d0 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -26,7 +26,6 @@ #include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "hw/irq.h" diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 7f3a7c0027..fccaed1eb4 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -26,7 +26,6 @@ #include "qemu/units.h" #include "qapi/error.h" #include "qemu/datadir.h" -#include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" #include "qemu/error-report.h" diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index cda7df36e3..6fd08e2298 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -26,7 +26,6 @@ #include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "cpu.h" #include "hw/pci/pci.h" diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index e6b77a2a94..5831395cef 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -10,7 +10,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/error-report.h" #include diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 664cbd9583..6de58a76a7 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "qemu/iov.h" -#include "qemu-common.h" #include "hw/qdev-properties.h" #include "hw/virtio/virtio.h" #include "sysemu/kvm.h" diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 35cbf1f219..5aca408726 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/iov.h" #include "qemu/cutils.h" #include "qemu/error-report.h" diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c index 5419dca75e..5dd21c2c44 100644 --- a/hw/virtio/virtio-pmem.c +++ b/hw/virtio/virtio-pmem.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "hw/virtio/virtio-pmem.h" diff --git a/include/qemu-common.h b/include/qemu-common.h index 65483f70d4..a923ed28d5 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -1,12 +1,3 @@ -/* - * This file is supposed to be included only by .c files. No header file s= hould - * depend on qemu-common.h, as this would easily lead to circular header - * dependencies. - * - * If a header file uses a definition from qemu-common.h, that definition - * must be moved to a separate header file, and the header that uses it - * must include that header. - */ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H =20 diff --git a/io/channel-socket.c b/io/channel-socket.c index 7a8d9f69c9..9f5ddf68b6 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "qapi/qapi-visit-sockets.h" #include "qemu/module.h" diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 31a66a4fa0..3b273f6299 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index de6e0c901c..2ea039aa71 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index e4bca93749..3268e5f1f1 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "elf.h" diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 0f46b3c1a8..01e6ff16fc 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 0d73934d31..b84e25bf71 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -19,7 +19,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 90bffc1956..492701dd9a 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "qemu/timer.h" #include "user-internals.h" diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 928a18e3cf..d1bf8548b7 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_l= oop.c index 1a2556be2c..5ccf9e942e 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 9bb12a07ba..d5c1c7941d 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 7683bea064..a7aa586c8f 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index b468f199e4..02204ad8be 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "qemu/timer.h" #include "user-internals.h" diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 26d446f323..29084c1421 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu.h" #include "user-internals.h" diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 7901dfe6f5..285bc60071 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 1bd313cb19..c805f9db11 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index baf3d9ae01..434c90a55f 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu.h" #include "user-internals.h" #include "cpu_loop-common.h" diff --git a/linux-user/uname.c b/linux-user/uname.c index 0856783b21..415fdf31b6 100644 --- a/linux-user/uname.c +++ b/linux-user/uname.c @@ -21,7 +21,6 @@ =20 #include "qemu.h" #include "user-internals.h" -//#include "qemu-common.h" #include "uname.h" =20 /* return highest utsname machine name for emulated instruction set diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 883cf1ca4b..5e7302cbb9 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -14,7 +14,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/option.h" #include "monitor/monitor.h" diff --git a/net/colo-compare.c b/net/colo-compare.c index 62554b5b3c..d5d0965805 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -13,7 +13,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "trace.h" #include "qapi/error.h" diff --git a/net/net.c b/net/net.c index 9f17ab2044..a094cf1d29 100644 --- a/net/net.c +++ b/net/net.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" =20 #include "net/net.h" #include "clients.h" diff --git a/net/socket.c b/net/socket.c index c4b80e9228..ea5220a2eb 100644 --- a/net/socket.c +++ b/net/socket.c @@ -27,7 +27,6 @@ #include "clients.h" #include "monitor/monitor.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/sockets.h" diff --git a/net/tap-bsd.c b/net/tap-bsd.c index e45a6d124e..7e65bd391f 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/error.h" #include "tap_int.h" #include "qemu/cutils.h" diff --git a/net/tap-linux.c b/net/tap-linux.c index 5e70b93037..3e24d232e7 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "tap_int.h" #include "tap-linux.h" #include "net/tap.h" diff --git a/net/tap-solaris.c b/net/tap-solaris.c index d85224242b..79919785c9 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -27,7 +27,6 @@ #include "tap_int.h" #include "qemu/ctype.h" #include "qemu/cutils.h" -#include "qemu-common.h" =20 #include #include diff --git a/net/tap-win32.c b/net/tap-win32.c index 6096972f5d..7466f22e77 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -29,7 +29,6 @@ #include "qemu/osdep.h" #include "tap_int.h" =20 -#include "qemu-common.h" #include "clients.h" /* net_init_tap */ #include "net/eth.h" #include "net/net.h" diff --git a/net/tap.c b/net/tap.c index c5cbeaa7a2..6190fa699d 100644 --- a/net/tap.c +++ b/net/tap.c @@ -38,7 +38,6 @@ #include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/net/vde.c b/net/vde.c index 99189cccb6..1083916bcf 100644 --- a/net/vde.c +++ b/net/vde.c @@ -27,7 +27,6 @@ =20 #include "net/net.h" #include "clients.h" -#include "qemu-common.h" #include "qemu/option.h" #include "qemu/main-loop.h" #include "qapi/error.h" diff --git a/os-posix.c b/os-posix.c index 24692c8593..ee765f047d 100644 --- a/os-posix.c +++ b/os-posix.c @@ -29,7 +29,6 @@ #include #include =20 -#include "qemu-common.h" /* Needed early for CONFIG_BSD etc. */ #include "net/slirp.h" #include "qemu/qemu-options.h" diff --git a/os-win32.c b/os-win32.c index 6f21b57841..725ad652e8 100644 --- a/os-win32.c +++ b/os-win32.c @@ -26,7 +26,6 @@ #include "qemu/osdep.h" #include #include -#include "qemu-common.h" #include "sysemu/runstate.h" =20 static BOOL WINAPI qemu_ctrl_handler(DWORD type) diff --git a/page-vary-common.c b/page-vary-common.c index 9175556498..ab77672dd4 100644 --- a/page-vary-common.c +++ b/page-vary-common.c @@ -20,7 +20,6 @@ #define IN_PAGE_VARY 1 =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "exec/page-vary.h" =20 /* WARNING: This file must *not* be complied with -flto. */ diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 84a3b912be..390c1560e1 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -16,7 +16,6 @@ #include #include #include -#include "qemu-common.h" #include "guest-agent-core.h" #include "qga-qapi-commands.h" #include "qapi/error.h" diff --git a/softmmu/cpu-throttle.c b/softmmu/cpu-throttle.c index 8c2144ab95..d9bb30a223 100644 --- a/softmmu/cpu-throttle.c +++ b/softmmu/cpu-throttle.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/thread.h" #include "hw/core/cpu.h" #include "qemu/main-loop.h" diff --git a/softmmu/cpu-timers.c b/softmmu/cpu-timers.c index 204d946a17..117408cb83 100644 --- a/softmmu/cpu-timers.c +++ b/softmmu/cpu-timers.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "migration/vmstate.h" #include "qapi/error.h" diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 7b75bb66d5..668bef9b4d 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "monitor/monitor.h" #include "qemu/coroutine-tls.h" #include "qapi/error.h" diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 504c4665be..160cac999a 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "qemu/cutils.h" #include "trace.h" diff --git a/softmmu/icount.c b/softmmu/icount.c index 21341a4ce4..5ca271620d 100644 --- a/softmmu/icount.c +++ b/softmmu/icount.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "migration/vmstate.h" #include "qapi/error.h" diff --git a/softmmu/runstate.c b/softmmu/runstate.c index e0d869b21a..fac7b63259 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -40,7 +40,6 @@ #include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-events-run-state.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/job.h" diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index d058a2a00d..afa477aae6 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -1,6 +1,5 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "qemu-common.h" #include "qapi/qapi-emit-events.h" =20 Monitor *monitor_cur(void) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 8c34f86792..567e296b21 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -10,7 +10,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" =20 #include "sysemu/runstate.h" diff --git a/target/arm/kvm.c b/target/arm/kvm.c index bbf1ce7ba3..5fc37ac10a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -13,7 +13,6 @@ =20 #include =20 -#include "qemu-common.h" #include "qemu/timer.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 9ec8875150..17dd2f77d9 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -16,7 +16,6 @@ #include #include =20 -#include "qemu-common.h" #include "qapi/error.h" #include "cpu.h" #include "qemu/timer.h" diff --git a/target/hexagon/gdbstub.c b/target/hexagon/gdbstub.c index 9c8c04c961..d152d01bfe 100644 --- a/target/hexagon/gdbstub.c +++ b/target/hexagon/gdbstub.c @@ -16,7 +16,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "exec/gdbstub.h" #include "cpu.h" #include "internal.h" diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index 81f665e212..b185ee8de4 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -27,7 +27,6 @@ #include "cpu.h" #include "exec/address-spaces.h" =20 -#include "qemu-common.h" #include "qemu/accel.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index fc12c02fb2..f8833277ab 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -47,7 +47,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/memalign.h" =20 diff --git a/target/i386/hvf/x86.c b/target/i386/hvf/x86.c index 91a3fe002c..d086584f26 100644 --- a/target/i386/hvf/x86.c +++ b/target/i386/hvf/x86.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" =20 #include "cpu.h" -#include "qemu-common.h" #include "x86_decode.h" #include "x86_emu.h" #include "vmcs.h" diff --git a/target/i386/hvf/x86_cpuid.c b/target/i386/hvf/x86_cpuid.c index 32b0d131df..f24dd50e48 100644 --- a/target/i386/hvf/x86_cpuid.c +++ b/target/i386/hvf/x86_cpuid.c @@ -21,7 +21,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "x86.h" #include "vmx.h" diff --git a/target/i386/hvf/x86_decode.c b/target/i386/hvf/x86_decode.c index 062713b1a4..3728d7705e 100644 --- a/target/i386/hvf/x86_decode.c +++ b/target/i386/hvf/x86_decode.c @@ -18,7 +18,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "panic.h" #include "x86_decode.h" #include "vmx.h" diff --git a/target/i386/hvf/x86_descr.c b/target/i386/hvf/x86_descr.c index af15c06ac5..a484942cfc 100644 --- a/target/i386/hvf/x86_descr.c +++ b/target/i386/hvf/x86_descr.c @@ -18,7 +18,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "vmx.h" #include "x86_descr.h" =20 diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index 050428795b..f5704f63e8 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -37,7 +37,6 @@ =20 #include "qemu/osdep.h" #include "panic.h" -#include "qemu-common.h" #include "x86_decode.h" #include "x86.h" #include "x86_emu.h" diff --git a/target/i386/hvf/x86_flags.c b/target/i386/hvf/x86_flags.c index fecbca7517..03d6de5efc 100644 --- a/target/i386/hvf/x86_flags.c +++ b/target/i386/hvf/x86_flags.c @@ -23,7 +23,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "panic.h" #include "cpu.h" #include "x86_flags.h" diff --git a/target/i386/hvf/x86_mmu.c b/target/i386/hvf/x86_mmu.c index df0b91cd42..96d117567e 100644 --- a/target/i386/hvf/x86_mmu.c +++ b/target/i386/hvf/x86_mmu.c @@ -18,7 +18,6 @@ =20 #include "qemu/osdep.h" #include "panic.h" -#include "qemu-common.h" #include "cpu.h" #include "x86.h" #include "x86_mmu.h" diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c index d24daf6a41..beaeec0687 100644 --- a/target/i386/hvf/x86_task.c +++ b/target/i386/hvf/x86_task.c @@ -8,7 +8,6 @@ // GNU General Public License for more details. #include "qemu/osdep.h" #include "panic.h" -#include "qemu-common.h" #include "qemu/error-report.h" =20 #include "sysemu/hvf.h" diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index bec9fc5814..69d4fb8cf5 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -19,7 +19,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "x86hvf.h" #include "vmx.h" #include "vmcs.h" diff --git a/target/i386/kvm/sev-stub.c b/target/i386/kvm/sev-stub.c index 6080c007a2..1be5341e8a 100644 --- a/target/i386/kvm/sev-stub.c +++ b/target/i386/kvm/sev-stub.c @@ -12,7 +12,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "sev.h" =20 int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index 9f94041331..b75738ee9c 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -11,7 +11,6 @@ #include "cpu.h" #include "exec/address-spaces.h" #include "exec/ioport.h" -#include "qemu-common.h" #include "qemu/accel.h" #include "sysemu/nvmm.h" #include "sysemu/cpus.h" diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 68a4ebe909..5560a22ea5 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -12,7 +12,6 @@ #include "cpu.h" #include "exec/address-spaces.h" #include "exec/ioport.h" -#include "qemu-common.h" #include "qemu/accel.h" #include "sysemu/whpx.h" #include "sysemu/cpus.h" diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index bba36f3ec9..c15df35ad6 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -11,7 +11,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic-msidef.h" diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 086debd9f0..caf70decd2 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -14,7 +14,6 @@ =20 #include =20 -#include "qemu-common.h" #include "cpu.h" #include "internal.h" #include "qemu/error-report.h" diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index 3decf6924c..ec88474a73 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -28,7 +28,6 @@ #if defined(CONFIG_USER_ONLY) #include "qemu.h" #else -#include "qemu-common.h" #include "exec/softmmu-semi.h" #endif #include "qemu/log.h" diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8644b85de8..f905a2af17 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -21,7 +21,6 @@ =20 #include =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "cpu.h" diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index e6b7cb6d4d..70b4cff06f 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -21,7 +21,6 @@ =20 #include =20 -#include "qemu-common.h" #include "qemu/timer.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 25a4aa2976..fb30080ac4 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -20,7 +20,6 @@ #include "qemu/qemu-print.h" #include "qapi/error.h" #include "cpu.h" -#include "qemu-common.h" #include "migration/vmstate.h" #include "exec/exec-all.h" #include "hw/loader.h" diff --git a/target/rx/gdbstub.c b/target/rx/gdbstub.c index c811d4810b..7eb2059a84 100644 --- a/target/rx/gdbstub.c +++ b/target/rx/gdbstub.c @@ -16,7 +16,6 @@ * this program. If not, see . */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "exec/gdbstub.h" =20 diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 6acf14d5ec..53098bf541 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -24,7 +24,6 @@ #include #include =20 -#include "qemu-common.h" #include "cpu.h" #include "s390x-internal.h" #include "kvm_s390x.h" diff --git a/target/s390x/tcg/vec_fpu_helper.c b/target/s390x/tcg/vec_fpu_h= elper.c index 1a77993471..aa2cc8e4a6 100644 --- a/target/s390x/tcg/vec_fpu_helper.c +++ b/target/s390x/tcg/vec_fpu_helper.c @@ -10,7 +10,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "s390x-internal.h" #include "vec.h" diff --git a/target/s390x/tcg/vec_int_helper.c b/target/s390x/tcg/vec_int_h= elper.c index 5561b3ed90..b44859ee16 100644 --- a/target/s390x/tcg/vec_int_helper.c +++ b/target/s390x/tcg/vec_int_helper.c @@ -10,7 +10,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "vec.h" #include "exec/helper-proto.h" diff --git a/target/s390x/tcg/vec_string_helper.c b/target/s390x/tcg/vec_st= ring_helper.c index ac315eb095..f8b54bba4a 100644 --- a/target/s390x/tcg/vec_string_helper.c +++ b/target/s390x/tcg/vec_string_helper.c @@ -10,7 +10,6 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "s390x-internal.h" #include "vec.h" diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c index 3ce55abb8e..ebf32defde 100644 --- a/target/tricore/gdbstub.c +++ b/target/tricore/gdbstub.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "exec/gdbstub.h" =20 =20 diff --git a/target/xtensa/core-de233_fpu.c b/target/xtensa/core-de233_fpu.c index c7cbeb1b48..41af8057fb 100644 --- a/target/xtensa/core-de233_fpu.c +++ b/target/xtensa/core-de233_fpu.c @@ -28,7 +28,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "qemu-common.h" #include "qemu/host-utils.h" =20 #include "core-de233_fpu/core-isa.h" diff --git a/target/xtensa/core-dsp3400.c b/target/xtensa/core-dsp3400.c index 4e0bc8a8c4..81e425c568 100644 --- a/target/xtensa/core-dsp3400.c +++ b/target/xtensa/core-dsp3400.c @@ -28,7 +28,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "qemu-common.h" #include "qemu/host-utils.h" =20 #include "core-dsp3400/core-isa.h" diff --git a/target/xtensa/core-test_mmuhifi_c3.c b/target/xtensa/core-test= _mmuhifi_c3.c index 123c630b0d..c0e5d32d1e 100644 --- a/target/xtensa/core-test_mmuhifi_c3.c +++ b/target/xtensa/core-test_mmuhifi_c3.c @@ -28,7 +28,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "qemu-common.h" #include "qemu/host-utils.h" =20 #include "core-test_mmuhifi_c3/core-isa.h" diff --git a/target/xtensa/import_core.sh b/target/xtensa/import_core.sh index df66d09393..b4c15556c2 100755 --- a/target/xtensa/import_core.sh +++ b/target/xtensa/import_core.sh @@ -42,7 +42,6 @@ cat < "${TARGET}.c" #include "qemu/osdep.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "qemu-common.h" #include "qemu/host-utils.h" =20 #include "core-$NAME/core-isa.h" diff --git a/tcg/tci.c b/tcg/tci.c index fe92b5d084..bdfac83492 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "tcg/tcg.h" /* MAX_OPC_PARAM_IARGS */ #include "exec/cpu_ldst.h" #include "tcg/tcg-op.h" diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c index 766c48e3a6..673fc97586 100644 --- a/tests/qtest/acpi-utils.c +++ b/tests/qtest/acpi-utils.c @@ -14,7 +14,6 @@ =20 #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "qemu/bitmap.h" #include "acpi-utils.h" #include "boot-sector.h" diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 8073ccc205..aff5f3f797 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -30,7 +30,6 @@ #include "libqos/ahci.h" #include "libqos/pci-pc.h" =20 -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qemu/host-utils.h" =20 diff --git a/tests/qtest/aspeed_hace-test.c b/tests/qtest/aspeed_hace-test.c index 09ee31545e..58aa22014d 100644 --- a/tests/qtest/aspeed_hace-test.c +++ b/tests/qtest/aspeed_hace-test.c @@ -8,7 +8,6 @@ #include "qemu/osdep.h" =20 #include "libqos/libqtest.h" -#include "qemu-common.h" #include "qemu/bitops.h" =20 #define HACE_CMD 0x10 diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index c4a2d1e166..5dddedabcd 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -57,7 +57,6 @@ =20 #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "hw/firmware/smbios.h" #include "qemu/bitmap.h" #include "acpi-utils.h" diff --git a/tests/qtest/boot-sector.c b/tests/qtest/boot-sector.c index ea8f264661..9d9825bc81 100644 --- a/tests/qtest/boot-sector.c +++ b/tests/qtest/boot-sector.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" #include "boot-sector.h" -#include "qemu-common.h" #include "libqos/libqtest.h" =20 #define LOW(x) ((x) & 0xff) diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index a1c689414b..7f5dd5f85a 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -9,7 +9,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-tes= t.c index 43c77aff04..81043162df 100644 --- a/tests/qtest/dbus-display-test.c +++ b/tests/qtest/dbus-display-test.c @@ -3,7 +3,6 @@ #include #include #include "libqos/libqtest.h" -#include "qemu-common.h" #include "dbus-display1.h" =20 static GDBusConnection* diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-tes= t.c index aca9b98b7a..a8acab763f 100644 --- a/tests/qtest/dbus-vmstate-test.c +++ b/tests/qtest/dbus-vmstate-test.c @@ -2,7 +2,6 @@ #include #include #include "libqos/libqtest.h" -#include "qemu-common.h" #include "dbus-vmstate1.h" #include "migration-helpers.h" =20 diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index bbec166dbc..adf39b2518 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c index e648fdd409..ddd6983ede 100644 --- a/tests/qtest/e1000e-test.c +++ b/tests/qtest/e1000e-test.c @@ -25,9 +25,7 @@ =20 =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqtest-single.h" -#include "qemu-common.h" #include "libqos/pci-pc.h" #include "qemu/sockets.h" #include "qemu/iov.h" diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c index f94cd8dd8e..a0adc35bef 100644 --- a/tests/qtest/erst-test.c +++ b/tests/qtest/erst-test.c @@ -11,7 +11,6 @@ #include #include "libqos/libqos-pc.h" #include "libqos/libqtest.h" -#include "qemu-common.h" =20 #include "hw/pci/pci.h" =20 diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index b0d40012e6..4aa72f3643 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -27,7 +27,6 @@ =20 #include "libqtest-single.h" #include "qapi/qmp/qdict.h" -#include "qemu-common.h" =20 /* TODO actually test the results and get rid of this */ #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index 7a244c951e..dc891d838b 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qemu-common.h" #include "exec/memory.h" #include "qemu/main-loop.h" =20 diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 64023c0574..da9c4c2792 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -16,7 +16,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/bswap.h" #include "qapi/qmp/qlist.h" #include "libqos/libqtest.h" diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 19de3b4104..b7243a17b1 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -30,7 +30,6 @@ #include "libqos/pci-pc.h" #include "libqos/malloc-pc.h" #include "qapi/qmp/qdict.h" -#include "qemu-common.h" #include "qemu/bswap.h" #include "hw/pci/pci_ids.h" #include "hw/pci/pci_regs.h" diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c index 19612e9405..ed431e34e6 100644 --- a/tests/qtest/ipmi-bt-test.c +++ b/tests/qtest/ipmi-bt-test.c @@ -31,7 +31,6 @@ =20 =20 #include "libqtest-single.h" -#include "qemu-common.h" =20 #define IPMI_IRQ 5 =20 diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 4e8af42a9d..95628a4185 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -14,7 +14,6 @@ #include "libqos/libqos-pc.h" #include "libqos/libqos-spapr.h" #include "libqos/libqtest.h" -#include "qemu-common.h" =20 #define TMPSHMSIZE (1 << 20) static char *tmpshm; diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c index eaa2096512..41c4be5efa 100644 --- a/tests/qtest/libqos/ahci.c +++ b/tests/qtest/libqos/ahci.c @@ -28,7 +28,6 @@ #include "ahci.h" #include "pci-pc.h" =20 -#include "qemu-common.h" #include "qemu/host-utils.h" =20 #include "hw/pci/pci_ids.h" diff --git a/tests/qtest/libqos/malloc-pc.c b/tests/qtest/libqos/malloc-pc.c index f1e3b392a5..bbd1b4827e 100644 --- a/tests/qtest/libqos/malloc-pc.c +++ b/tests/qtest/libqos/malloc-pc.c @@ -16,8 +16,6 @@ =20 #include "standard-headers/linux/qemu_fw_cfg.h" =20 -#include "qemu-common.h" - #define ALLOC_PAGE_SIZE (4096) =20 void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags) diff --git a/tests/qtest/libqos/malloc-spapr.c b/tests/qtest/libqos/malloc-= spapr.c index 05b306c191..d90ed3c51d 100644 --- a/tests/qtest/libqos/malloc-spapr.c +++ b/tests/qtest/libqos/malloc-spapr.c @@ -8,8 +8,6 @@ #include "qemu/osdep.h" #include "malloc-spapr.h" =20 -#include "qemu-common.h" - #define SPAPR_PAGE_SIZE 4096 =20 /* Memory must be a multiple of 256 MB, diff --git a/tests/qtest/libqos/malloc.c b/tests/qtest/libqos/malloc.c index f708b01432..f0c8f950c8 100644 --- a/tests/qtest/libqos/malloc.c +++ b/tests/qtest/libqos/malloc.c @@ -12,7 +12,6 @@ =20 #include "qemu/osdep.h" #include "malloc.h" -#include "qemu-common.h" #include "qemu/host-utils.h" =20 typedef struct MemBlock { diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index dc5566ccfd..7b5890dcc4 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -21,7 +21,6 @@ #include =20 #include "libqos/libqtest.h" -#include "qemu-common.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qapi/error.h" diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-tes= t.c index 138101b46a..8ca18074b9 100644 --- a/tests/qtest/machine-none-test.c +++ b/tests/qtest/machine-none-test.c @@ -12,7 +12,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qemu/cutils.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c index 7c435ac915..a353fef0ca 100644 --- a/tests/qtest/npcm7xx_emc-test.c +++ b/tests/qtest/npcm7xx_emc-test.c @@ -15,7 +15,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqos.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c index 32bbae33c5..3cb47d2c54 100644 --- a/tests/qtest/pxe-test.c +++ b/tests/qtest/pxe-test.c @@ -14,7 +14,6 @@ =20 #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "libqos/libqtest.h" #include "boot-sector.h" #include "libqos/libqos-spapr.h" diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c index eb34af843b..6b162e12b5 100644 --- a/tests/qtest/qom-test.c +++ b/tests/qtest/qom-test.c @@ -9,7 +9,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qemu/cutils.h" diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c index 4506049264..8fa3313cc3 100644 --- a/tests/qtest/rtl8139-test.c +++ b/tests/qtest/rtl8139-test.c @@ -11,7 +11,6 @@ #include "libqtest-single.h" #include "libqos/pci-pc.h" #include "qemu/timer.h" -#include "qemu-common.h" =20 /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mir= ror.c index da4f94de72..fdf66cebd6 100644 --- a/tests/qtest/test-filter-mirror.c +++ b/tests/qtest/test-filter-mirror.c @@ -9,7 +9,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter= -redirector.c index fc16cf7e8d..339d3c04ce 100644 --- a/tests/qtest/test-filter-redirector.c +++ b/tests/qtest/test-filter-redirector.c @@ -51,7 +51,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" diff --git a/tests/qtest/test-x86-cpuid-compat.c b/tests/qtest/test-x86-cpu= id-compat.c index 39138db774..b39c9055b3 100644 --- a/tests/qtest/test-x86-cpuid-compat.c +++ b/tests/qtest/test-x86-cpuid-compat.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c index a71395849f..fc9f2b9498 100644 --- a/tests/qtest/virtio-net-test.c +++ b/tests/qtest/virtio-net-test.c @@ -8,7 +8,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqtest-single.h" #include "qemu/iov.h" #include "qemu/module.h" diff --git a/tests/unit/check-qjson.c b/tests/unit/check-qjson.c index c845f91d43..c4e0f851bf 100644 --- a/tests/unit/check-qjson.c +++ b/tests/unit/check-qjson.c @@ -21,7 +21,6 @@ #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qemu/unicode.h" -#include "qemu-common.h" =20 static QString *from_json_str(const char *jstr, bool single, Error **errp) { diff --git a/tests/unit/check-qnull.c b/tests/unit/check-qnull.c index ebf21db83c..5ceacc65d7 100644 --- a/tests/unit/check-qnull.c +++ b/tests/unit/check-qnull.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" =20 #include "qapi/qmp/qnull.h" -#include "qemu-common.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include "qapi/error.h" diff --git a/tests/unit/check-qnum.c b/tests/unit/check-qnum.c index b85fca2302..bf7fe45bac 100644 --- a/tests/unit/check-qnum.c +++ b/tests/unit/check-qnum.c @@ -15,7 +15,6 @@ #include "qemu/osdep.h" =20 #include "qapi/qmp/qnum.h" -#include "qemu-common.h" =20 /* * Public Interface test-cases diff --git a/tests/unit/check-qobject.c b/tests/unit/check-qobject.c index 7903ebf4cf..0ed094e55f 100644 --- a/tests/unit/check-qobject.c +++ b/tests/unit/check-qobject.c @@ -15,7 +15,6 @@ #include "qapi/qmp/qnull.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" -#include "qemu-common.h" =20 #include =20 diff --git a/tests/unit/check-qstring.c b/tests/unit/check-qstring.c index 4bf9772093..bd861f4f8b 100644 --- a/tests/unit/check-qstring.c +++ b/tests/unit/check-qstring.c @@ -12,7 +12,6 @@ #include "qemu/osdep.h" =20 #include "qapi/qmp/qstring.h" -#include "qemu-common.h" =20 /* * Public Interface test-cases diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c index ef31664d02..0a9e090a68 100644 --- a/tests/unit/socket-helpers.c +++ b/tests/unit/socket-helpers.c @@ -19,7 +19,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/sockets.h" #include "socket-helpers.h" =20 diff --git a/tests/unit/test-clone-visitor.c b/tests/unit/test-clone-visito= r.c index 5d48e125b8..ce67585305 100644 --- a/tests/unit/test-clone-visitor.c +++ b/tests/unit/test-clone-visitor.c @@ -9,7 +9,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/clone-visitor.h" #include "test-qapi-visit.h" =20 diff --git a/tests/unit/test-forward-visitor.c b/tests/unit/test-forward-vi= sitor.c index 348f7e4e81..01de155227 100644 --- a/tests/unit/test-forward-visitor.c +++ b/tests/unit/test-forward-visitor.c @@ -9,7 +9,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/forward-visitor.h" #include "qapi/qobject-input-visitor.h" #include "qapi/error.h" diff --git a/tests/unit/test-iov.c b/tests/unit/test-iov.c index 5371066fb6..0d2ba9ba87 100644 --- a/tests/unit/test-iov.c +++ b/tests/unit/test-iov.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" =20 diff --git a/tests/unit/test-logging.c b/tests/unit/test-logging.c index ccb819f193..05703a4e51 100644 --- a/tests/unit/test-logging.c +++ b/tests/unit/test-logging.c @@ -27,7 +27,6 @@ #include "qemu/osdep.h" #include =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/log.h" =20 diff --git a/tests/unit/test-qmp-event.c b/tests/unit/test-qmp-event.c index d58c3b78f2..7d961d716a 100644 --- a/tests/unit/test-qmp-event.c +++ b/tests/unit/test-qmp-event.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/qbool.h" diff --git a/tests/unit/test-qobject-input-visitor.c b/tests/unit/test-qobj= ect-input-visitor.c index 22538f8140..aed08eaebc 100644 --- a/tests/unit/test-qobject-input-visitor.c +++ b/tests/unit/test-qobject-input-visitor.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qapi/qapi-visit-introspect.h" #include "qapi/qobject-input-visitor.h" diff --git a/tests/unit/test-qobject-output-visitor.c b/tests/unit/test-qob= ject-output-visitor.c index 6af4c33eec..66b27fad66 100644 --- a/tests/unit/test-qobject-output-visitor.c +++ b/tests/unit/test-qobject-output-visitor.c @@ -12,7 +12,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qapi/qobject-output-visitor.h" #include "test-qapi-visit.h" diff --git a/tests/unit/test-string-input-visitor.c b/tests/unit/test-strin= g-input-visitor.c index 249faafc9d..25094d3ffc 100644 --- a/tests/unit/test-string-input-visitor.c +++ b/tests/unit/test-string-input-visitor.c @@ -12,7 +12,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qapi/string-input-visitor.h" #include "test-qapi-visit.h" diff --git a/tests/unit/test-string-output-visitor.c b/tests/unit/test-stri= ng-output-visitor.c index e2bedc5c7c..7ef305361e 100644 --- a/tests/unit/test-string-output-visitor.c +++ b/tests/unit/test-string-output-visitor.c @@ -12,7 +12,6 @@ =20 #include "qemu/osdep.h" =20 -#include "qemu-common.h" #include "qapi/error.h" #include "qapi/string-output-visitor.h" #include "test-qapi-visit.h" diff --git a/tests/unit/test-thread-pool.c b/tests/unit/test-thread-pool.c index 70dc6314a1..6020e65d69 100644 --- a/tests/unit/test-thread-pool.c +++ b/tests/unit/test-thread-pool.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "block/aio.h" #include "block/thread-pool.h" #include "block/block.h" diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index 896247e3ed..63909ccb2b 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -19,7 +19,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/sockets.h" #include "qapi/error.h" #include "socket-helpers.h" diff --git a/tests/unit/test-visitor-serialization.c b/tests/unit/test-visi= tor-serialization.c index 4629958647..907263d030 100644 --- a/tests/unit/test-visitor-serialization.c +++ b/tests/unit/test-visitor-serialization.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include =20 -#include "qemu-common.h" #include "test-qapi-visit.h" #include "qapi/error.h" #include "qapi/qmp/qjson.h" diff --git a/tests/unit/test-xbzrle.c b/tests/unit/test-xbzrle.c index 795d6f1cba..ef951b6e54 100644 --- a/tests/unit/test-xbzrle.c +++ b/tests/unit/test-xbzrle.c @@ -11,7 +11,6 @@ * */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "../migration/xbzrle.h" =20 diff --git a/ui/gtk-clipboard.c b/ui/gtk-clipboard.c index d58fd761ab..8d8a636fd1 100644 --- a/ui/gtk-clipboard.c +++ b/ui/gtk-clipboard.c @@ -19,7 +19,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/main-loop.h" =20 #include "ui/gtk.h" diff --git a/ui/keymaps.c b/ui/keymaps.c index d4a647464b..6ceaa97085 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/datadir.h" #include "keymaps.h" #include "trace.h" diff --git a/ui/vdagent.c b/ui/vdagent.c index 02861edfb1..aa6167f0b4 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -1,6 +1,5 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "include/qemu-common.h" #include "chardev/char.h" #include "qemu/buffer.h" #include "qemu/option.h" diff --git a/ui/vnc-clipboard.c b/ui/vnc-clipboard.c index d48f75eb1a..8aeadfaa21 100644 --- a/ui/vnc-clipboard.c +++ b/ui/vnc-clipboard.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "vnc.h" #include "vnc-jobs.h" =20 diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 7b86a4713d..5a4b8a4fc0 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -34,7 +34,7 @@ =20 #ifdef CONFIG_VNC_PNG /* The following define is needed by pngconf.h. Otherwise it won't compile, - because setjmp.h was already included by qemu-common.h. */ + because setjmp.h was already included by osdep.h. */ #define PNG_SKIP_SETJMP_CHECK #include #endif diff --git a/ui/vnc.c b/ui/vnc.c index 5cbeebb8d1..6261d92295 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -25,7 +25,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "vnc.h" #include "vnc-jobs.h" #include "trace.h" diff --git a/util/aio-win32.c b/util/aio-win32.c index 7aac89df3a..44003d645e 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -16,7 +16,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "block/block.h" #include "qemu/main-loop.h" #include "qemu/queue.h" diff --git a/util/coroutine-sigaltstack.c b/util/coroutine-sigaltstack.c index e99b8a4f9c..e2690c5f41 100644 --- a/util/coroutine-sigaltstack.c +++ b/util/coroutine-sigaltstack.c @@ -27,7 +27,6 @@ #endif #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "qemu/coroutine_int.h" =20 #ifdef CONFIG_SAFESTACK diff --git a/util/coroutine-win32.c b/util/coroutine-win32.c index de6bd4fd3e..c196f956d2 100644 --- a/util/coroutine-win32.c +++ b/util/coroutine-win32.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/coroutine_int.h" =20 typedef struct diff --git a/util/cutils.c b/util/cutils.c index aaf2ced291..a01a3a7540 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -26,7 +26,6 @@ #include "qemu/host-utils.h" #include =20 -#include "qemu-common.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/error-report.h" diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 16294e98d4..8dc30c5141 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/event_notifier.h" #include "qemu/main-loop.h" diff --git a/util/event_notifier-win32.c b/util/event_notifier-win32.c index 62c53b0a99..9352da4699 100644 --- a/util/event_notifier-win32.c +++ b/util/event_notifier-win32.c @@ -11,7 +11,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/event_notifier.h" #include "qemu/main-loop.h" =20 diff --git a/util/iov.c b/util/iov.c index 58c7b3eeee..22d6996cce 100644 --- a/util/iov.c +++ b/util/iov.c @@ -17,7 +17,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" #include "qemu/cutils.h" diff --git a/util/osdep.c b/util/osdep.c index 97dc9bc65b..1ea2398686 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index a069dbff69..c471c5bc9f 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -31,7 +31,6 @@ =20 #include =20 -#include "qemu-common.h" #include "sysemu/sysemu.h" #include "trace.h" #include "qapi/error.h" diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 3555b02350..f38b06914e 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -32,7 +32,6 @@ =20 #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "qapi/error.h" #include "qemu/main-loop.h" #include "trace.h" diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c index 7f5839cb76..d791932d63 100644 --- a/util/qemu-coroutine-io.c +++ b/util/qemu-coroutine-io.c @@ -23,7 +23,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/sockets.h" #include "qemu/coroutine.h" #include "qemu/iov.h" diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index e8f45a7d30..13b5b197f9 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -21,7 +21,6 @@ #include #endif /* CONFIG_AF_VSOCK */ =20 -#include "qemu-common.h" #include "monitor/monitor.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 52eb19f351..a2d5a6e825 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -12,7 +12,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" #include "qemu-thread-common.h" --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351578537184.67346663685157; Mon, 18 Apr 2022 23:59:38 -0700 (PDT) Received: from localhost ([::1]:55736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghpp-0008Jg-8x for importer@patchew.org; Tue, 19 Apr 2022 02:59:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmC-0001Dk-E3 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:49 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:34571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmA-0004TQ-Qd for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:48 -0400 Received: by mail-wr1-x42b.google.com with SMTP id c10so20948018wrb.1 for ; Mon, 18 Apr 2022 22:51:46 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kl8IX74OTo7GTTHk6BNrBLGVZ9mjRMnlGcuPcCqJOOo=; b=SOKPoivQBGZZlq24qX6jacXx+0wtIA106ltjOd3tBB2fMkxD56GO1dzWGSbRiuRqsa uV26ANaH7CIN1KtXfe8BxCXqflDtLdroCKbKFXUvU/2tUwzxw/q6sc1VbYNk21KqcHjT 9uf+1v7b1ive85Pmi9hc+qSo5FRbLoke8WEOMkBI42t0UNPLos3b0b/st5FCpLW5ZLyf 1Er2L+KaDTwpd/n1NRjLYJCwys1DbBQDxEvuwsn5Ey+TF0DAGprjyV8Z3hziDPODULC+ L34lPcnYTkZViwxVWTG4eabEjSWhe054yrlYlRRVYXS0qP1bvbMTSLAT6+r+iR8S/xZ/ oG3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Kl8IX74OTo7GTTHk6BNrBLGVZ9mjRMnlGcuPcCqJOOo=; b=Wq6sSn2wBt28dKinhGcidCgP5DoZCkmFDh4PHwvLVIAONHbORkJECu+NuvgzDHpnic N5EGqSPdqUVFuf4Ri8wnKrRoK0vEDva91QF9V7IDngG41UdHiBUgOYN3TiGNGwt94sQV 3brNAbEHwpOTmznE7YbJLFvvlIPW8asGxsSI9RnJLdkmc7+2y7GajKO4RI4rUfrqFp71 z4GkS1JNBg0oDl6xY9LiKD7bcx2oX2jUTuXdlxhJRWz9ICbODguXvJ1d7bJXY26eSLUC gHFbrXxSFAXaQ1gadtkx/TnHjYMM2xJmKBrk/ZJ+xYWYVPrTourJEliiFqHBzlL+GyyE FZZw== X-Gm-Message-State: AOAM530Vml7qhXEAbnLicp7sCqSct7iJQ3YmGRgqWgfJ+2wHJpmdvpOu BYgj+USd1aSvrzJRcnxCWFFU1gDS1Qh9kA== X-Google-Smtp-Source: ABdhPJzEjItD6bewZSs5nOP5fDSmicT07NyeNyMj41fcKSUnPI2CRTMyQgWFFdn6kMuOEtKuvzn8+w== X-Received: by 2002:a05:6000:2ac:b0:20a:7732:4bb6 with SMTP id l12-20020a05600002ac00b0020a77324bb6mr10760102wry.538.1650347505327; Mon, 18 Apr 2022 22:51:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 37/53] build-sys: drop ntddscsi.h check Date: Tue, 19 Apr 2022 07:50:53 +0200 Message-Id: <20220419055109.142788-38-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Konstantin Kostiuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351579813100001 From: Marc-Andr=C3=A9 Lureau The header has been part of MinGW-w64 since the introduction of the project (2007). While on MinGW(32), the legacy project, it was imported in 2014 from w32api-3.17 (commit e4803e0da2). According to build-platform.rst and our CI coverage, we only support building with MinGW-w64 (from Debian/Fedora). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Konstantin Kostiuk Message-Id: <20220401085106.2167374-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 17 ----------------- qga/commands-win32.c | 19 ------------------- qga/meson.build | 6 ++---- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/meson.build b/meson.build index a0b6de255c..d92b633c5d 100644 --- a/meson.build +++ b/meson.build @@ -2019,22 +2019,6 @@ if targetos =3D=3D 'windows' and link_language =3D= =3D 'cpp' endif config_host_data.set('HAVE_VSS_SDK', have_vss_sdk) =20 -have_ntddscsi =3D false -if targetos =3D=3D 'windows' - have_ntddscsi =3D cc.compiles(''' - #include - #include - int main(void) { - #if !defined(IOCTL_SCSI_GET_ADDRESS) - #error Missing required ioctl definitions - #endif - SCSI_ADDRESS addr =3D { .Lun =3D 0, .TargetId =3D 0, .PathId =3D 0 }; - return addr.Lun; - } -''') -endif -config_host_data.set('HAVE_NTDDSCSI', have_ntddscsi) - ignored =3D ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target 'HAVE_GDB_BIN'] arrays =3D ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] @@ -3722,7 +3706,6 @@ summary_info +=3D {'libnfs support': libnfs} if targetos =3D=3D 'windows' if have_ga summary_info +=3D {'QGA VSS support': have_qga_vss} - summary_info +=3D {'QGA w32 disk info': have_ntddscsi} endif endif summary_info +=3D {'seccomp support': seccomp} diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 15b451f0a4..406e4072a0 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -18,10 +18,8 @@ #include #include #include -#ifdef HAVE_NTDDSCSI #include #include -#endif #include #include #include @@ -474,8 +472,6 @@ void qmp_guest_file_flush(int64_t handle, Error **errp) } } =20 -#ifdef HAVE_NTDDSCSI - static GuestDiskBusType win2qemu[] =3D { [BusTypeUnknown] =3D GUEST_DISK_BUS_TYPE_UNKNOWN, [BusTypeScsi] =3D GUEST_DISK_BUS_TYPE_SCSI, @@ -1098,21 +1094,6 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp) return ret; } =20 -#else - -static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **err= p) -{ - return NULL; -} - -GuestDiskInfoList *qmp_guest_get_disks(Error **errp) -{ - error_setg(errp, QERR_UNSUPPORTED); - return NULL; -} - -#endif /* HAVE_NTDDSCSI */ - static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) { DWORD info_size; diff --git a/qga/meson.build b/qga/meson.build index 62472747f1..392d560941 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -83,14 +83,12 @@ qga_ss =3D qga_ss.apply(config_host, strict: false) gen_tlb =3D [] qga_libs =3D [] if targetos =3D=3D 'windows' - qga_libs +=3D ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwin= inet', '-liphlpapi', '-lnetapi32'] + qga_libs +=3D ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwin= inet', '-liphlpapi', '-lnetapi32', + '-lsetupapi', '-lcfgmgr32'] if have_qga_vss qga_libs +=3D ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,= --enable-stdcall-fixup'] subdir('vss-win32') endif - if have_ntddscsi - qga_libs +=3D ['-lsetupapi', '-lcfgmgr32'] - endif endif =20 qga =3D executable('qemu-ga', qga_ss.sources(), --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352204354940.4194620822274; Tue, 19 Apr 2022 00:10:04 -0700 (PDT) Received: from localhost ([::1]:36112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghzv-0006FK-6A for importer@patchew.org; Tue, 19 Apr 2022 03:10:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmD-0001EZ-Tl for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:51 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:53880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmB-0004Tv-7F for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:49 -0400 Received: by mail-wm1-x32d.google.com with SMTP id p189so9922917wmp.3 for ; Mon, 18 Apr 2022 22:51:46 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WwK/2gOP+61Tv+uwzts7jYNsI4UO+BQb+MGUHQsXc0s=; b=cKx93KUs5DfmcOgt1P48ghfkm89U4g9qrqun8wJz6xbr82OUau2wKYWRLNfwku/BZK zYDJPdZE5Bjq3hIExd+OoTGj3AnFYLQopRfsjjZNuglWomw2RGOSlFSnPqrL/7Noj/Kv QS/l8ug/oNvmRCn9CNKzGrwkTtO+MTi7GENCCcS7WxsVcFm7Gx9wHufW5/GMSaw5H0OM hBWKCV6rr7dGPtcajx2J1f+6qXs+UefeD1hih3XIyGuWpBoZOT201zijMGGTNqcajNmv 3R++e/EFEgUIyjuQMxz1lc4LUZjcLYZlXc30pupUqbkLqyxeeRDA8nhW3vEqpSKfZ/nI o7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WwK/2gOP+61Tv+uwzts7jYNsI4UO+BQb+MGUHQsXc0s=; b=JvB9x5lzTxpHh+hgzwJ4IWZU3uV00jZTrW4MvEFnRG+t32hAUHuf07oSC6PyfEgzwX 7DZpL37TvlnwdYLcBf+CO35VVSvMvl2gazjC1HOz04m3mXcuLXdVeFrAP6ZSYFkeStSw O0uvenPcCJiR8SVs/UGjG0wYS8FdoWqCvMlDkTgc9wtiZXIjYPzfVfEj2nplojKbntvk YRAt163+CequraABc2tGsG5rR9lGKecIkSSw4CfTb/QapVM6Nns37RWAOrBjcxMCeRB9 OuFVqTjqNPB9jy6V9jdo2AM7CqTeBCEYig3sn2pDOnwTLuJf2xfXbpQAjYWmfSBgsGhd JNNw== X-Gm-Message-State: AOAM530I/9lxwy9q3Cu3yZx5z8ZSSxOWFrzoBoZ1uCUaCHDUPH4V54tE A8EWpKLRzcSnXUGkloFEajck9a+k59qvdg== X-Google-Smtp-Source: ABdhPJwoA08LGLrwi3sgoDKx8S9KePwdd5q9pMP67YM9zmpeAXm5wqfTEAw1NJsPpGvUp/MH4Io+mA== X-Received: by 2002:a05:600c:3543:b0:38e:bc4d:1d11 with SMTP id i3-20020a05600c354300b0038ebc4d1d11mr18229467wmq.137.1650347505931; Mon, 18 Apr 2022 22:51:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 38/53] build-sys: simplify AF_VSOCK check Date: Tue, 19 Apr 2022 07:50:54 +0200 Message-Id: <20220419055109.142788-39-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::32d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352205212100001 From: Marc-Andr=C3=A9 Lureau The current test checks more than AF_VSOCK availability, and doesn't need to be that long. Since its introduction in Linux in 2013, AF_VSOCK came with linux/vm_sockets.h for sockaddr_vm, let's check that. We could even go back to the initial configure-less approach proposed by Stefan Hajnoczi, since Michael Roth added the configure-time check back then to satisfy glibc in Ubuntu 14. See: https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg08208.html Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20220401115005.2204000-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index d92b633c5d..5a207ed0fb 100644 --- a/meson.build +++ b/meson.build @@ -1988,25 +1988,10 @@ have_afalg =3D get_option('crypto_afalg') \ '''), error_message: 'AF_ALG requested but could not be detected').allow= ed() config_host_data.set('CONFIG_AF_ALG', have_afalg) =20 -config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' - #include - #include - #include - #if !defined(AF_VSOCK) - # error missing AF_VSOCK flag - #endif - #include - int main(void) { - int sock, ret; - struct sockaddr_vm svm; - socklen_t len =3D sizeof(svm); - sock =3D socket(AF_VSOCK, SOCK_STREAM, 0); - ret =3D getpeername(sock, (struct sockaddr *)&svm, &len); - if ((ret =3D=3D -1) && (errno =3D=3D ENOTCONN)) { - return 0; - } - return -1; - }''')) +config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol( + 'linux/vm_sockets.h', 'AF_VSOCK', + prefix: '#include ', +)) =20 have_vss =3D false have_vss_sdk =3D false # old xp/2003 SDK --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650350742519574.1915015370492; Mon, 18 Apr 2022 23:45:42 -0700 (PDT) Received: from localhost ([::1]:37894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghcK-0004C9-RO for importer@patchew.org; Tue, 19 Apr 2022 02:45:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmH-0001FQ-19 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmC-0004Us-Im for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: by mail-wr1-x42b.google.com with SMTP id u3so20942135wrg.3 for ; Mon, 18 Apr 2022 22:51:48 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=27xdJaPz4NvX98ZpHETWjtvAmSpQNFYyyaWuEI4zDqg=; b=WJbXhPIwBpe+nxvo26fId0oZ3ms0UtS9QGiHnjA7k8UhbgQ0Ox2I1mFtVxzkAw2rR6 emg5AVKj5o+/bNTyz3Q97CNn+Av5Q7Gpf31fo60EtgvcR/wzUyAHPR1KVSFofb1K9c5a MkeGQtG5aR4It16Dd65yTxyu/7rjKD4oJ5HQqZs0N9kTWhvEUNQjD6P63u4r6dDyFZjy CGfW4u5alaFbOhzMC+v5hlIcMKHGca0Xzo74cDEJcYtTXJqe42AraJ8QQQI1YmpYFxAa JhwJLzZDO0meBZhau9Ceaj0gTdcdadCz5Yt8QkNQFPj3fVcYz/IOz/18wWj6/il+j0+T as9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=27xdJaPz4NvX98ZpHETWjtvAmSpQNFYyyaWuEI4zDqg=; b=7Tn5YcPOXD0x22cp7kfKhIdYOPKupfL2+GwGVGCkYO2zmgTvpgT4pcIW40JvYfjROr M2lBwV1cUPfS80ude9A3wC0tvVEdlfAyg8C4eZPmm9bfVM3ArelOvJt2tvEGcHadZ3hF BHmQaZKYoqIYYMFrVHQd8ddJ5y7DS/0jimyDyG2NwYy9VN4LKvBU8WKYZE2NZuvYJ56L 2dKbv0/COZ5u7lRzKZ1JVym8W948nVM4SZa8o9B71UFkU+tN6fSdEFShg1DTfLMD7mNv l8mv1AKSFPjYzY0myMzIqPSC+IGRbtVtoIB95cRzfuspNw7nhDPgdkXv3Fzs+cQVEwwK eLng== X-Gm-Message-State: AOAM530NyuIcm6bAhckgPuE9QrDo1sN4VwnAlfjMAh7lBYi43ykveekf BnKhj2n0WByfMvHEPYBooiUaZShOSym/xw== X-Google-Smtp-Source: ABdhPJxZd59pKqoFBGZXKnH4eGh1Kd2pEP77rpei8iUDXejuFrck/z4ytaT6ZAzN0UI90VbiroH2WA== X-Received: by 2002:a5d:58ea:0:b0:20a:9874:641b with SMTP id f10-20020a5d58ea000000b0020a9874641bmr5447463wrd.47.1650347506778; Mon, 18 Apr 2022 22:51:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 39/53] whpx: Added support for breakpoints and stepping Date: Tue, 19 Apr 2022 07:50:55 +0200 Message-Id: <20220419055109.142788-40-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain 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::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PP_MIME_FAKE_ASCII_TEXT=0.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Ivan Shcherbakov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650350744197100001 From: Ivan Shcherbakov Below is the updated version of the patch adding debugging support to WHPX. It incorporates feedback from Alex Benn=C3=A9e and Peter Maydell regarding = not changing the emulation logic depending on the gdb connection status. Instead of checking for an active gdb connection to determine whether QEMU should intercept the INT1 exceptions, it now checks whether any breakpoints have been set, or whether gdb has explicitly requested one or more CPUs to do single-stepping. Having none of these condition present now has the same effect as not using gdb at all. Message-Id: <0e7f01d82e9e$00e9c360$02bd4a20$@sysprogs.com> Signed-off-by: Paolo Bonzini --- gdbstub.c | 10 +- include/sysemu/accel-ops.h | 1 + include/sysemu/runstate.h | 8 +- softmmu/cpus.c | 12 +- target/i386/whpx/whpx-accel-ops.c | 1 + target/i386/whpx/whpx-accel-ops.h | 1 + target/i386/whpx/whpx-all.c | 770 +++++++++++++++++++++++++++++- target/i386/whpx/whpx-internal.h | 30 ++ 8 files changed, 815 insertions(+), 18 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 2c804d5066..a3ff8702ce 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -518,7 +518,15 @@ static int gdb_continue_partial(char *newstates) int flag =3D 0; =20 if (!runstate_needs_reset()) { - if (vm_prepare_start()) { + bool step_requested =3D false; + CPU_FOREACH(cpu) { + if (newstates[cpu->cpu_index] =3D=3D 's') { + step_requested =3D true; + break; + } + } + + if (vm_prepare_start(step_requested)) { return 0; } =20 diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index 6013c9444c..a0572ea87a 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -38,6 +38,7 @@ struct AccelOpsClass { void (*synchronize_post_init)(CPUState *cpu); void (*synchronize_state)(CPUState *cpu); void (*synchronize_pre_loadvm)(CPUState *cpu); + void (*synchronize_pre_resume)(bool step_pending); =20 void (*handle_interrupt)(CPUState *cpu, int mask); =20 diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index c3f445dd26..f3ed52548e 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -34,7 +34,13 @@ static inline bool shutdown_caused_by_guest(ShutdownCaus= e cause) } =20 void vm_start(void); -int vm_prepare_start(void); + +/** + * vm_prepare_start: Prepare for starting/resuming the VM + * + * @step_pending: whether any of the CPUs is about to be single-stepped by= gdb + */ +int vm_prepare_start(bool step_pending); int vm_stop(RunState state); int vm_stop_force_state(RunState state); int vm_shutdown(void); diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 668bef9b4d..23b30484b2 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -672,7 +672,7 @@ int vm_stop(RunState state) * Returns -1 if the vCPUs are not to be restarted (e.g. if they are alrea= dy * running or in case of an error condition), 0 otherwise. */ -int vm_prepare_start(void) +int vm_prepare_start(bool step_pending) { RunState requested; =20 @@ -692,6 +692,14 @@ int vm_prepare_start(void) return -1; } =20 + /* + * WHPX accelerator needs to know whether we are going to step + * any CPUs, before starting the first one. + */ + if (cpus_accel->synchronize_pre_resume) { + cpus_accel->synchronize_pre_resume(step_pending); + } + /* We are sending this now, but the CPUs will be resumed shortly later= */ qapi_event_send_resume(); =20 @@ -703,7 +711,7 @@ int vm_prepare_start(void) =20 void vm_start(void) { - if (!vm_prepare_start()) { + if (!vm_prepare_start(false)) { resume_all_vcpus(); } } diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/whpx-acce= l-ops.c index dd2a9f7657..e8dc4b3a47 100644 --- a/target/i386/whpx/whpx-accel-ops.c +++ b/target/i386/whpx/whpx-accel-ops.c @@ -100,6 +100,7 @@ static void whpx_accel_ops_class_init(ObjectClass *oc, = void *data) ops->synchronize_post_init =3D whpx_cpu_synchronize_post_init; ops->synchronize_state =3D whpx_cpu_synchronize_state; ops->synchronize_pre_loadvm =3D whpx_cpu_synchronize_pre_loadvm; + ops->synchronize_pre_resume =3D whpx_cpu_synchronize_pre_resume; } =20 static const TypeInfo whpx_accel_ops_type =3D { diff --git a/target/i386/whpx/whpx-accel-ops.h b/target/i386/whpx/whpx-acce= l-ops.h index 2dee6d61ea..b5102dd1ee 100644 --- a/target/i386/whpx/whpx-accel-ops.h +++ b/target/i386/whpx/whpx-accel-ops.h @@ -21,6 +21,7 @@ void whpx_cpu_synchronize_state(CPUState *cpu); void whpx_cpu_synchronize_post_reset(CPUState *cpu); void whpx_cpu_synchronize_post_init(CPUState *cpu); void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu); +void whpx_cpu_synchronize_pre_resume(bool step_pending); =20 /* state subset only touched by the VCPU itself during runtime */ #define WHPX_SET_RUNTIME_STATE 1 diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 5560a22ea5..b625ad5bbb 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -12,6 +12,7 @@ #include "cpu.h" #include "exec/address-spaces.h" #include "exec/ioport.h" +#include "exec/gdbstub.h" #include "qemu/accel.h" #include "sysemu/whpx.h" #include "sysemu/cpus.h" @@ -147,6 +148,87 @@ struct whpx_register_set { WHV_REGISTER_VALUE values[RTL_NUMBER_OF(whpx_register_names)]; }; =20 +/* + * The current implementation of instruction stepping sets the TF flag + * in RFLAGS, causing the CPU to raise an INT1 after each instruction. + * This corresponds to the WHvX64ExceptionTypeDebugTrapOrFault exception. + * + * This approach has a few limitations: + * 1. Stepping over a PUSHF/SAHF instruction will save the TF flag + * along with the other flags, possibly restoring it later. It would + * result in another INT1 when the flags are restored, triggering + * a stop in gdb that could be cleared by doing another step. + * + * Stepping over a POPF/LAHF instruction will let it overwrite the + * TF flags, ending the stepping mode. + * + * 2. Stepping over an instruction raising an exception (e.g. INT, DIV, + * or anything that could result in a page fault) will save the fla= gs + * to the stack, clear the TF flag, and let the guest execute the + * handler. Normally, the guest will restore the original flags, + * that will continue single-stepping. + * + * 3. Debuggers running on the guest may wish to set TF to do instruct= ion + * stepping. INT1 events generated by it would be intercepted by us, + * as long as the gdb is connected to QEMU. + * + * In practice this means that: + * 1. Stepping through flags-modifying instructions may cause gdb to + * continue or stop in unexpected places. This will be fully recove= rable + * and will not crash the target. + * + * 2. Stepping over an instruction that triggers an exception will step + * over the exception handler, not into it. + * + * 3. Debugging the guest via gdb, while running debugger on the guest + * at the same time may lead to unexpected effects. Removing all + * breakpoints set via QEMU will prevent any further interference + * with the guest-level debuggers. + * + * The limitations can be addressed as shown below: + * 1. PUSHF/SAHF/POPF/LAHF/IRET instructions can be emulated instead of + * stepping through them. The exact semantics of the instructions is + * defined in the "Combined Volume Set of Intel 64 and IA-32 + * Architectures Software Developer's Manuals", however it involves= a + * fair amount of corner cases due to compatibility with real mode, + * virtual 8086 mode, and differences between 64-bit and 32-bit mod= es. + * + * 2. We could step into the guest's exception handlers using the foll= owing + * sequence: + * a. Temporarily enable catching of all exception types via + * whpx_set_exception_exit_bitmap(). + * b. Once an exception is intercepted, read the IDT/GDT and loca= te + * the original handler. + * c. Patch the original handler, injecting an INT3 at the beginn= ing. + * d. Update the exception exit bitmap to only catch the + * WHvX64ExceptionTypeBreakpointTrap exception. + * e. Let the affected CPU run in the exclusive mode. + * f. Restore the original handler and the exception exit bitmap. + * Note that handling all corner cases related to IDT/GDT is harder + * than it may seem. See x86_cpu_get_phys_page_attrs_debug() for a + * rough idea. + * + * 3. In order to properly support guest-level debugging in parallel w= ith + * the QEMU-level debugging, we would need to be able to pass some = INT1 + * events to the guest. This could be done via the following method= s: + * a. Using the WHvRegisterPendingEvent register. As of Windows 2= 1H1, + * it seems to only work for interrupts and not software + * exceptions. + * b. Locating and patching the original handler by parsing IDT/G= DT. + * This involves relatively complex logic outlined in the prev= ious + * paragraph. + * c. Emulating the exception invocation (i.e. manually updating = RIP, + * RFLAGS, and pushing the old values to stack). This is even = more + * complicated than the previous option, since it involves che= cking + * CPL, gate attributes, and doing various adjustments dependi= ng + * on the current CPU mode, whether the CPL is changing, etc. + */ +typedef enum WhpxStepMode { + WHPX_STEP_NONE =3D 0, + /* Halt other VCPUs */ + WHPX_STEP_EXCLUSIVE, +} WhpxStepMode; + struct whpx_vcpu { WHV_EMULATOR_HANDLE emulator; bool window_registered; @@ -785,6 +867,517 @@ static int whpx_handle_portio(CPUState *cpu, return 0; } =20 +/* + * Controls whether we should intercept various exceptions on the guest, + * namely breakpoint/single-step events. + * + * The 'exceptions' argument accepts a bitmask, e.g: + * (1 << WHvX64ExceptionTypeDebugTrapOrFault) | (...) + */ +static HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) +{ + struct whpx_state *whpx =3D &whpx_global; + WHV_PARTITION_PROPERTY prop =3D { 0, }; + HRESULT hr; + + if (exceptions =3D=3D whpx->exception_exit_bitmap) { + return S_OK; + } + + prop.ExceptionExitBitmap =3D exceptions; + + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeExceptionExitBitmap, + &prop, + sizeof(WHV_PARTITION_PROPERTY)); + + if (SUCCEEDED(hr)) { + whpx->exception_exit_bitmap =3D exceptions; + } + + return hr; +} + + +/* + * This function is called before/after stepping over a single instruction. + * It will update the CPU registers to arm/disarm the instruction stepping + * accordingly. + */ +static HRESULT whpx_vcpu_configure_single_stepping(CPUState *cpu, + bool set, + uint64_t *exit_context_rflags) +{ + WHV_REGISTER_NAME reg_name; + WHV_REGISTER_VALUE reg_value; + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + + /* + * If we are trying to step over a single instruction, we need to set = the + * TF bit in rflags. Otherwise, clear it. + */ + reg_name =3D WHvX64RegisterRflags; + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get rflags, hr=3D%08lx", hr); + return hr; + } + + if (exit_context_rflags) { + assert(*exit_context_rflags =3D=3D reg_value.Reg64); + } + + if (set) { + /* Raise WHvX64ExceptionTypeDebugTrapOrFault after each instructio= n */ + reg_value.Reg64 |=3D TF_MASK; + } else { + reg_value.Reg64 &=3D ~TF_MASK; + } + + if (exit_context_rflags) { + *exit_context_rflags =3D reg_value.Reg64; + } + + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set rflags," + " hr=3D%08lx", + hr); + return hr; + } + + reg_name =3D WHvRegisterInterruptState; + reg_value.Reg64 =3D 0; + + /* Suspend delivery of hardware interrupts during single-stepping. */ + reg_value.InterruptState.InterruptShadow =3D set !=3D 0; + + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set InterruptState," + " hr=3D%08lx", + hr); + return hr; + } + + if (!set) { + /* + * We have just finished stepping over a single instruction, + * and intercepted the INT1 generated by it. + * We need to now hide the INT1 from the guest, + * as it would not be expecting it. + */ + + reg_name =3D WHvX64RegisterPendingDebugException; + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get pending debug exceptions," + "hr=3D%08lx", hr); + return hr; + } + + if (reg_value.PendingDebugException.SingleStep) { + reg_value.PendingDebugException.SingleStep =3D 0; + + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to clear pending debug exceptio= ns," + "hr=3D%08lx", hr); + return hr; + } + } + + } + + return S_OK; +} + +/* Tries to find a breakpoint at the specified address. */ +static struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t add= ress) +{ + struct whpx_state *whpx =3D &whpx_global; + int i; + + if (whpx->breakpoints.breakpoints) { + for (i =3D 0; i < whpx->breakpoints.breakpoints->used; i++) { + if (address =3D=3D whpx->breakpoints.breakpoints->data[i].addr= ess) { + return &whpx->breakpoints.breakpoints->data[i]; + } + } + } + + return NULL; +} + +/* + * Linux uses int3 (0xCC) during startup (see int3_selftest()) and for + * debugging user-mode applications. Since the WHPX API does not offer + * an easy way to pass the intercepted exception back to the guest, we + * resort to using INT1 instead, and let the guest always handle INT3. + */ +static const uint8_t whpx_breakpoint_instruction =3D 0xF1; + +/* + * The WHPX QEMU backend implements breakpoints by writing the INT1 + * instruction into memory (ignoring the DRx registers). This raises a few + * issues that need to be carefully handled: + * + * 1. Although unlikely, other parts of QEMU may set multiple breakpoints + * at the same location, and later remove them in arbitrary order. + * This should not cause memory corruption, and should only remove the + * physical breakpoint instruction when the last QEMU breakpoint is gon= e. + * + * 2. Writing arbitrary virtual memory may fail if it's not mapped to a va= lid + * physical location. Hence, physically adding/removing a breakpoint can + * theoretically fail at any time. We need to keep track of it. + * + * The function below rebuilds a list of low-level breakpoints (one per + * address, tracking the original instruction and any errors) from the lis= t of + * high-level breakpoints (set via cpu_breakpoint_insert()). + * + * In order to optimize performance, this function stores the list of + * high-level breakpoints (a.k.a. CPU breakpoints) used to compute the + * low-level ones, so that it won't be re-invoked until these breakpoints + * change. + * + * Note that this function decides which breakpoints should be inserted in= to, + * memory, but doesn't actually do it. The memory accessing is done in + * whpx_apply_breakpoints(). + */ +static void whpx_translate_cpu_breakpoints( + struct whpx_breakpoints *breakpoints, + CPUState *cpu, + int cpu_breakpoint_count) +{ + CPUBreakpoint *bp; + int cpu_bp_index =3D 0; + + breakpoints->original_addresses =3D + g_renew(vaddr, breakpoints->original_addresses, cpu_breakpoint_cou= nt); + + breakpoints->original_address_count =3D cpu_breakpoint_count; + + int max_breakpoints =3D cpu_breakpoint_count + + (breakpoints->breakpoints ? breakpoints->breakpoints->used : 0); + + struct whpx_breakpoint_collection *new_breakpoints =3D + (struct whpx_breakpoint_collection *)g_malloc0( + sizeof(struct whpx_breakpoint_collection) + + max_breakpoints * sizeof(struct whpx_breakpoint)); + + new_breakpoints->allocated =3D max_breakpoints; + new_breakpoints->used =3D 0; + + /* + * 1. Preserve all old breakpoints that could not be automatically + * cleared when the CPU got stopped. + */ + if (breakpoints->breakpoints) { + int i; + for (i =3D 0; i < breakpoints->breakpoints->used; i++) { + if (breakpoints->breakpoints->data[i].state !=3D WHPX_BP_CLEAR= ED) { + new_breakpoints->data[new_breakpoints->used++] =3D + breakpoints->breakpoints->data[i]; + } + } + } + + /* 2. Map all CPU breakpoints to WHPX breakpoints */ + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + int i; + bool found =3D false; + + /* This will be used to detect changed CPU breakpoints later. */ + breakpoints->original_addresses[cpu_bp_index++] =3D bp->pc; + + for (i =3D 0; i < new_breakpoints->used; i++) { + /* + * WARNING: This loop has O(N^2) complexity, where N is the + * number of breakpoints. It should not be a bottleneck in + * real-world scenarios, since it only needs to run once after + * the breakpoints have been modified. + * If this ever becomes a concern, it can be optimized by stor= ing + * high-level breakpoint objects in a tree or hash map. + */ + + if (new_breakpoints->data[i].address =3D=3D bp->pc) { + /* There was already a breakpoint at this address. */ + if (new_breakpoints->data[i].state =3D=3D WHPX_BP_CLEAR_PE= NDING) { + new_breakpoints->data[i].state =3D WHPX_BP_SET; + } else if (new_breakpoints->data[i].state =3D=3D WHPX_BP_S= ET) { + new_breakpoints->data[i].state =3D WHPX_BP_SET_PENDING; + } + + found =3D true; + break; + } + } + + if (!found && new_breakpoints->used < new_breakpoints->allocated) { + /* No WHPX breakpoint at this address. Create one. */ + new_breakpoints->data[new_breakpoints->used].address =3D bp->p= c; + new_breakpoints->data[new_breakpoints->used].state =3D + WHPX_BP_SET_PENDING; + new_breakpoints->used++; + } + } + + if (breakpoints->breakpoints) { + /* + * Free the previous breakpoint list. This can be optimized by kee= ping + * it as shadow buffer for the next computation instead of freeing + * it immediately. + */ + g_free(breakpoints->breakpoints); + } + + breakpoints->breakpoints =3D new_breakpoints; +} + +/* + * Physically inserts/removes the breakpoints by reading and writing the + * physical memory, keeping a track of the failed attempts. + * + * Passing resuming=3Dtrue will try to set all previously unset breakpoin= ts. + * Passing resuming=3Dfalse will remove all inserted ones. + */ +static void whpx_apply_breakpoints( + struct whpx_breakpoint_collection *breakpoints, + CPUState *cpu, + bool resuming) +{ + int i, rc; + if (!breakpoints) { + return; + } + + for (i =3D 0; i < breakpoints->used; i++) { + /* Decide what to do right now based on the last known state. */ + WhpxBreakpointState state =3D breakpoints->data[i].state; + switch (state) { + case WHPX_BP_CLEARED: + if (resuming) { + state =3D WHPX_BP_SET_PENDING; + } + break; + case WHPX_BP_SET_PENDING: + if (!resuming) { + state =3D WHPX_BP_CLEARED; + } + break; + case WHPX_BP_SET: + if (!resuming) { + state =3D WHPX_BP_CLEAR_PENDING; + } + break; + case WHPX_BP_CLEAR_PENDING: + if (resuming) { + state =3D WHPX_BP_SET; + } + break; + } + + if (state =3D=3D WHPX_BP_SET_PENDING) { + /* Remember the original instruction. */ + rc =3D cpu_memory_rw_debug(cpu, + breakpoints->data[i].address, + &breakpoints->data[i].original_instruction, + 1, + false); + + if (!rc) { + /* Write the breakpoint instruction. */ + rc =3D cpu_memory_rw_debug(cpu, + breakpoints->data[i].address, + (void *)&whpx_breakpoint_instruction, + 1, + true); + } + + if (!rc) { + state =3D WHPX_BP_SET; + } + + } + + if (state =3D=3D WHPX_BP_CLEAR_PENDING) { + /* Restore the original instruction. */ + rc =3D cpu_memory_rw_debug(cpu, + breakpoints->data[i].address, + &breakpoints->data[i].original_instruction, + 1, + true); + + if (!rc) { + state =3D WHPX_BP_CLEARED; + } + } + + breakpoints->data[i].state =3D state; + } +} + +/* + * This function is called when the a VCPU is about to start and no other + * VCPUs have been started so far. Since the VCPU start order could be + * arbitrary, it doesn't have to be VCPU#0. + * + * It is used to commit the breakpoints into memory, and configure WHPX + * to intercept debug exceptions. + * + * Note that whpx_set_exception_exit_bitmap() cannot be called if one or + * more VCPUs are already running, so this is the best place to do it. + */ +static int whpx_first_vcpu_starting(CPUState *cpu) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + g_assert(qemu_mutex_iothread_locked()); + + if (!QTAILQ_EMPTY(&cpu->breakpoints) || + (whpx->breakpoints.breakpoints && + whpx->breakpoints.breakpoints->used)) { + CPUBreakpoint *bp; + int i =3D 0; + bool update_pending =3D false; + + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + if (i >=3D whpx->breakpoints.original_address_count || + bp->pc !=3D whpx->breakpoints.original_addresses[i]) { + update_pending =3D true; + } + + i++; + } + + if (i !=3D whpx->breakpoints.original_address_count) { + update_pending =3D true; + } + + if (update_pending) { + /* + * The CPU breakpoints have changed since the last call to + * whpx_translate_cpu_breakpoints(). WHPX breakpoints must + * now be recomputed. + */ + whpx_translate_cpu_breakpoints(&whpx->breakpoints, cpu, i); + } + + /* Actually insert the breakpoints into the memory. */ + whpx_apply_breakpoints(whpx->breakpoints.breakpoints, cpu, true); + } + + uint64_t exception_mask; + if (whpx->step_pending || + (whpx->breakpoints.breakpoints && + whpx->breakpoints.breakpoints->used)) { + /* + * We are either attempting to single-step one or more CPUs, or + * have one or more breakpoints enabled. Both require intercepting + * the WHvX64ExceptionTypeBreakpointTrap exception. + */ + + exception_mask =3D 1UL << WHvX64ExceptionTypeDebugTrapOrFault; + } else { + /* Let the guest handle all exceptions. */ + exception_mask =3D 0; + } + + hr =3D whpx_set_exception_exit_bitmap(exception_mask); + if (!SUCCEEDED(hr)) { + error_report("WHPX: Failed to update exception exit mask," + "hr=3D%08lx.", hr); + return 1; + } + + return 0; +} + +/* + * This function is called when the last VCPU has finished running. + * It is used to remove any previously set breakpoints from memory. + */ +static int whpx_last_vcpu_stopping(CPUState *cpu) +{ + whpx_apply_breakpoints(whpx_global.breakpoints.breakpoints, cpu, false= ); + return 0; +} + +/* Returns the address of the next instruction that is about to be execute= d. */ +static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid) +{ + if (cpu->vcpu_dirty) { + /* The CPU registers have been modified by other parts of QEMU. */ + CPUArchState *env =3D (CPUArchState *)(cpu->env_ptr); + return env->eip; + } else if (exit_context_valid) { + /* + * The CPU registers have not been modified by neither other parts + * of QEMU, nor this port by calling WHvSetVirtualProcessorRegiste= rs(). + * This is the most common case. + */ + struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); + return vcpu->exit_ctx.VpContext.Rip; + } else { + /* + * The CPU registers have been modified by a call to + * WHvSetVirtualProcessorRegisters() and must be re-queried from + * the target. + */ + WHV_REGISTER_VALUE reg_value; + WHV_REGISTER_NAME reg_name =3D WHvX64RegisterRip; + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( + whpx->partition, + cpu->cpu_index, + ®_name, + 1, + ®_value); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get PC, hr=3D%08lx", hr); + return 0; + } + + return reg_value.Reg64; + } +} + static int whpx_handle_halt(CPUState *cpu) { CPUX86State *env =3D cpu->env_ptr; @@ -996,17 +1589,75 @@ static int whpx_vcpu_run(CPUState *cpu) HRESULT hr; struct whpx_state *whpx =3D &whpx_global; struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); + struct whpx_breakpoint *stepped_over_bp =3D NULL; + WhpxStepMode exclusive_step_mode =3D WHPX_STEP_NONE; int ret; =20 - whpx_vcpu_process_async_events(cpu); - if (cpu->halted && !whpx_apic_in_platform()) { - cpu->exception_index =3D EXCP_HLT; - qatomic_set(&cpu->exit_request, false); - return 0; + g_assert(qemu_mutex_iothread_locked()); + + if (whpx->running_cpus++ =3D=3D 0) { + /* Insert breakpoints into memory, update exception exit bitmap. */ + ret =3D whpx_first_vcpu_starting(cpu); + if (ret !=3D 0) { + return ret; + } + } + + if (whpx->breakpoints.breakpoints && + whpx->breakpoints.breakpoints->used > 0) + { + uint64_t pc =3D whpx_vcpu_get_pc(cpu, true); + stepped_over_bp =3D whpx_lookup_breakpoint_by_addr(pc); + if (stepped_over_bp && stepped_over_bp->state !=3D WHPX_BP_SET) { + stepped_over_bp =3D NULL; + } + + if (stepped_over_bp) { + /* + * We are trying to run the instruction overwritten by an acti= ve + * breakpoint. We will temporarily disable the breakpoint, sus= pend + * other CPUs, and step over the instruction. + */ + exclusive_step_mode =3D WHPX_STEP_EXCLUSIVE; + } + } + + if (exclusive_step_mode =3D=3D WHPX_STEP_NONE) { + whpx_vcpu_process_async_events(cpu); + if (cpu->halted && !whpx_apic_in_platform()) { + cpu->exception_index =3D EXCP_HLT; + qatomic_set(&cpu->exit_request, false); + return 0; + } } =20 qemu_mutex_unlock_iothread(); - cpu_exec_start(cpu); + + if (exclusive_step_mode !=3D WHPX_STEP_NONE) { + start_exclusive(); + g_assert(cpu =3D=3D current_cpu); + g_assert(!cpu->running); + cpu->running =3D true; + + hr =3D whpx_set_exception_exit_bitmap( + 1UL << WHvX64ExceptionTypeDebugTrapOrFault); + if (!SUCCEEDED(hr)) { + error_report("WHPX: Failed to update exception exit mask, " + "hr=3D%08lx.", hr); + return 1; + } + + if (stepped_over_bp) { + /* Temporarily disable the triggered breakpoint. */ + cpu_memory_rw_debug(cpu, + stepped_over_bp->address, + &stepped_over_bp->original_instruction, + 1, + true); + } + } else { + cpu_exec_start(cpu); + } =20 do { if (cpu->vcpu_dirty) { @@ -1014,10 +1665,16 @@ static int whpx_vcpu_run(CPUState *cpu) cpu->vcpu_dirty =3D false; } =20 - whpx_vcpu_pre_run(cpu); + if (exclusive_step_mode =3D=3D WHPX_STEP_NONE) { + whpx_vcpu_pre_run(cpu); =20 - if (qatomic_read(&cpu->exit_request)) { - whpx_vcpu_kick(cpu); + if (qatomic_read(&cpu->exit_request)) { + whpx_vcpu_kick(cpu); + } + } + + if (exclusive_step_mode !=3D WHPX_STEP_NONE || cpu->singlestep_ena= bled) { + whpx_vcpu_configure_single_stepping(cpu, true, NULL); } =20 hr =3D whp_dispatch.WHvRunVirtualProcessor( @@ -1031,6 +1688,12 @@ static int whpx_vcpu_run(CPUState *cpu) break; } =20 + if (exclusive_step_mode !=3D WHPX_STEP_NONE || cpu->singlestep_ena= bled) { + whpx_vcpu_configure_single_stepping(cpu, + false, + &vcpu->exit_ctx.VpContext.Rflags); + } + whpx_vcpu_post_run(cpu); =20 switch (vcpu->exit_ctx.ExitReason) { @@ -1054,6 +1717,10 @@ static int whpx_vcpu_run(CPUState *cpu) break; =20 case WHvRunVpExitReasonX64Halt: + /* + * WARNING: as of build 19043.1526 (21H1), this exit reason is= no + * longer used. + */ ret =3D whpx_handle_halt(cpu); break; =20 @@ -1152,10 +1819,19 @@ static int whpx_vcpu_run(CPUState *cpu) } =20 case WHvRunVpExitReasonCanceled: - cpu->exception_index =3D EXCP_INTERRUPT; - ret =3D 1; + if (exclusive_step_mode !=3D WHPX_STEP_NONE) { + /* + * We are trying to step over a single instruction, and + * likely got a request to stop from another thread. + * Delay it until we are done stepping + * over. + */ + ret =3D 0; + } else { + cpu->exception_index =3D EXCP_INTERRUPT; + ret =3D 1; + } break; - case WHvRunVpExitReasonX64MsrAccess: { WHV_REGISTER_VALUE reg_values[3] =3D {0}; WHV_REGISTER_NAME reg_names[3]; @@ -1259,11 +1935,36 @@ static int whpx_vcpu_run(CPUState *cpu) ret =3D 0; break; } + case WHvRunVpExitReasonException: + whpx_get_registers(cpu); + + if ((vcpu->exit_ctx.VpException.ExceptionType =3D=3D + WHvX64ExceptionTypeDebugTrapOrFault) && + (vcpu->exit_ctx.VpException.InstructionByteCount >=3D 1) && + (vcpu->exit_ctx.VpException.InstructionBytes[0] =3D=3D + whpx_breakpoint_instruction)) { + /* Stopped at a software breakpoint. */ + cpu->exception_index =3D EXCP_DEBUG; + } else if ((vcpu->exit_ctx.VpException.ExceptionType =3D=3D + WHvX64ExceptionTypeDebugTrapOrFault) && + !cpu->singlestep_enabled) { + /* + * Just finished stepping over a breakpoint, but the + * gdb does not expect us to do single-stepping. + * Don't do anything special. + */ + cpu->exception_index =3D EXCP_INTERRUPT; + } else { + /* Another exception or debug event. Report it to GDB. */ + cpu->exception_index =3D EXCP_DEBUG; + } + + ret =3D 1; + break; case WHvRunVpExitReasonNone: case WHvRunVpExitReasonUnrecoverableException: case WHvRunVpExitReasonInvalidVpRegisterValue: case WHvRunVpExitReasonUnsupportedFeature: - case WHvRunVpExitReasonException: default: error_report("WHPX: Unexpected VP exit code %d", vcpu->exit_ctx.ExitReason); @@ -1276,10 +1977,32 @@ static int whpx_vcpu_run(CPUState *cpu) =20 } while (!ret); =20 - cpu_exec_end(cpu); + if (stepped_over_bp) { + /* Restore the breakpoint we stepped over */ + cpu_memory_rw_debug(cpu, + stepped_over_bp->address, + (void *)&whpx_breakpoint_instruction, + 1, + true); + } + + if (exclusive_step_mode !=3D WHPX_STEP_NONE) { + g_assert(cpu_in_exclusive_context(cpu)); + cpu->running =3D false; + end_exclusive(); + + exclusive_step_mode =3D WHPX_STEP_NONE; + } else { + cpu_exec_end(cpu); + } + qemu_mutex_lock_iothread(); current_cpu =3D cpu; =20 + if (--whpx->running_cpus =3D=3D 0) { + whpx_last_vcpu_stopping(cpu); + } + qatomic_set(&cpu->exit_request, false); =20 return ret < 0; @@ -1339,6 +2062,11 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu) run_on_cpu(cpu, do_whpx_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL); } =20 +void whpx_cpu_synchronize_pre_resume(bool step_pending) +{ + whpx_global.step_pending =3D step_pending; +} + /* * Vcpu support. */ @@ -1838,6 +2566,7 @@ static int whpx_accel_init(MachineState *ms) memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); prop.ExtendedVmExits.X64MsrExit =3D 1; prop.ExtendedVmExits.X64CpuidExit =3D 1; + prop.ExtendedVmExits.ExceptionExit =3D 1; if (whpx_apic_in_platform()) { prop.ExtendedVmExits.X64ApicInitSipiExitTrap =3D 1; } @@ -1866,6 +2595,19 @@ static int whpx_accel_init(MachineState *ms) goto error; } =20 + /* + * We do not want to intercept any exceptions from the guest, + * until we actually start debugging with gdb. + */ + whpx->exception_exit_bitmap =3D -1; + hr =3D whpx_set_exception_exit_bitmap(0); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set exception exit bitmap, hr=3D%08l= x", hr); + ret =3D -EINVAL; + goto error; + } + hr =3D whp_dispatch.WHvSetupPartition(whpx->partition); if (FAILED(hr)) { error_report("WHPX: Failed to setup partition, hr=3D%08lx", hr); diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-inter= nal.h index 908ababf6d..2416ec7922 100644 --- a/target/i386/whpx/whpx-internal.h +++ b/target/i386/whpx/whpx-internal.h @@ -5,9 +5,39 @@ #include #include =20 +typedef enum WhpxBreakpointState { + WHPX_BP_CLEARED =3D 0, + WHPX_BP_SET_PENDING, + WHPX_BP_SET, + WHPX_BP_CLEAR_PENDING, +} WhpxBreakpointState; + +struct whpx_breakpoint { + vaddr address; + WhpxBreakpointState state; + uint8_t original_instruction; +}; + +struct whpx_breakpoint_collection { + int allocated, used; + struct whpx_breakpoint data[0]; +}; + +struct whpx_breakpoints { + int original_address_count; + vaddr *original_addresses; + + struct whpx_breakpoint_collection *breakpoints; +}; + struct whpx_state { uint64_t mem_quota; WHV_PARTITION_HANDLE partition; + uint64_t exception_exit_bitmap; + int32_t running_cpus; + struct whpx_breakpoints breakpoints; + bool step_pending; + bool kernel_irqchip_allowed; bool kernel_irqchip_required; bool apic_in_platform; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351573155693.983478247725; Mon, 18 Apr 2022 23:59:33 -0700 (PDT) Received: from localhost ([::1]:55322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghpj-00081B-01 for importer@patchew.org; Tue, 19 Apr 2022 02:59:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmG-0001FO-Tj for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:45935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmD-0004Uv-5x for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: by mail-wr1-x430.google.com with SMTP id w4so20898477wrg.12 for ; Mon, 18 Apr 2022 22:51:48 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dd2btITZAkKvbGwyXVH17qaz879vrJ3ttv8tRXEsOaY=; b=D93bqhNPuRtA9umnTOG4fuo0r4l77NTMo01VY9iSwnEl97glL9ZkF599FHfdChynEf Bdd654mhZ5Z9OXjB8TkLNhckzAluX5hFeilmhclGa7iXmCdrsWhhxQt3uzWFw+r4VhKO NjHGPvkIDbjiwmc/lJwyWIxDDrxkofSv/E2IkmfArSbo3Be2kHdKro1BAKNgwMeQ2w0M ldMCjvVn4vpbLH+ggwk9UyO7341qT7nzEwDB0mrf0rWDpYgUOhEJiiKvTtKfckx1YHAr lUkCuML3ct4thKjKlFcPEC1AxI4d0V66T2RJDNBpYSvMSeWNOOs3kxiIoHVPZNHRU8Ad uKHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dd2btITZAkKvbGwyXVH17qaz879vrJ3ttv8tRXEsOaY=; b=jhlrMfOd1GJ5Bay0uOVXNVt4TCARwvPgqHztCmsiKS8190havoFreQlLdV4fc5FPug sfkepZ2Youl95LDu78NjwB77hfQhNAf5m3LpiCGmYAiV8mGfuAW8rIrjtGo5CZD+gEmN xjz3x1Q0T7vxTnq0LV7cAuMVTYuzlp3nDl6Z/1RJ6w6TZZ2aN4wcaPKb6+jxd8eVzKhQ sFzfEUal27KQJSJWvKlzlNzPHePhT/mLN/7/d3bKS2mDx8Qoj5/CKEbbpyUrqoZoUbsp N/JHN5y4gU68JycdztdeqmMxpboSuUfC78PfyeFbUic1TLX+o+cird2A6gl8ZLqGQDAD +V4w== X-Gm-Message-State: AOAM532Yi9kxdWqfsibC/RxlQN/28/jVtb3L9FyYFHnR7QedgA4i8LjM m2OKQ+HwA+tSS9avMkMKCiUWOfz4iKhiyA== X-Google-Smtp-Source: ABdhPJwtxYsDOIbagqqfoVqh7zOJ74C1y8sxRPjPPjDk8pQJ1X0iOufspcv7tGs49nQBZYhHraB9XQ== X-Received: by 2002:a5d:588a:0:b0:204:1f46:cf08 with SMTP id n10-20020a5d588a000000b002041f46cf08mr10820880wrf.133.1650347507483; Mon, 18 Apr 2022 22:51:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 40/53] thread-posix: remove the posix semaphore support Date: Tue, 19 Apr 2022 07:50:56 +0200 Message-Id: <20220419055109.142788-41-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::430; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: "Longpeng\(Mike\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351573859100001 Content-Type: text/plain; charset="utf-8" From: "Longpeng(Mike)" POSIX specifies an absolute time for sem_timedwait(), it would be affected if the system time is changing, but there is not a relative time or monotonic clock version of sem_timedwait, so we cannot gain from POSIX semaphore any more. An alternative way is to use sem_trywait + usleep, maybe we can remove CONFIG_SEM_TIMEDWAIT in this way? No, because some systems (e.g. mac os) mark the sem_xxx API as deprecated. So maybe remove the usage of POSIX semaphore and turn to use the pthread variant for all systems looks better. Signed-off-by: Longpeng(Mike) Message-Id: <20220222090507.2028-2-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini --- include/qemu/thread-posix.h | 4 --- meson.build | 1 - util/qemu-thread-posix.c | 54 ------------------------------------- 3 files changed, 59 deletions(-) diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index b792e6ef37..5466608d7c 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -27,13 +27,9 @@ struct QemuCond { }; =20 struct QemuSemaphore { -#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_t lock; pthread_cond_t cond; unsigned int count; -#else - sem_t sem; -#endif bool initialized; }; =20 diff --git a/meson.build b/meson.build index 5a207ed0fb..526e9dc03b 100644 --- a/meson.build +++ b/meson.build @@ -1632,7 +1632,6 @@ config_host_data.set('CONFIG_MEMALIGN', cc.has_functi= on('memalign')) config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#= include ')) config_host_data.set('CONFIG_PTHREAD_FCHDIR_NP', cc.has_function('pthread_= fchdir_np')) -config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwai= t', dependencies: threads)) config_host_data.set('CONFIG_SENDFILE', cc.has_function('sendfile')) config_host_data.set('CONFIG_SETNS', cc.has_function('setns') and cc.has_f= unction('unshare')) config_host_data.set('CONFIG_SYNCFS', cc.has_function('syncfs')) diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index e1225b63bd..1ad2503607 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -219,7 +219,6 @@ void qemu_sem_init(QemuSemaphore *sem, int init) { int rc; =20 -#ifndef CONFIG_SEM_TIMEDWAIT rc =3D pthread_mutex_init(&sem->lock, NULL); if (rc !=3D 0) { error_exit(rc, __func__); @@ -232,12 +231,6 @@ void qemu_sem_init(QemuSemaphore *sem, int init) error_exit(EINVAL, __func__); } sem->count =3D init; -#else - rc =3D sem_init(&sem->sem, 0, init); - if (rc < 0) { - error_exit(errno, __func__); - } -#endif sem->initialized =3D true; } =20 @@ -247,7 +240,6 @@ void qemu_sem_destroy(QemuSemaphore *sem) =20 assert(sem->initialized); sem->initialized =3D false; -#ifndef CONFIG_SEM_TIMEDWAIT rc =3D pthread_cond_destroy(&sem->cond); if (rc < 0) { error_exit(rc, __func__); @@ -256,12 +248,6 @@ void qemu_sem_destroy(QemuSemaphore *sem) if (rc < 0) { error_exit(rc, __func__); } -#else - rc =3D sem_destroy(&sem->sem); - if (rc < 0) { - error_exit(errno, __func__); - } -#endif } =20 void qemu_sem_post(QemuSemaphore *sem) @@ -269,7 +255,6 @@ void qemu_sem_post(QemuSemaphore *sem) int rc; =20 assert(sem->initialized); -#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_lock(&sem->lock); if (sem->count =3D=3D UINT_MAX) { rc =3D EINVAL; @@ -281,12 +266,6 @@ void qemu_sem_post(QemuSemaphore *sem) if (rc !=3D 0) { error_exit(rc, __func__); } -#else - rc =3D sem_post(&sem->sem); - if (rc < 0) { - error_exit(errno, __func__); - } -#endif } =20 int qemu_sem_timedwait(QemuSemaphore *sem, int ms) @@ -295,7 +274,6 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) struct timespec ts; =20 assert(sem->initialized); -#ifndef CONFIG_SEM_TIMEDWAIT rc =3D 0; compute_abs_deadline(&ts, ms); pthread_mutex_lock(&sem->lock); @@ -313,29 +291,6 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) } pthread_mutex_unlock(&sem->lock); return (rc =3D=3D ETIMEDOUT ? -1 : 0); -#else - if (ms <=3D 0) { - /* This is cheaper than sem_timedwait. */ - do { - rc =3D sem_trywait(&sem->sem); - } while (rc =3D=3D -1 && errno =3D=3D EINTR); - if (rc =3D=3D -1 && errno =3D=3D EAGAIN) { - return -1; - } - } else { - compute_abs_deadline(&ts, ms); - do { - rc =3D sem_timedwait(&sem->sem, &ts); - } while (rc =3D=3D -1 && errno =3D=3D EINTR); - if (rc =3D=3D -1 && errno =3D=3D ETIMEDOUT) { - return -1; - } - } - if (rc < 0) { - error_exit(errno, __func__); - } - return 0; -#endif } =20 void qemu_sem_wait(QemuSemaphore *sem) @@ -343,7 +298,6 @@ void qemu_sem_wait(QemuSemaphore *sem) int rc; =20 assert(sem->initialized); -#ifndef CONFIG_SEM_TIMEDWAIT pthread_mutex_lock(&sem->lock); while (sem->count =3D=3D 0) { rc =3D pthread_cond_wait(&sem->cond, &sem->lock); @@ -353,14 +307,6 @@ void qemu_sem_wait(QemuSemaphore *sem) } --sem->count; pthread_mutex_unlock(&sem->lock); -#else - do { - rc =3D sem_wait(&sem->sem); - } while (rc =3D=3D -1 && errno =3D=3D EINTR); - if (rc < 0) { - error_exit(errno, __func__); - } -#endif } =20 #ifdef __linux__ --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351309677639.0742049226559; Mon, 18 Apr 2022 23:55:09 -0700 (PDT) Received: from localhost ([::1]:49672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghlU-00047t-JS for importer@patchew.org; Tue, 19 Apr 2022 02:55:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmG-0001FN-R8 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:36671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmD-0004VM-M2 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: by mail-wr1-x42d.google.com with SMTP id u3so20942174wrg.3 for ; Mon, 18 Apr 2022 22:51:49 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fJcfIpbebmLk32obpxOkyBXPozXzL1lD2KFjXsvEwqo=; b=CGeqwT+2+77SVAvLQlytgA59x8i7JnOoJ/rvjpGGj5zr9bKbdE8leQlJjrvtU1z+DD Kjrda4sjvhjlaBT8PFlzkfqoFVbN6ESkCl2wol8FC/PzwIeEQEsSXt38oJINTAh+RndU vT7td+F+T8gBw2rOp+OVxRJXdxGt0Mn1IGDPQ+XrxwDufACfufGgCHYI5i7LJqjUzbzS ANAU0DbX62ww+nKHTJFdjst+RcI4wh2wftXXunVrCnthQ8QETjDxZG/ZlwdiELpoICVs uF35aKOZrTGH4eusSeOzXOUiW5mAmMG1Ok9gEjyEVhVwb51TNARowDHVvtVYeCoj35gA 2paA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fJcfIpbebmLk32obpxOkyBXPozXzL1lD2KFjXsvEwqo=; b=SLTVXKXSfD9onW3ivvycTZWVFdy1m3QPskl/DlWK55hTupQMhsuiFC0ivLn46A2DEJ tfRKvHhCJqoQZljT6tcjZ7YQc2VlkYCr4edm13pgMZ2X1nZI9DdBPU1tLHfL4YQTkq4A 6+W7i/ci9ql/hIy2cxOIOCwMmc1I3PSjbV7fu1NnJ10LQOq+TQIcYWj+9DQaFA3TeKfc 9TyzvRpgh20lZkZI+cr0bzA+jIiWb73mqHCsoa6Csk0vUUK3XJWxm8sVGt2TGoyVni/e ByDJMyf1MPclVUvaGJWlKVM7nQMOU0UUkL9hSiRgXhPELwa1LXHW/X9//geOiRJN8lco whyQ== X-Gm-Message-State: AOAM533inkxzOgO0hGNg2lyssW8VXrqTHL2OJ8x2mI5AgU3/EX1gkdhC 8ro66uhudv39/HFWww2e5jMUPpri/Xx9tg== X-Google-Smtp-Source: ABdhPJxWZVV11e7rZ2us2EfvB6hQ7TuGuhXcOxFMKNIR2ojYCEXqj2YboXq8y6p4lWALMBjmVrlDMQ== X-Received: by 2002:adf:dc0b:0:b0:20a:a549:d3a6 with SMTP id t11-20020adfdc0b000000b0020aa549d3a6mr1899732wri.34.1650347508453; Mon, 18 Apr 2022 22:51:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 41/53] thread-posix: use monotonic clock for QemuCond and QemuSemaphore Date: Tue, 19 Apr 2022 07:50:57 +0200 Message-Id: <20220419055109.142788-42-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::42d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: "Longpeng\(Mike\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351310662100001 Content-Type: text/plain; charset="utf-8" From: "Longpeng(Mike)" Use CLOCK_MONOTONIC, so the timeout isn't affected by changes to the system time. It depends on the pthread_condattr_setclock(), while some systems(e.g. mac os) does not support it, so the behavior won't change in these systems. Signed-off-by: Longpeng(Mike) Message-Id: <20220222090507.2028-3-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini --- meson.build | 11 +++++++++ util/qemu-thread-posix.c | 53 ++++++++++++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 526e9dc03b..6ba60950c8 100644 --- a/meson.build +++ b/meson.build @@ -1780,6 +1780,17 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_T= ID', cc.links(gnu_source_pre pthread_create(&thread, 0, f, 0); return 0; }''', dependencies: threads)) +config_host_data.set('CONFIG_PTHREAD_CONDATTR_SETCLOCK', cc.links(gnu_sour= ce_prefix + ''' + #include + #include + + int main(void) + { + pthread_condattr_t attr + pthread_condattr_init(&attr); + pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); + return 0; + }''', dependencies: threads)) =20 config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + ''' #include diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 1ad2503607..f6a34eed2f 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -38,12 +38,20 @@ static void error_exit(int err, const char *msg) abort(); } =20 +static inline clockid_t qemu_timedwait_clockid(void) +{ +#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK + return CLOCK_MONOTONIC; +#else + return CLOCK_REALTIME; +#endif +} + static void compute_abs_deadline(struct timespec *ts, int ms) { - struct timeval tv; - gettimeofday(&tv, NULL); - ts->tv_nsec =3D tv.tv_usec * 1000 + (ms % 1000) * 1000000; - ts->tv_sec =3D tv.tv_sec + ms / 1000; + clock_gettime(qemu_timedwait_clockid(), ts); + ts->tv_nsec +=3D (ms % 1000) * 1000000; + ts->tv_sec +=3D ms / 1000; if (ts->tv_nsec >=3D 1000000000) { ts->tv_sec++; ts->tv_nsec -=3D 1000000000; @@ -147,11 +155,27 @@ void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, = const char *file, int line) =20 void qemu_cond_init(QemuCond *cond) { + pthread_condattr_t attr; int err; =20 - err =3D pthread_cond_init(&cond->cond, NULL); - if (err) + err =3D pthread_condattr_init(&attr); + if (err) { error_exit(err, __func__); + } +#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK + err =3D pthread_condattr_setclock(&attr, qemu_timedwait_clockid()); + if (err) { + error_exit(err, __func__); + } +#endif + err =3D pthread_cond_init(&cond->cond, &attr); + if (err) { + error_exit(err, __func__); + } + err =3D pthread_condattr_destroy(&attr); + if (err) { + error_exit(err, __func__); + } cond->initialized =3D true; } =20 @@ -217,16 +241,31 @@ bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMut= ex *mutex, int ms, =20 void qemu_sem_init(QemuSemaphore *sem, int init) { + pthread_condattr_t attr; int rc; =20 rc =3D pthread_mutex_init(&sem->lock, NULL); if (rc !=3D 0) { error_exit(rc, __func__); } - rc =3D pthread_cond_init(&sem->cond, NULL); + rc =3D pthread_condattr_init(&attr); if (rc !=3D 0) { error_exit(rc, __func__); } +#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK + rc =3D pthread_condattr_setclock(&attr, qemu_timedwait_clockid()); + if (rc !=3D 0) { + error_exit(rc, __func__); + } +#endif + rc =3D pthread_cond_init(&sem->cond, &attr); + if (rc !=3D 0) { + error_exit(rc, __func__); + } + rc =3D pthread_condattr_destroy(&attr); + if (rc < 0) { + error_exit(rc, __func__); + } if (init < 0) { error_exit(EINVAL, __func__); } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650353172931934.2320558960635; Tue, 19 Apr 2022 00:26:12 -0700 (PDT) Received: from localhost ([::1]:53940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiFX-00026G-Ot for importer@patchew.org; Tue, 19 Apr 2022 03:26:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmG-0001FP-Vm for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:46854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmF-0004Vo-41 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:52 -0400 Received: by mail-wm1-x330.google.com with SMTP id l62-20020a1c2541000000b0038e4570af2fso755843wml.5 for ; Mon, 18 Apr 2022 22:51:50 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w33mdIoFVNOOSPvZUAn4apdKTQAZu1kZttVw9aofvXI=; b=mzUy4Wle6z4dFFyHEREwh7vgGItMUFcpemubtaAdk5fUpaiToSI1DQwuE0jOopNwwj Cyd3xxlwWnW9PrIoAxFVIHlISD8txq1LiZLPAtk9Ls1arEpUxDSrnOkVzxfEGGeqmv1V IKuAiJqBA1hI15sCVIokQ5Se6iCUz2WRKHZCW5xAdBXzOTSxVmjiYLfj4sGD63CAI8cA Xh94zG41FDSkWJroOsyYeTJaN9J55p4UXnUYohP6GOnOrYKxdDCGaatCMwVqqU0xl0KZ jZUO144pqWFP0Dz0WQQYNuy9PIM1y2hJNSDo5nmPHIdk3ryruDMhVMQM4w7aQU77q9eU BfUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=w33mdIoFVNOOSPvZUAn4apdKTQAZu1kZttVw9aofvXI=; b=G2ySjt4gA0pT4fJWcF1ufpVxM5bsSPl41WfDzPYIqCyr7waB4CjVX0FeqL/0dRGI+p +Oy0CeWY2Xf9GFRCMNwtqk0PxMayBbQWPWywKUdYFpihv8gCck+jDAMHQjqRSs0zSPBb sqgxZXqfgL5UQrfYp3ynXnuEsNcc7mpxSDfFqVXg3MnPjklmaWhBggJROWvM5zpst1fO qF693Ei7M8CHT+IGL0bkTdZOOYUe3Oy9IX4mM7AUpBZAFzmV4wdsT15JF4XzZxIL6pqZ MhfNTXOzb/mK39YI5rrcIqIpdz82WWuhj7idOyjuW1Y//a7KRtDcoOelEHyyagq+kUHk CR+g== X-Gm-Message-State: AOAM533GPfxdpS5yQ954w/fTbtAJrkJSLSPCz2LM4YAC1Bgu2aFNxgjZ MRFV9o0CpGThPIB73nN7D5D+C7sYJymXHg== X-Google-Smtp-Source: ABdhPJxZz4I9uR7M7BoDgQLo9fTd5ifEvJIkHqL4rLsAFhGXO4o+VxBe7qwu7hUB76SDv/fLsyFCLA== X-Received: by 2002:a05:600c:4313:b0:38e:b150:2f8e with SMTP id p19-20020a05600c431300b0038eb1502f8emr18279843wme.198.1650347509213; Mon, 18 Apr 2022 22:51:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 42/53] thread-posix: implement Semaphore with QemuCond and QemuMutex Date: Tue, 19 Apr 2022 07:50:58 +0200 Message-Id: <20220419055109.142788-43-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::330; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: "Longpeng\(Mike\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650353175138100001 Content-Type: text/plain; charset="utf-8" From: "Longpeng(Mike)" Now that QemuSemaphore is implemented through pthread_cond_t only, we can u= se QemuCond and QemuMutex to make the code smaller. Features such as mutex tracing and CLOCK_MONOTONIC timedwait are supported in qemu-sem naturally. Signed-off-by: Longpeng(Mike) Message-Id: <20220222090507.2028-4-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini --- include/qemu/thread-posix.h | 5 +- util/qemu-thread-posix.c | 105 +++++++++++------------------------- 2 files changed, 34 insertions(+), 76 deletions(-) diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index 5466608d7c..5f2f3d1386 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -27,10 +27,9 @@ struct QemuCond { }; =20 struct QemuSemaphore { - pthread_mutex_t lock; - pthread_cond_t cond; + QemuMutex mutex; + QemuCond cond; unsigned int count; - bool initialized; }; =20 struct QemuEvent { diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index f6a34eed2f..8505d8c60f 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -222,16 +222,15 @@ void qemu_cond_wait_impl(QemuCond *cond, QemuMutex *m= utex, const char *file, con error_exit(err, __func__); } =20 -bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMutex *mutex, int ms, - const char *file, const int line) +static bool +qemu_cond_timedwait_ts(QemuCond *cond, QemuMutex *mutex, struct timespec *= ts, + const char *file, const int line) { int err; - struct timespec ts; =20 assert(cond->initialized); trace_qemu_mutex_unlock(mutex, file, line); - compute_abs_deadline(&ts, ms); - err =3D pthread_cond_timedwait(&cond->cond, &mutex->lock, &ts); + err =3D pthread_cond_timedwait(&cond->cond, &mutex->lock, ts); trace_qemu_mutex_locked(mutex, file, line); if (err && err !=3D ETIMEDOUT) { error_exit(err, __func__); @@ -239,113 +238,73 @@ bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMu= tex *mutex, int ms, return err !=3D ETIMEDOUT; } =20 +bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMutex *mutex, int ms, + const char *file, const int line) +{ + struct timespec ts; + + compute_abs_deadline(&ts, ms); + return qemu_cond_timedwait_ts(cond, mutex, &ts, file, line); +} + void qemu_sem_init(QemuSemaphore *sem, int init) { - pthread_condattr_t attr; - int rc; + qemu_mutex_init(&sem->mutex); + qemu_cond_init(&sem->cond); =20 - rc =3D pthread_mutex_init(&sem->lock, NULL); - if (rc !=3D 0) { - error_exit(rc, __func__); - } - rc =3D pthread_condattr_init(&attr); - if (rc !=3D 0) { - error_exit(rc, __func__); - } -#ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK - rc =3D pthread_condattr_setclock(&attr, qemu_timedwait_clockid()); - if (rc !=3D 0) { - error_exit(rc, __func__); - } -#endif - rc =3D pthread_cond_init(&sem->cond, &attr); - if (rc !=3D 0) { - error_exit(rc, __func__); - } - rc =3D pthread_condattr_destroy(&attr); - if (rc < 0) { - error_exit(rc, __func__); - } if (init < 0) { error_exit(EINVAL, __func__); } sem->count =3D init; - sem->initialized =3D true; } =20 void qemu_sem_destroy(QemuSemaphore *sem) { - int rc; - - assert(sem->initialized); - sem->initialized =3D false; - rc =3D pthread_cond_destroy(&sem->cond); - if (rc < 0) { - error_exit(rc, __func__); - } - rc =3D pthread_mutex_destroy(&sem->lock); - if (rc < 0) { - error_exit(rc, __func__); - } + qemu_cond_destroy(&sem->cond); + qemu_mutex_destroy(&sem->mutex); } =20 void qemu_sem_post(QemuSemaphore *sem) { - int rc; - - assert(sem->initialized); - pthread_mutex_lock(&sem->lock); + qemu_mutex_lock(&sem->mutex); if (sem->count =3D=3D UINT_MAX) { - rc =3D EINVAL; + error_exit(EINVAL, __func__); } else { sem->count++; - rc =3D pthread_cond_signal(&sem->cond); - } - pthread_mutex_unlock(&sem->lock); - if (rc !=3D 0) { - error_exit(rc, __func__); + qemu_cond_signal(&sem->cond); } + qemu_mutex_unlock(&sem->mutex); } =20 int qemu_sem_timedwait(QemuSemaphore *sem, int ms) { - int rc; + bool rc =3D true; struct timespec ts; =20 - assert(sem->initialized); - rc =3D 0; compute_abs_deadline(&ts, ms); - pthread_mutex_lock(&sem->lock); + qemu_mutex_lock(&sem->mutex); while (sem->count =3D=3D 0) { - rc =3D pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); - if (rc =3D=3D ETIMEDOUT) { + rc =3D qemu_cond_timedwait_ts(&sem->cond, &sem->mutex, &ts, + __FILE__, __LINE__); + if (!rc) { /* timeout */ break; } - if (rc !=3D 0) { - error_exit(rc, __func__); - } } - if (rc !=3D ETIMEDOUT) { + if (rc) { --sem->count; } - pthread_mutex_unlock(&sem->lock); - return (rc =3D=3D ETIMEDOUT ? -1 : 0); + qemu_mutex_unlock(&sem->mutex); + return (rc ? 0 : -1); } =20 void qemu_sem_wait(QemuSemaphore *sem) { - int rc; - - assert(sem->initialized); - pthread_mutex_lock(&sem->lock); + qemu_mutex_lock(&sem->mutex); while (sem->count =3D=3D 0) { - rc =3D pthread_cond_wait(&sem->cond, &sem->lock); - if (rc !=3D 0) { - error_exit(rc, __func__); - } + qemu_cond_wait(&sem->cond, &sem->mutex); } --sem->count; - pthread_mutex_unlock(&sem->lock); + qemu_mutex_unlock(&sem->mutex); } =20 #ifdef __linux__ --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650353521551334.40582195506465; Tue, 19 Apr 2022 00:32:01 -0700 (PDT) Received: from localhost ([::1]:34146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiLA-0007rd-CV for importer@patchew.org; Tue, 19 Apr 2022 03:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmH-0001FT-Go for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:59 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:46606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmF-0004Wd-7J for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:53 -0400 Received: by mail-wr1-x435.google.com with SMTP id i20so20892202wrb.13 for ; Mon, 18 Apr 2022 22:51:50 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8NtQvGNLH0RJY6f1LX0AvyNBK6+G9tQlWq49FJBFkgQ=; b=Xd/dEqlDSat/wlf2f/E9HkvczgfFiXvVRF8cdJEdACaYpob+ZMZjKo2cIspDNdrPwW ro4ETOuhzq4xOjGd3mwt6EIeOUfehQtJ52d6nyeUDct0saCz7AR8EhRAANN5njmPB60C mqNQ8HIqpve12l4aPm46plDHp2zWOFEdOSbqq3XKoAvF8yYU12kLHHoX8JE9PGGzTdGL 6pXD02i94zUSb3UEL4tABVf8FpHiLOiC0yuBl1s+ePJHyN28J9m1edejqabnXuDqL1X0 SckZkCq5ghydHTfZnXvrGf3poFRbcn2V0uwiLKb4vpXEcVhy7uZx4KAL99Rstl1Mm6ZD /L7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8NtQvGNLH0RJY6f1LX0AvyNBK6+G9tQlWq49FJBFkgQ=; b=wIiPYNfMWsyaYfcCtnc6g6mXZrM8DFP1qEhhONreVhWwuLvSK6d5tGLYcmuC0U+wYE aKdXH7RsL4BUZT6UiZ4wHak+cQU+yOhrXHHk0BnOBJ3vMxzMa5YrT81EV5vLFmtwSIXx LV0x7u4pv6vtbqXmCUNlgDnLahiPLyLcETylEsx+KtsPqEbgV5M4FZDeyqA3r60OiD9t paMAuM6Az9i182gYQvZ1BnV8Xd+OliE4gy1lBjXBvLeIkaz6wtFGlouQ0Js4tWt+lIwK FPFeZd+2nIWNHMy04GNOrLKweOf7RD6NUvDHKjyqatF7QRgBS5XiZp6ys4vc7i6QycYt 0CsA== X-Gm-Message-State: AOAM533R3Cq8GGonyXad61BxSQTGqT3LGNLMkcJqjQW9hdI0Bch+KFxT +WK0Nm8vG8mM+bTS+/d0T/KkQWOGyC0ypg== X-Google-Smtp-Source: ABdhPJx+pjX3Lc5yv4pW/fHnAci8J+wiRTOCNPIYq6rV2OeU/x9fjjO9zT5eaQpl1ca/qWkl4NKapw== X-Received: by 2002:a05:6000:1883:b0:205:c0cb:33c6 with SMTP id a3-20020a056000188300b00205c0cb33c6mr10808834wri.39.1650347509987; Mon, 18 Apr 2022 22:51:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 43/53] thread-posix: optimize qemu_sem_timedwait with zero timeout Date: Tue, 19 Apr 2022 07:50:59 +0200 Message-Id: <20220419055109.142788-44-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650353523671100001 Content-Type: text/plain; charset="utf-8" In this case there is no need to call pthread_cond_timedwait; the function is just a trywait and waiting on the condition variable would always time out. Signed-off-by: Paolo Bonzini --- util/qemu-thread-posix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 8505d8c60f..ac1d56e673 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -284,8 +284,12 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) compute_abs_deadline(&ts, ms); qemu_mutex_lock(&sem->mutex); while (sem->count =3D=3D 0) { - rc =3D qemu_cond_timedwait_ts(&sem->cond, &sem->mutex, &ts, - __FILE__, __LINE__); + if (ms =3D=3D 0) { + rc =3D false; + } else { + rc =3D qemu_cond_timedwait_ts(&sem->cond, &sem->mutex, &ts, + __FILE__, __LINE__); + } if (!rc) { /* timeout */ break; } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351816979625.7590915738563; Tue, 19 Apr 2022 00:03:36 -0700 (PDT) Received: from localhost ([::1]:58322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghtf-0001oL-BJ for importer@patchew.org; Tue, 19 Apr 2022 03:03:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmJ-0001Fj-2a for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:00 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:33915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmG-0004XF-5g for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: by mail-wm1-x32a.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so449207wmb.1 for ; Mon, 18 Apr 2022 22:51:51 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aOaUYa7fBDqONojLs85aGCSQRzn8YhTVI4Z+wM5s/uY=; b=FAClG8oaBxdAHPYdI8CmfO8qH4mpHWMgujfR17WACzIyxetg3WMQBfjR8MxrNlP6+Q HjI5pcXKRUAxLHgGsFIwS4+NBilsjNpvY4hCHTzRoleph5o90ZjWfff/dTnOdx/JT62U qVQKIoTPSaHBQMhE8UBnz0NJjRLJAl4ZpNltJgQOF8+FHExLcQtP14JtKUQhrJeo2Sw4 5m0JFtLxW93ws8kQJlzL9w0A2zX3U2nX/vD0hw0cu/QXIRMR9GCdUw6kZZN2q7kOa/P8 sL8IBMB5gQMcxjWCSLUYJFTsE8Y1aY2+UYnZCcuy6OGqFRpCRi+PBy+Xfm98j8rFxPmK KwLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aOaUYa7fBDqONojLs85aGCSQRzn8YhTVI4Z+wM5s/uY=; b=kFLXnFHkdcGMNSjAgIE9isZjgE8CMnirNpPJmIEBMn2KzClNoWbmeg/YvmGyyamzxA a1SQ5FIXbXO2/f9ZVaSa5Rajyt4t6f+4gXgbpZupaW5jDbMaaVVSFIP2YF9QCLB0mdgz j5TTE28+68VcErWJsOHNE8XmyZwpNR3SeilWXsLDh1IrRkbh0zUVEOP3HC6KNI1OiVLI Ni24C6jFQNWMCg6p+vvvy6N8CSDGvSu1e0jj9wEFkxn3BFY4BXxjBPrANdqGVUJAmYL1 FpLvUNhZSfiRg4sXDC9t7K9CCjTom0E1hxYQ2vkeIOrHguJwDkjRLptWlz3U0iwWW62s kziQ== X-Gm-Message-State: AOAM531no94y9IjnxyOrHe8B1ZrUniDSwv55UGMy4WOZzaReqevhg7kW 4AGDUuHyjnxdjRYZzpvL157Y/SO/tsd06g== X-Google-Smtp-Source: ABdhPJy+xmqirKXTweLXjse4KG9tLOqTnoRSzRzWyxUiCC84xlC7UdwmihyQg9IF57WGs+BvQAAVHw== X-Received: by 2002:a05:600c:3588:b0:392:91be:4575 with SMTP id p8-20020a05600c358800b0039291be4575mr10090807wmq.149.1650347510901; Mon, 18 Apr 2022 22:51:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 44/53] hyperv: SControl is optional to enable SynIc Date: Tue, 19 Apr 2022 07:51:00 +0200 Message-Id: <20220419055109.142788-45-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::32a; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Emanuele Giuseppe Esposito , Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351819271100001 Content-Type: text/plain; charset="utf-8" From: Jon Doron SynIc can be enabled regardless of the SControl mechanisim which can register a GSI for a given SintRoute. This behaviour can achived by setting enabling SIMP and then the guest will poll on the message slot. Once there is another message pending the host will set the message slot with the pending flag. When the guest polls from the message slot, in case the pending flag is set it will write to the HV_X64_MSR_EOM indicating it has cleared the slot and we can try and push our message again. Signed-off-by: Jon Doron Reviewed-by: Emanuele Giuseppe Esposito Message-Id: <20220216102500.692781-2-arilou@gmail.com> Signed-off-by: Paolo Bonzini --- hw/hyperv/hyperv.c | 109 +++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index cb1074f234..8b832566c1 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -27,13 +27,16 @@ struct SynICState { =20 CPUState *cs; =20 - bool enabled; + bool sctl_enabled; hwaddr msg_page_addr; hwaddr event_page_addr; MemoryRegion msg_page_mr; MemoryRegion event_page_mr; struct hyperv_message_page *msg_page; struct hyperv_event_flags_page *event_page; + + QemuMutex sint_routes_mutex; + QLIST_HEAD(, HvSintRoute) sint_routes; }; =20 #define TYPE_SYNIC "hyperv-synic" @@ -51,11 +54,11 @@ static SynICState *get_synic(CPUState *cs) return SYNIC(object_resolve_path_component(OBJECT(cs), "synic")); } =20 -static void synic_update(SynICState *synic, bool enable, +static void synic_update(SynICState *synic, bool sctl_enable, hwaddr msg_page_addr, hwaddr event_page_addr) { =20 - synic->enabled =3D enable; + synic->sctl_enabled =3D sctl_enable; if (synic->msg_page_addr !=3D msg_page_addr) { if (synic->msg_page_addr) { memory_region_del_subregion(get_system_memory(), @@ -80,7 +83,7 @@ static void synic_update(SynICState *synic, bool enable, } } =20 -void hyperv_synic_update(CPUState *cs, bool enable, +void hyperv_synic_update(CPUState *cs, bool sctl_enable, hwaddr msg_page_addr, hwaddr event_page_addr) { SynICState *synic =3D get_synic(cs); @@ -89,7 +92,7 @@ void hyperv_synic_update(CPUState *cs, bool enable, return; } =20 - synic_update(synic, enable, msg_page_addr, event_page_addr); + synic_update(synic, sctl_enable, msg_page_addr, event_page_addr); } =20 static void synic_realize(DeviceState *dev, Error **errp) @@ -110,16 +113,20 @@ static void synic_realize(DeviceState *dev, Error **e= rrp) sizeof(*synic->event_page), &error_abort); synic->msg_page =3D memory_region_get_ram_ptr(&synic->msg_page_mr); synic->event_page =3D memory_region_get_ram_ptr(&synic->event_page_mr); + qemu_mutex_init(&synic->sint_routes_mutex); + QLIST_INIT(&synic->sint_routes); =20 g_free(msgp_name); g_free(eventp_name); } + static void synic_reset(DeviceState *dev) { SynICState *synic =3D SYNIC(dev); memset(synic->msg_page, 0, sizeof(*synic->msg_page)); memset(synic->event_page, 0, sizeof(*synic->event_page)); synic_update(synic, false, 0, 0); + assert(QLIST_EMPTY(&synic->sint_routes)); } =20 static void synic_class_init(ObjectClass *klass, void *data) @@ -214,6 +221,7 @@ struct HvSintRoute { HvSintStagedMessage *staged_msg; =20 unsigned refcount; + QLIST_ENTRY(HvSintRoute) link; }; =20 static CPUState *hyperv_find_vcpu(uint32_t vp_index) @@ -259,7 +267,7 @@ static void cpu_post_msg(CPUState *cs, run_on_cpu_data = data) =20 assert(staged_msg->state =3D=3D HV_STAGED_MSG_BUSY); =20 - if (!synic->enabled || !synic->msg_page_addr) { + if (!synic->msg_page_addr) { staged_msg->status =3D -ENXIO; goto posted; } @@ -343,7 +351,7 @@ int hyperv_set_event_flag(HvSintRoute *sint_route, unsi= gned eventno) if (eventno > HV_EVENT_FLAGS_COUNT) { return -EINVAL; } - if (!synic->enabled || !synic->event_page_addr) { + if (!synic->sctl_enabled || !synic->event_page_addr) { return -ENXIO; } =20 @@ -364,11 +372,12 @@ int hyperv_set_event_flag(HvSintRoute *sint_route, un= signed eventno) HvSintRoute *hyperv_sint_route_new(uint32_t vp_index, uint32_t sint, HvSintMsgCb cb, void *cb_data) { - HvSintRoute *sint_route; - EventNotifier *ack_notifier; + HvSintRoute *sint_route =3D NULL; + EventNotifier *ack_notifier =3D NULL; int r, gsi; CPUState *cs; SynICState *synic; + bool ack_event_initialized =3D false; =20 cs =3D hyperv_find_vcpu(vp_index); if (!cs) { @@ -381,57 +390,77 @@ HvSintRoute *hyperv_sint_route_new(uint32_t vp_index,= uint32_t sint, } =20 sint_route =3D g_new0(HvSintRoute, 1); - r =3D event_notifier_init(&sint_route->sint_set_notifier, false); - if (r) { - goto err; + if (!sint_route) { + return NULL; } =20 + sint_route->synic =3D synic; + sint_route->sint =3D sint; + sint_route->refcount =3D 1; =20 ack_notifier =3D cb ? &sint_route->sint_ack_notifier : NULL; if (ack_notifier) { sint_route->staged_msg =3D g_new0(HvSintStagedMessage, 1); + if (!sint_route->staged_msg) { + goto cleanup_err_sint; + } sint_route->staged_msg->cb =3D cb; sint_route->staged_msg->cb_data =3D cb_data; =20 r =3D event_notifier_init(ack_notifier, false); if (r) { - goto err_sint_set_notifier; + goto cleanup_err_sint; } - event_notifier_set_handler(ack_notifier, sint_ack_handler); + ack_event_initialized =3D true; + } + + /* See if we are done or we need to setup a GSI for this SintRoute */ + if (!synic->sctl_enabled) { + goto cleanup; + } + + /* We need to setup a GSI for this SintRoute */ + r =3D event_notifier_init(&sint_route->sint_set_notifier, false); + if (r) { + goto cleanup_err_sint; } =20 gsi =3D kvm_irqchip_add_hv_sint_route(kvm_state, vp_index, sint); if (gsi < 0) { - goto err_gsi; + goto cleanup_err_sint_notifier; } =20 r =3D kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, &sint_route->sint_set_notifier, ack_notifier, gsi); if (r) { - goto err_irqfd; + goto cleanup_err_irqfd; } sint_route->gsi =3D gsi; - sint_route->synic =3D synic; - sint_route->sint =3D sint; - sint_route->refcount =3D 1; - +cleanup: + qemu_mutex_lock(&synic->sint_routes_mutex); + QLIST_INSERT_HEAD(&synic->sint_routes, sint_route, link); + qemu_mutex_unlock(&synic->sint_routes_mutex); return sint_route; =20 -err_irqfd: +cleanup_err_irqfd: kvm_irqchip_release_virq(kvm_state, gsi); -err_gsi: + +cleanup_err_sint_notifier: + event_notifier_cleanup(&sint_route->sint_set_notifier); + +cleanup_err_sint: if (ack_notifier) { - event_notifier_set_handler(ack_notifier, NULL); - event_notifier_cleanup(ack_notifier); + if (ack_event_initialized) { + event_notifier_set_handler(ack_notifier, NULL); + event_notifier_cleanup(ack_notifier); + } + g_free(sint_route->staged_msg); } -err_sint_set_notifier: - event_notifier_cleanup(&sint_route->sint_set_notifier); -err: - g_free(sint_route); =20 + g_free(sint_route); return NULL; } =20 @@ -442,6 +471,8 @@ void hyperv_sint_route_ref(HvSintRoute *sint_route) =20 void hyperv_sint_route_unref(HvSintRoute *sint_route) { + SynICState *synic; + if (!sint_route) { return; } @@ -452,21 +483,33 @@ void hyperv_sint_route_unref(HvSintRoute *sint_route) return; } =20 - kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, - &sint_route->sint_set_notifier, - sint_route->gsi); - kvm_irqchip_release_virq(kvm_state, sint_route->gsi); + synic =3D sint_route->synic; + qemu_mutex_lock(&synic->sint_routes_mutex); + QLIST_REMOVE(sint_route, link); + qemu_mutex_unlock(&synic->sint_routes_mutex); + + if (sint_route->gsi) { + kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, + &sint_route->sint_set_notifi= er, + sint_route->gsi); + kvm_irqchip_release_virq(kvm_state, sint_route->gsi); + event_notifier_cleanup(&sint_route->sint_set_notifier); + } + if (sint_route->staged_msg) { event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL); event_notifier_cleanup(&sint_route->sint_ack_notifier); g_free(sint_route->staged_msg); } - event_notifier_cleanup(&sint_route->sint_set_notifier); g_free(sint_route); } =20 int hyperv_sint_route_set_sint(HvSintRoute *sint_route) { + if (!sint_route->gsi) { + return 0; + } + return event_notifier_set(&sint_route->sint_set_notifier); } =20 --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650353889891573.6348576584171; Tue, 19 Apr 2022 00:38:09 -0700 (PDT) Received: from localhost ([::1]:42560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiR6-0005pn-3c for importer@patchew.org; Tue, 19 Apr 2022 03:38:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmJ-0001Fk-3X for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:00 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:33363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmG-0004YZ-Vg for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:54 -0400 Received: by mail-wr1-x435.google.com with SMTP id x18so13071955wrc.0 for ; Mon, 18 Apr 2022 22:51:52 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AkY7l6kDlxHzcFVn0UcLaqWXKAyzRmfLqqlDT52LKgo=; b=XnPibxV+b43qbAeDOsHb2itrJ4VrWgunFjvYUtxzVpeHNT4qMiQiX5DWzHEbSv4Jdh OwFK3dutfaeduvEQ26/bo1gr0eJi16ng2FM/bcEJSGimDo7QEdaLyd1muc4pxepCNakV 5k3qChfcHkOa8Ikb+evwCbFOoAGc02FDcEXx6zpGPQfDUrqTWyn/oJozPe09BqcE4UUq +IgPu3QPe3AWCP8KoFR0kAWHE8E2h0ROsb3CKt7VR+9c2HqWo8tF/EwyakwPaLLSPBnq IWdyCg2XTtloZKEUGIjfRgGDrWFttYyF29pQJXTZtPFMTWATIqXL7KU4H6LQRK81IIA/ 8agA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AkY7l6kDlxHzcFVn0UcLaqWXKAyzRmfLqqlDT52LKgo=; b=mHxdkdggiFdhQ/OcKiEINdpnb0YTfGxrSkT5A1Po+FdosWhNR8KQBEhLvU6jBFFQQ+ cdnUO0zeeqO6Q3WndTNd5M/UcGzeKG1xu4rKWw7/oGDWx27j0+MAaXtDNxcOzNzJRx25 rJ7IEd/E8vFFGEIoLmzvX8yLPX1ISAhpzDGIV1pMteXSFBd+MxxCRSWY3h0g6ZYrDgQ9 RI4wvgs8uQy5D+oh1P4j/fkO5+qYyA0cfLj5/1TauaOeaHMfB2js5qbPNYORM9ojIQix u8BFHdxO9wOtX2SXeAdAAJMyHNPMncRso8YK1J01aluReBzwPaRej9ZfXTFGy4/U8aRM 4cHA== X-Gm-Message-State: AOAM531qEWblrPl9ggOrcfK77OC56gyWubzgAtOnoST94qqQI5Iar2sV UEgYqzRdh6NexxAHJivOuSxRqJ9o0fpQyw== X-Google-Smtp-Source: ABdhPJyrUeeDxgnS2q7wOjsFb8rFlwNbtCXATGojwBa75MwKuwXR9VN84TVygjw+dVVKtsia5OzwxQ== X-Received: by 2002:a05:6000:1f15:b0:207:afd5:44ab with SMTP id bv21-20020a0560001f1500b00207afd544abmr10450209wrb.478.1650347511784; Mon, 18 Apr 2022 22:51:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 45/53] hyperv: Add definitions for syndbg Date: Tue, 19 Apr 2022 07:51:01 +0200 Message-Id: <20220419055109.142788-46-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Emanuele Giuseppe Esposito , Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650353892043100001 Content-Type: text/plain; charset="utf-8" From: Jon Doron Add all required definitions for hyperv synthetic debugger interface. Signed-off-by: Jon Doron Reviewed-by: Emanuele Giuseppe Esposito Message-Id: <20220216102500.692781-3-arilou@gmail.com> Signed-off-by: Paolo Bonzini --- include/hw/hyperv/hyperv-proto.h | 52 ++++++++++++++++++++++++++++++++ target/i386/kvm/hyperv-proto.h | 37 +++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/include/hw/hyperv/hyperv-proto.h b/include/hw/hyperv/hyperv-pr= oto.h index 21dc28aee9..4a2297307b 100644 --- a/include/hw/hyperv/hyperv-proto.h +++ b/include/hw/hyperv/hyperv-proto.h @@ -24,12 +24,17 @@ #define HV_STATUS_INVALID_PORT_ID 17 #define HV_STATUS_INVALID_CONNECTION_ID 18 #define HV_STATUS_INSUFFICIENT_BUFFERS 19 +#define HV_STATUS_NOT_ACKNOWLEDGED 20 +#define HV_STATUS_NO_DATA 27 =20 /* * Hypercall numbers */ #define HV_POST_MESSAGE 0x005c #define HV_SIGNAL_EVENT 0x005d +#define HV_POST_DEBUG_DATA 0x0069 +#define HV_RETRIEVE_DEBUG_DATA 0x006a +#define HV_RESET_DEBUG_SESSION 0x006b #define HV_HYPERCALL_FAST (1u << 16) =20 /* @@ -127,4 +132,51 @@ struct hyperv_event_flags_page { struct hyperv_event_flags slot[HV_SINT_COUNT]; }; =20 +/* + * Kernel debugger structures + */ + +/* Options flags for hyperv_reset_debug_session */ +#define HV_DEBUG_PURGE_INCOMING_DATA 0x00000001 +#define HV_DEBUG_PURGE_OUTGOING_DATA 0x00000002 +struct hyperv_reset_debug_session_input { + uint32_t options; +} __attribute__ ((__packed__)); + +struct hyperv_reset_debug_session_output { + uint32_t host_ip; + uint32_t target_ip; + uint16_t host_port; + uint16_t target_port; + uint8_t host_mac[6]; + uint8_t target_mac[6]; +} __attribute__ ((__packed__)); + +/* Options for hyperv_post_debug_data */ +#define HV_DEBUG_POST_LOOP 0x00000001 + +struct hyperv_post_debug_data_input { + uint32_t count; + uint32_t options; + /*uint8_t data[HV_HYP_PAGE_SIZE - 2 * sizeof(uint32_t)];*/ +} __attribute__ ((__packed__)); + +struct hyperv_post_debug_data_output { + uint32_t pending_count; +} __attribute__ ((__packed__)); + +/* Options for hyperv_retrieve_debug_data */ +#define HV_DEBUG_RETRIEVE_LOOP 0x00000001 +#define HV_DEBUG_RETRIEVE_TEST_ACTIVITY 0x00000002 + +struct hyperv_retrieve_debug_data_input { + uint32_t count; + uint32_t options; + uint64_t timeout; +} __attribute__ ((__packed__)); + +struct hyperv_retrieve_debug_data_output { + uint32_t retrieved_count; + uint32_t remaining_count; +} __attribute__ ((__packed__)); #endif diff --git a/target/i386/kvm/hyperv-proto.h b/target/i386/kvm/hyperv-proto.h index 89f81afda7..e40e59411c 100644 --- a/target/i386/kvm/hyperv-proto.h +++ b/target/i386/kvm/hyperv-proto.h @@ -19,6 +19,9 @@ #define HV_CPUID_ENLIGHTMENT_INFO 0x40000004 #define HV_CPUID_IMPLEMENT_LIMITS 0x40000005 #define HV_CPUID_NESTED_FEATURES 0x4000000A +#define HV_CPUID_SYNDBG_VENDOR_AND_MAX_FUNCTIONS 0x40000080 +#define HV_CPUID_SYNDBG_INTERFACE 0x40000081 +#define HV_CPUID_SYNDBG_PLATFORM_CAPABILITIES 0x40000082 #define HV_CPUID_MIN 0x40000005 #define HV_CPUID_MAX 0x4000ffff #define HV_HYPERVISOR_PRESENT_BIT 0x80000000 @@ -55,8 +58,14 @@ #define HV_GUEST_IDLE_STATE_AVAILABLE (1u << 5) #define HV_FREQUENCY_MSRS_AVAILABLE (1u << 8) #define HV_GUEST_CRASH_MSR_AVAILABLE (1u << 10) +#define HV_FEATURE_DEBUG_MSRS_AVAILABLE (1u << 11) #define HV_STIMER_DIRECT_MODE_AVAILABLE (1u << 19) =20 +/* + * HV_CPUID_FEATURES.EBX bits + */ +#define HV_PARTITION_DEBUGGING_ALLOWED (1u << 12) + /* * HV_CPUID_ENLIGHTMENT_INFO.EAX bits */ @@ -72,6 +81,11 @@ #define HV_ENLIGHTENED_VMCS_RECOMMENDED (1u << 14) #define HV_NO_NONARCH_CORESHARING (1u << 18) =20 +/* + * HV_CPUID_SYNDBG_PLATFORM_CAPABILITIES.EAX bits + */ +#define HV_SYNDBG_CAP_ALLOW_KERNEL_DEBUGGING (1u << 1) + /* * Basic virtualized MSRs */ @@ -130,6 +144,18 @@ #define HV_X64_MSR_STIMER3_CONFIG 0x400000B6 #define HV_X64_MSR_STIMER3_COUNT 0x400000B7 =20 +/* + * Hyper-V Synthetic debug options MSR + */ +#define HV_X64_MSR_SYNDBG_CONTROL 0x400000F1 +#define HV_X64_MSR_SYNDBG_STATUS 0x400000F2 +#define HV_X64_MSR_SYNDBG_SEND_BUFFER 0x400000F3 +#define HV_X64_MSR_SYNDBG_RECV_BUFFER 0x400000F4 +#define HV_X64_MSR_SYNDBG_PENDING_BUFFER 0x400000F5 +#define HV_X64_MSR_SYNDBG_OPTIONS 0x400000FF + +#define HV_X64_SYNDBG_OPTION_USE_HCALLS BIT(2) + /* * Guest crash notification MSRs */ @@ -168,5 +194,16 @@ =20 #define HV_STIMER_COUNT 4 =20 +/* + * Synthetic debugger control definitions + */ +#define HV_SYNDBG_CONTROL_SEND (1u << 0) +#define HV_SYNDBG_CONTROL_RECV (1u << 1) +#define HV_SYNDBG_CONTROL_SEND_SIZE(ctl) ((ctl >> 16) & 0xffff) +#define HV_SYNDBG_STATUS_INVALID (0) +#define HV_SYNDBG_STATUS_SEND_SUCCESS (1u << 0) +#define HV_SYNDBG_STATUS_RECV_SUCCESS (1u << 2) +#define HV_SYNDBG_STATUS_RESET (1u << 3) +#define HV_SYNDBG_STATUS_SET_SIZE(st, sz) (st | (sz << 16)) =20 #endif --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650353151686904.1467712442818; Tue, 19 Apr 2022 00:25:51 -0700 (PDT) Received: from localhost ([::1]:53402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiFC-0001jc-Hv for importer@patchew.org; Tue, 19 Apr 2022 03:25:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmN-0001G8-Uv for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:00 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:44567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmI-0004ZT-2l for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:57 -0400 Received: by mail-wm1-x329.google.com with SMTP id r4-20020a05600c35c400b0039295dc1fc3so755777wmq.3 for ; Mon, 18 Apr 2022 22:51:53 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TEy3IEkqWZQkiVq+v8L+kGMwlEA5ZCHc/xedjSdEgf8=; b=VRlPbsMUtBSjdzT/wBR/jBLBOjOnwJPd2cuxvPychVfDrnNCMKm2vOpE+0edMtr+/f o//dpKDxdAUgVrp0S2Kfi2VCnbOMEdRBhq6TxST+tk2u6FxS6tlYUneO1O2nGsXl58ju hsP3GqheJ2ermRknVn8V3fqQ5RaxOO22fgP0wG/ArCG064mTuANiFPDwyt/WnqFSoBkx EyXfIUqnP5c6c+jU+o8d8jCYdgwS1NOGexctnUWDJ2rRgjfoN8d3xhDJvDZcaRjTiezC yZQo9tC+wNb8+M1RJcHIypZkS7eF2+aAbwtXfLOIFybbUTKzAI2bt8w0gqyXKvlHaCS2 RqSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TEy3IEkqWZQkiVq+v8L+kGMwlEA5ZCHc/xedjSdEgf8=; b=M+M1nGZRIl01qZNY6PqPda1TjqTk5GitkCmHIXXrS5xhck+iVNcFzPAdC0NasVe0T7 c6WyfwVECvpTlo/0hFEhvu7/DVbvmuw2lhug9aj993V/kFPbkm8gbrIC94rz/8J2K/Dm uoEkshcJ7U8UlmF6GyiGDsVQs9sAMgn9Kq0oOywR+gIf/PSUDHTEM9ykMMtax/6fHWN9 J7NXMNlICKFXOWNX+ntAPcM6anCR6VI77YvqP+xBxusnNc4vEi5eTFRPRNVmiO2lVaVT fgaVIB3RaWOgDpxhNX9dcR0gIZy9VYRkSfvvw3dMxHxAg598ScJFhMsNBTnto1uUFIW+ XY9Q== X-Gm-Message-State: AOAM533k4FvQDse0O7EE0AyLn7uXACbzSn8CcjfzrJwIhG+nCcIkyI5J 6kxo7F6s8wEvlmrjoBw35zHXhmeUAm4KOQ== X-Google-Smtp-Source: ABdhPJw+E6hwZucZfqVpaifWm4Wajsdu3lx/OV4kg4NyXweNgiXjHM8duxjPKex4eIl2Kr7kkomamA== X-Received: by 2002:a05:600c:1910:b0:392:9143:27d3 with SMTP id j16-20020a05600c191000b00392914327d3mr10578302wmq.206.1650347512746; Mon, 18 Apr 2022 22:51:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 46/53] hyperv: Add support to process syndbg commands Date: Tue, 19 Apr 2022 07:51:02 +0200 Message-Id: <20220419055109.142788-47-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::329; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Emanuele Giuseppe Esposito , Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650353153983100001 Content-Type: text/plain; charset="utf-8" From: Jon Doron SynDbg commands can come from two different flows: 1. Hypercalls, in this mode the data being sent is fully encapsulated network packets. 2. SynDbg specific MSRs, in this mode only the data that needs to be transfered is passed. Signed-off-by: Jon Doron Reviewed-by: Emanuele Giuseppe Esposito Message-Id: <20220216102500.692781-4-arilou@gmail.com> Signed-off-by: Paolo Bonzini --- docs/hyperv.txt | 15 +++ hw/hyperv/hyperv.c | 243 ++++++++++++++++++++++++++++++++++ include/hw/hyperv/hyperv.h | 58 ++++++++ target/i386/cpu.c | 2 + target/i386/cpu.h | 7 + target/i386/kvm/hyperv-stub.c | 6 + target/i386/kvm/hyperv.c | 52 +++++++- target/i386/kvm/kvm.c | 76 ++++++++++- 8 files changed, 451 insertions(+), 8 deletions(-) diff --git a/docs/hyperv.txt b/docs/hyperv.txt index 0417c183a3..33588a0396 100644 --- a/docs/hyperv.txt +++ b/docs/hyperv.txt @@ -225,6 +225,21 @@ default (WS2016). Note: hv-version-id-* are not enlightenments and thus don't enable Hyper-V identification when specified without any other enlightenments. =20 +3.21. hv-syndbg +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Enables Hyper-V synthetic debugger interface, this is a special interface = used +by Windows Kernel debugger to send the packets through, rather than sending +them via serial/network . +When enabled, this enlightenment provides additional communication facilit= ies +to the guest: SynDbg messages. +This new communication is used by Windows Kernel debugger rather than send= ing +packets via serial/network, adding significant performance boost over the = other +comm channels. +This enlightenment requires a VMBus device (-device vmbus-bridge,irq=3D15) +and the follow enlightenments to work: +hv-relaxed,hv_time,hv-vapic,hv-vpindex,hv-synic,hv-runtime,hv-stimer + + 4. Supplementary features =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 8b832566c1..4a1b59cb9d 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -704,3 +704,246 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bo= ol fast) } return HV_STATUS_INVALID_CONNECTION_ID; } + +static HvSynDbgHandler hv_syndbg_handler; +static void *hv_syndbg_context; + +void hyperv_set_syndbg_handler(HvSynDbgHandler handler, void *context) +{ + assert(!hv_syndbg_handler); + hv_syndbg_handler =3D handler; + hv_syndbg_context =3D context; +} + +uint16_t hyperv_hcall_reset_dbg_session(uint64_t outgpa) +{ + uint16_t ret; + HvSynDbgMsg msg; + struct hyperv_reset_debug_session_output *reset_dbg_session =3D NULL; + hwaddr len; + + if (!hv_syndbg_handler) { + ret =3D HV_STATUS_INVALID_HYPERCALL_CODE; + goto cleanup; + } + + len =3D sizeof(*reset_dbg_session); + reset_dbg_session =3D cpu_physical_memory_map(outgpa, &len, 1); + if (!reset_dbg_session || len < sizeof(*reset_dbg_session)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + msg.type =3D HV_SYNDBG_MSG_CONNECTION_INFO; + ret =3D hv_syndbg_handler(hv_syndbg_context, &msg); + if (ret) { + goto cleanup; + } + + reset_dbg_session->host_ip =3D msg.u.connection_info.host_ip; + reset_dbg_session->host_port =3D msg.u.connection_info.host_port; + /* The following fields are only used as validation for KDVM */ + memset(&reset_dbg_session->host_mac, 0, + sizeof(reset_dbg_session->host_mac)); + reset_dbg_session->target_ip =3D msg.u.connection_info.host_ip; + reset_dbg_session->target_port =3D msg.u.connection_info.host_port; + memset(&reset_dbg_session->target_mac, 0, + sizeof(reset_dbg_session->target_mac)); +cleanup: + if (reset_dbg_session) { + cpu_physical_memory_unmap(reset_dbg_session, + sizeof(*reset_dbg_session), 1, len); + } + + return ret; +} + +uint16_t hyperv_hcall_retreive_dbg_data(uint64_t ingpa, uint64_t outgpa, + bool fast) +{ + uint16_t ret; + struct hyperv_retrieve_debug_data_input *debug_data_in =3D NULL; + struct hyperv_retrieve_debug_data_output *debug_data_out =3D NULL; + hwaddr in_len, out_len; + HvSynDbgMsg msg; + + if (fast || !hv_syndbg_handler) { + ret =3D HV_STATUS_INVALID_HYPERCALL_CODE; + goto cleanup; + } + + in_len =3D sizeof(*debug_data_in); + debug_data_in =3D cpu_physical_memory_map(ingpa, &in_len, 0); + if (!debug_data_in || in_len < sizeof(*debug_data_in)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + out_len =3D sizeof(*debug_data_out); + debug_data_out =3D cpu_physical_memory_map(outgpa, &out_len, 1); + if (!debug_data_out || out_len < sizeof(*debug_data_out)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + msg.type =3D HV_SYNDBG_MSG_RECV; + msg.u.recv.buf_gpa =3D outgpa + sizeof(*debug_data_out); + msg.u.recv.count =3D TARGET_PAGE_SIZE - sizeof(*debug_data_out); + msg.u.recv.options =3D debug_data_in->options; + msg.u.recv.timeout =3D debug_data_in->timeout; + msg.u.recv.is_raw =3D true; + ret =3D hv_syndbg_handler(hv_syndbg_context, &msg); + if (ret =3D=3D HV_STATUS_NO_DATA) { + debug_data_out->retrieved_count =3D 0; + debug_data_out->remaining_count =3D debug_data_in->count; + goto cleanup; + } else if (ret !=3D HV_STATUS_SUCCESS) { + goto cleanup; + } + + debug_data_out->retrieved_count =3D msg.u.recv.retrieved_count; + debug_data_out->remaining_count =3D + debug_data_in->count - msg.u.recv.retrieved_count; +cleanup: + if (debug_data_out) { + cpu_physical_memory_unmap(debug_data_out, sizeof(*debug_data_out),= 1, + out_len); + } + + if (debug_data_in) { + cpu_physical_memory_unmap(debug_data_in, sizeof(*debug_data_in), 0, + in_len); + } + + return ret; +} + +uint16_t hyperv_hcall_post_dbg_data(uint64_t ingpa, uint64_t outgpa, bool = fast) +{ + uint16_t ret; + struct hyperv_post_debug_data_input *post_data_in =3D NULL; + struct hyperv_post_debug_data_output *post_data_out =3D NULL; + hwaddr in_len, out_len; + HvSynDbgMsg msg; + + if (fast || !hv_syndbg_handler) { + ret =3D HV_STATUS_INVALID_HYPERCALL_CODE; + goto cleanup; + } + + in_len =3D sizeof(*post_data_in); + post_data_in =3D cpu_physical_memory_map(ingpa, &in_len, 0); + if (!post_data_in || in_len < sizeof(*post_data_in)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + if (post_data_in->count > TARGET_PAGE_SIZE - sizeof(*post_data_in)) { + ret =3D HV_STATUS_INVALID_PARAMETER; + goto cleanup; + } + + out_len =3D sizeof(*post_data_out); + post_data_out =3D cpu_physical_memory_map(outgpa, &out_len, 1); + if (!post_data_out || out_len < sizeof(*post_data_out)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + msg.type =3D HV_SYNDBG_MSG_SEND; + msg.u.send.buf_gpa =3D ingpa + sizeof(*post_data_in); + msg.u.send.count =3D post_data_in->count; + msg.u.send.is_raw =3D true; + ret =3D hv_syndbg_handler(hv_syndbg_context, &msg); + if (ret !=3D HV_STATUS_SUCCESS) { + goto cleanup; + } + + post_data_out->pending_count =3D msg.u.send.pending_count; + ret =3D post_data_out->pending_count ? HV_STATUS_INSUFFICIENT_BUFFERS : + HV_STATUS_SUCCESS; +cleanup: + if (post_data_out) { + cpu_physical_memory_unmap(post_data_out, + sizeof(*post_data_out), 1, out_len); + } + + if (post_data_in) { + cpu_physical_memory_unmap(post_data_in, + sizeof(*post_data_in), 0, in_len); + } + + return ret; +} + +uint32_t hyperv_syndbg_send(uint64_t ingpa, uint32_t count) +{ + HvSynDbgMsg msg; + + if (!hv_syndbg_handler) { + return HV_SYNDBG_STATUS_INVALID; + } + + msg.type =3D HV_SYNDBG_MSG_SEND; + msg.u.send.buf_gpa =3D ingpa; + msg.u.send.count =3D count; + msg.u.send.is_raw =3D false; + if (hv_syndbg_handler(hv_syndbg_context, &msg)) { + return HV_SYNDBG_STATUS_INVALID; + } + + return HV_SYNDBG_STATUS_SEND_SUCCESS; +} + +uint32_t hyperv_syndbg_recv(uint64_t ingpa, uint32_t count) +{ + uint16_t ret; + HvSynDbgMsg msg; + + if (!hv_syndbg_handler) { + return HV_SYNDBG_STATUS_INVALID; + } + + msg.type =3D HV_SYNDBG_MSG_RECV; + msg.u.recv.buf_gpa =3D ingpa; + msg.u.recv.count =3D count; + msg.u.recv.options =3D 0; + msg.u.recv.timeout =3D 0; + msg.u.recv.is_raw =3D false; + ret =3D hv_syndbg_handler(hv_syndbg_context, &msg); + if (ret !=3D HV_STATUS_SUCCESS) { + return 0; + } + + return HV_SYNDBG_STATUS_SET_SIZE(HV_SYNDBG_STATUS_RECV_SUCCESS, + msg.u.recv.retrieved_count); +} + +void hyperv_syndbg_set_pending_page(uint64_t ingpa) +{ + HvSynDbgMsg msg; + + if (!hv_syndbg_handler) { + return; + } + + msg.type =3D HV_SYNDBG_MSG_SET_PENDING_PAGE; + msg.u.pending_page.buf_gpa =3D ingpa; + hv_syndbg_handler(hv_syndbg_context, &msg); +} + +uint64_t hyperv_syndbg_query_options(void) +{ + HvSynDbgMsg msg; + + if (!hv_syndbg_handler) { + return 0; + } + + msg.type =3D HV_SYNDBG_MSG_QUERY_OPTIONS; + if (hv_syndbg_handler(hv_syndbg_context, &msg) !=3D HV_STATUS_SUCCESS)= { + return 0; + } + + return msg.u.query_options.options; +} diff --git a/include/hw/hyperv/hyperv.h b/include/hw/hyperv/hyperv.h index a63ee0003c..015c3524b1 100644 --- a/include/hw/hyperv/hyperv.h +++ b/include/hw/hyperv/hyperv.h @@ -81,4 +81,62 @@ void hyperv_synic_update(CPUState *cs, bool enable, hwaddr msg_page_addr, hwaddr event_page_addr); bool hyperv_is_synic_enabled(void); =20 +/* + * Process HVCALL_RESET_DEBUG_SESSION hypercall. + */ +uint16_t hyperv_hcall_reset_dbg_session(uint64_t outgpa); +/* + * Process HVCALL_RETREIVE_DEBUG_DATA hypercall. + */ +uint16_t hyperv_hcall_retreive_dbg_data(uint64_t ingpa, uint64_t outgpa, + bool fast); +/* + * Process HVCALL_POST_DEBUG_DATA hypercall. + */ +uint16_t hyperv_hcall_post_dbg_data(uint64_t ingpa, uint64_t outgpa, bool = fast); + +uint32_t hyperv_syndbg_send(uint64_t ingpa, uint32_t count); +uint32_t hyperv_syndbg_recv(uint64_t ingpa, uint32_t count); +void hyperv_syndbg_set_pending_page(uint64_t ingpa); +uint64_t hyperv_syndbg_query_options(void); + +typedef enum HvSynthDbgMsgType { + HV_SYNDBG_MSG_CONNECTION_INFO, + HV_SYNDBG_MSG_SEND, + HV_SYNDBG_MSG_RECV, + HV_SYNDBG_MSG_SET_PENDING_PAGE, + HV_SYNDBG_MSG_QUERY_OPTIONS +} HvDbgSynthMsgType; + +typedef struct HvSynDbgMsg { + HvDbgSynthMsgType type; + union { + struct { + uint32_t host_ip; + uint16_t host_port; + } connection_info; + struct { + uint64_t buf_gpa; + uint32_t count; + uint32_t pending_count; + bool is_raw; + } send; + struct { + uint64_t buf_gpa; + uint32_t count; + uint32_t options; + uint64_t timeout; + uint32_t retrieved_count; + bool is_raw; + } recv; + struct { + uint64_t buf_gpa; + } pending_page; + struct { + uint64_t options; + } query_options; + } u; +} HvSynDbgMsg; +typedef uint16_t (*HvSynDbgHandler)(void *context, HvSynDbgMsg *msg); +void hyperv_set_syndbg_handler(HvSynDbgHandler handler, void *context); #endif diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cb6b5467d0..99343be926 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6927,6 +6927,8 @@ static Property x86_cpu_properties[] =3D { HYPERV_FEAT_AVIC, 0), DEFINE_PROP_ON_OFF_AUTO("hv-no-nonarch-coresharing", X86CPU, hyperv_no_nonarch_cs, ON_OFF_AUTO_OFF), + DEFINE_PROP_BIT64("hv-syndbg", X86CPU, hyperv_features, + HYPERV_FEAT_SYNDBG, 0), DEFINE_PROP_BOOL("hv-passthrough", X86CPU, hyperv_passthrough, false), DEFINE_PROP_BOOL("hv-enforce-cpuid", X86CPU, hyperv_enforce_cpuid, fal= se), =20 diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 8422f6c18e..6b61124887 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1085,6 +1085,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWo= rd w, #define HYPERV_FEAT_IPI 13 #define HYPERV_FEAT_STIMER_DIRECT 14 #define HYPERV_FEAT_AVIC 15 +#define HYPERV_FEAT_SYNDBG 16 =20 #ifndef HYPERV_SPINLOCK_NEVER_NOTIFY #define HYPERV_SPINLOCK_NEVER_NOTIFY 0xFFFFFFFF @@ -1601,6 +1602,12 @@ typedef struct CPUArchState { uint64_t msr_hv_hypercall; uint64_t msr_hv_guest_os_id; uint64_t msr_hv_tsc; + uint64_t msr_hv_syndbg_control; + uint64_t msr_hv_syndbg_status; + uint64_t msr_hv_syndbg_send_page; + uint64_t msr_hv_syndbg_recv_page; + uint64_t msr_hv_syndbg_pending_page; + uint64_t msr_hv_syndbg_options; =20 /* Per-VCPU HV MSRs */ uint64_t msr_hv_vapic; diff --git a/target/i386/kvm/hyperv-stub.c b/target/i386/kvm/hyperv-stub.c index 0028527e79..778ed782e6 100644 --- a/target/i386/kvm/hyperv-stub.c +++ b/target/i386/kvm/hyperv-stub.c @@ -27,6 +27,12 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_ex= it *exit) return 0; case KVM_EXIT_HYPERV_HCALL: exit->u.hcall.result =3D HV_STATUS_INVALID_HYPERCALL_CODE; + return 0; + case KVM_EXIT_HYPERV_SYNDBG: + if (!hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) { + return -1; + } + return 0; default: return -1; diff --git a/target/i386/kvm/hyperv.c b/target/i386/kvm/hyperv.c index 26efc1e0e6..9026ef3a81 100644 --- a/target/i386/kvm/hyperv.c +++ b/target/i386/kvm/hyperv.c @@ -81,20 +81,66 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_e= xit *exit) case KVM_EXIT_HYPERV_HCALL: { uint16_t code =3D exit->u.hcall.input & 0xffff; bool fast =3D exit->u.hcall.input & HV_HYPERCALL_FAST; - uint64_t param =3D exit->u.hcall.params[0]; + uint64_t in_param =3D exit->u.hcall.params[0]; + uint64_t out_param =3D exit->u.hcall.params[1]; =20 switch (code) { case HV_POST_MESSAGE: - exit->u.hcall.result =3D hyperv_hcall_post_message(param, fast= ); + exit->u.hcall.result =3D hyperv_hcall_post_message(in_param, f= ast); break; case HV_SIGNAL_EVENT: - exit->u.hcall.result =3D hyperv_hcall_signal_event(param, fast= ); + exit->u.hcall.result =3D hyperv_hcall_signal_event(in_param, f= ast); + break; + case HV_POST_DEBUG_DATA: + exit->u.hcall.result =3D + hyperv_hcall_post_dbg_data(in_param, out_param, fast); + break; + case HV_RETRIEVE_DEBUG_DATA: + exit->u.hcall.result =3D + hyperv_hcall_retreive_dbg_data(in_param, out_param, fast); + break; + case HV_RESET_DEBUG_SESSION: + exit->u.hcall.result =3D + hyperv_hcall_reset_dbg_session(out_param); break; default: exit->u.hcall.result =3D HV_STATUS_INVALID_HYPERCALL_CODE; } return 0; } + + case KVM_EXIT_HYPERV_SYNDBG: + if (!hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) { + return -1; + } + + switch (exit->u.syndbg.msr) { + case HV_X64_MSR_SYNDBG_CONTROL: { + uint64_t control =3D exit->u.syndbg.control; + env->msr_hv_syndbg_control =3D control; + env->msr_hv_syndbg_send_page =3D exit->u.syndbg.send_page; + env->msr_hv_syndbg_recv_page =3D exit->u.syndbg.recv_page; + exit->u.syndbg.status =3D HV_STATUS_SUCCESS; + if (control & HV_SYNDBG_CONTROL_SEND) { + exit->u.syndbg.status =3D + hyperv_syndbg_send(env->msr_hv_syndbg_send_page, + HV_SYNDBG_CONTROL_SEND_SIZE(control)); + } else if (control & HV_SYNDBG_CONTROL_RECV) { + exit->u.syndbg.status =3D + hyperv_syndbg_recv(env->msr_hv_syndbg_recv_page, + TARGET_PAGE_SIZE); + } + break; + } + case HV_X64_MSR_SYNDBG_PENDING_BUFFER: + env->msr_hv_syndbg_pending_page =3D exit->u.syndbg.pending_pag= e; + hyperv_syndbg_set_pending_page(env->msr_hv_syndbg_pending_page= ); + break; + default: + return -1; + } + + return 0; default: return -1; } diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 9cf8e03669..0bb3176edc 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -104,6 +104,7 @@ static bool has_msr_hv_synic; static bool has_msr_hv_stimer; static bool has_msr_hv_frequencies; static bool has_msr_hv_reenlightenment; +static bool has_msr_hv_syndbg_options; static bool has_msr_xss; static bool has_msr_umwait; static bool has_msr_spec_ctrl; @@ -964,6 +965,14 @@ static struct { .bits =3D HV_DEPRECATING_AEOI_RECOMMENDED} } }, + [HYPERV_FEAT_SYNDBG] =3D { + .desc =3D "Enable synthetic kernel debugger channel (hv-syndbg)", + .flags =3D { + {.func =3D HV_CPUID_FEATURES, .reg =3D R_EDX, + .bits =3D HV_FEATURE_DEBUG_MSRS_AVAILABLE} + }, + .dependencies =3D BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_RELAXED) + }, }; =20 static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *cs, int max, @@ -1004,8 +1013,8 @@ static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *= cs, int max, static struct kvm_cpuid2 *get_supported_hv_cpuid(CPUState *cs) { struct kvm_cpuid2 *cpuid; - /* 0x40000000..0x40000005, 0x4000000A, 0x40000080..0x40000080 leaves */ - int max =3D 10; + /* 0x40000000..0x40000005, 0x4000000A, 0x40000080..0x40000082 leaves */ + int max =3D 11; int i; bool do_sys_ioctl; =20 @@ -1118,6 +1127,12 @@ static struct kvm_cpuid2 *get_supported_hv_cpuid_leg= acy(CPUState *cs) entry_feat->eax |=3D HV_SYNTIMERS_AVAILABLE; } =20 + if (has_msr_hv_syndbg_options) { + entry_feat->edx |=3D HV_GUEST_DEBUGGING_AVAILABLE; + entry_feat->edx |=3D HV_FEATURE_DEBUG_MSRS_AVAILABLE; + entry_feat->ebx |=3D HV_PARTITION_DEBUGGING_ALLOWED; + } + if (kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TLBFLUSH) > 0) { entry_recomm->eax |=3D HV_REMOTE_TLB_FLUSH_RECOMMENDED; @@ -1369,12 +1384,22 @@ static int hyperv_fill_cpuids(CPUState *cs, { X86CPU *cpu =3D X86_CPU(cs); struct kvm_cpuid_entry2 *c; - uint32_t cpuid_i =3D 0; + uint32_t signature[3]; + uint32_t cpuid_i =3D 0, max_cpuid_leaf =3D 0; + + max_cpuid_leaf =3D HV_CPUID_IMPLEMENT_LIMITS; + if (hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS)) { + max_cpuid_leaf =3D MAX(max_cpuid_leaf, HV_CPUID_NESTED_FEATURES); + } + + if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) { + max_cpuid_leaf =3D + MAX(max_cpuid_leaf, HV_CPUID_SYNDBG_PLATFORM_CAPABILITIES); + } =20 c =3D &cpuid_ent[cpuid_i++]; c->function =3D HV_CPUID_VENDOR_AND_MAX_FUNCTIONS; - c->eax =3D hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS) ? - HV_CPUID_NESTED_FEATURES : HV_CPUID_IMPLEMENT_LIMITS; + c->eax =3D max_cpuid_leaf; c->ebx =3D cpu->hyperv_vendor_id[0]; c->ecx =3D cpu->hyperv_vendor_id[1]; c->edx =3D cpu->hyperv_vendor_id[2]; @@ -1453,6 +1478,33 @@ static int hyperv_fill_cpuids(CPUState *cs, c->eax =3D cpu->hyperv_nested[0]; } =20 + if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG)) { + c =3D &cpuid_ent[cpuid_i++]; + c->function =3D HV_CPUID_SYNDBG_VENDOR_AND_MAX_FUNCTIONS; + c->eax =3D hyperv_feat_enabled(cpu, HYPERV_FEAT_EVMCS) ? + HV_CPUID_NESTED_FEATURES : HV_CPUID_IMPLEMENT_LIMITS; + memcpy(signature, "Microsoft VS", 12); + c->eax =3D 0; + c->ebx =3D signature[0]; + c->ecx =3D signature[1]; + c->edx =3D signature[2]; + + c =3D &cpuid_ent[cpuid_i++]; + c->function =3D HV_CPUID_SYNDBG_INTERFACE; + memcpy(signature, "VS#1\0\0\0\0\0\0\0\0", 12); + c->eax =3D signature[0]; + c->ebx =3D 0; + c->ecx =3D 0; + c->edx =3D 0; + + c =3D &cpuid_ent[cpuid_i++]; + c->function =3D HV_CPUID_SYNDBG_PLATFORM_CAPABILITIES; + c->eax =3D HV_SYNDBG_CAP_ALLOW_KERNEL_DEBUGGING; + c->ebx =3D 0; + c->ecx =3D 0; + c->edx =3D 0; + } + return cpuid_i; } =20 @@ -2261,6 +2313,9 @@ static int kvm_get_supported_msrs(KVMState *s) case HV_X64_MSR_REENLIGHTENMENT_CONTROL: has_msr_hv_reenlightenment =3D true; break; + case HV_X64_MSR_SYNDBG_OPTIONS: + has_msr_hv_syndbg_options =3D true; + break; case MSR_IA32_SPEC_CTRL: has_msr_spec_ctrl =3D true; break; @@ -3178,6 +3233,11 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, env->msr_hv_tsc_emulation_status); } + if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG) && + has_msr_hv_syndbg_options) { + kvm_msr_entry_add(cpu, HV_X64_MSR_SYNDBG_OPTIONS, + hyperv_syndbg_query_options()); + } } if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VAPIC)) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, @@ -3619,6 +3679,9 @@ static int kvm_get_msrs(X86CPU *cpu) kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_CONTROL, 0); kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, 0); } + if (has_msr_hv_syndbg_options) { + kvm_msr_entry_add(cpu, HV_X64_MSR_SYNDBG_OPTIONS, 0); + } if (has_msr_hv_crash) { int j; =20 @@ -3910,6 +3973,9 @@ static int kvm_get_msrs(X86CPU *cpu) case HV_X64_MSR_TSC_EMULATION_STATUS: env->msr_hv_tsc_emulation_status =3D msrs[i].data; break; + case HV_X64_MSR_SYNDBG_OPTIONS: + env->msr_hv_syndbg_options =3D msrs[i].data; + break; case MSR_MTRRdefType: env->mtrr_deftype =3D msrs[i].data; break; --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650351200305112.5780259859705; Mon, 18 Apr 2022 23:53:20 -0700 (PDT) Received: from localhost ([::1]:46564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghjj-0001yj-2l for importer@patchew.org; Tue, 19 Apr 2022 02:53:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmN-0001G9-VA for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:00 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmI-0004Zy-Ui for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:51:56 -0400 Received: by mail-wr1-x436.google.com with SMTP id bv16so3774529wrb.9 for ; Mon, 18 Apr 2022 22:51:54 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9/KvT5CgXU4wmhLYAO5op7r+QKpihbzo7jOY9w1iZVE=; b=QxIp/FccaWqkJQUW8O8viSUGOHCpKzwnBTmZ2ToW3QzxsObD8U043qFrFq9ih8bME1 EK68/k+T13DP8yclZyhXEEDyqRygoJIV0GwjHjyp1dtEvAa2OEaFAEX6h/pdI3qPxFHF bFukXvvgjXnN2Sv16tbvyX62vw510NCijGExV8wlaDwzCjEfAFjk015oWLeLPpoxHSCD sC56waQLUFF/48BziC2O4Xa2rJo+DobGECOgOhkEyg1HK2OJgUPCyD5SIgTz/qvMetYJ NHpacrZN2OOSUkUjbk6o0HwLrUp4zstbh4isir5OWomDWp30dJmxf6zQflBtvYcvOtKA RVmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=9/KvT5CgXU4wmhLYAO5op7r+QKpihbzo7jOY9w1iZVE=; b=rhbcLBJLcL1IBiVw2UcT2n8AA4w40HVfBiMSPbMh9dyvXINsCmf/Y+KZw2/g67grDQ R5gD4KJh7HYViRJBhwDAQlKnRBLBcco56K+3wNESQCdtRoJZp+ThQFt19CXRjJGUZ4QY C5hNCYMc4u2z7Okvcl3rofLjcT1Ej0TDrYxmVaL+xZpwlHNMiVQrbCi/YGWNekV2IKtf LmvUyymsXOoh67s23UPAfuTchSthLp3xv8kcPQvLh7xKXaFJukM2ENT450bztc+WubPs QgwqpPrTWpL98eOOSGmo2yRrbGFvdjW9iRPBkCvcEtxwud4ob4zDilm3jUe4xHMFIPEI +ofQ== X-Gm-Message-State: AOAM533iz8RlMyMk6lZhx6u44FiDzao/tL3bSBjLaCVN13UhkId33LBV HrS2bsI8P4saIHCnObFstEFwtuTbtC6MjQ== X-Google-Smtp-Source: ABdhPJwPq78fp+4gXk2J91Tt1aDsdSU+5kh1UFO01AODtHNN0EmkvMFT8hJtDCfhIRET3A1iZrzIcg== X-Received: by 2002:a05:6000:38b:b0:20a:923a:3aea with SMTP id u11-20020a056000038b00b0020a923a3aeamr6846631wrf.294.1650347513684; Mon, 18 Apr 2022 22:51:53 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 47/53] hw: hyperv: Initial commit for Synthetic Debugging device Date: Tue, 19 Apr 2022 07:51:03 +0200 Message-Id: <20220419055109.142788-48-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::436; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Emanuele Giuseppe Esposito , Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650351202248100001 Content-Type: text/plain; charset="utf-8" From: Jon Doron Signed-off-by: Jon Doron Reviewed-by: Emanuele Giuseppe Esposito Message-Id: <20220216102500.692781-5-arilou@gmail.com> Signed-off-by: Paolo Bonzini --- hw/hyperv/Kconfig | 5 + hw/hyperv/meson.build | 1 + hw/hyperv/syndbg.c | 402 ++++++++++++++++++++++++++++++++++++++++++ target/i386/kvm/kvm.c | 6 + 4 files changed, 414 insertions(+) create mode 100644 hw/hyperv/syndbg.c diff --git a/hw/hyperv/Kconfig b/hw/hyperv/Kconfig index 3fbfe41c9e..fcf65903bd 100644 --- a/hw/hyperv/Kconfig +++ b/hw/hyperv/Kconfig @@ -11,3 +11,8 @@ config VMBUS bool default y depends on HYPERV + +config SYNDBG + bool + default y + depends on VMBUS diff --git a/hw/hyperv/meson.build b/hw/hyperv/meson.build index 1367e2994f..b43f119ea5 100644 --- a/hw/hyperv/meson.build +++ b/hw/hyperv/meson.build @@ -1,3 +1,4 @@ specific_ss.add(when: 'CONFIG_HYPERV', if_true: files('hyperv.c')) specific_ss.add(when: 'CONFIG_HYPERV_TESTDEV', if_true: files('hyperv_test= dev.c')) specific_ss.add(when: 'CONFIG_VMBUS', if_true: files('vmbus.c')) +specific_ss.add(when: 'CONFIG_SYNDBG', if_true: files('syndbg.c')) diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c new file mode 100644 index 0000000000..89ae19b9aa --- /dev/null +++ b/hw/hyperv/syndbg.c @@ -0,0 +1,402 @@ +/* + * QEMU Hyper-V Synthetic Debugging device + * + * 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/ctype.h" +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qemu/main-loop.h" +#include "qemu/sockets.h" +#include "qemu-common.h" +#include "qapi/error.h" +#include "migration/vmstate.h" +#include "hw/qdev-properties.h" +#include "hw/loader.h" +#include "cpu.h" +#include "hw/hyperv/hyperv.h" +#include "hw/hyperv/vmbus-bridge.h" +#include "hw/hyperv/hyperv-proto.h" +#include "net/net.h" +#include "net/eth.h" +#include "net/checksum.h" +#include "trace.h" + +#define TYPE_HV_SYNDBG "hv-syndbg" + +typedef struct HvSynDbg { + DeviceState parent_obj; + + char *host_ip; + uint16_t host_port; + bool use_hcalls; + + uint32_t target_ip; + struct sockaddr_in servaddr; + int socket; + bool has_data_pending; + uint64_t pending_page_gpa; +} HvSynDbg; + +#define HVSYNDBG(obj) OBJECT_CHECK(HvSynDbg, (obj), TYPE_HV_SYNDBG) + +/* returns NULL unless there is exactly one HV Synth debug device */ +static HvSynDbg *hv_syndbg_find(void) +{ + /* Returns NULL unless there is exactly one hvsd device */ + return HVSYNDBG(object_resolve_path_type("", TYPE_HV_SYNDBG, NULL)); +} + +static void set_pending_state(HvSynDbg *syndbg, bool has_pending) +{ + hwaddr out_len; + void *out_data; + + syndbg->has_data_pending =3D has_pending; + + if (!syndbg->pending_page_gpa) { + return; + } + + out_len =3D 1; + out_data =3D cpu_physical_memory_map(syndbg->pending_page_gpa, &out_le= n, 1); + if (out_data) { + *(uint8_t *)out_data =3D !!has_pending; + cpu_physical_memory_unmap(out_data, out_len, 1, out_len); + } +} + +static bool get_udb_pkt_data(void *p, uint32_t len, uint32_t *data_ofs, + uint32_t *src_ip) +{ + uint32_t offset, curr_len =3D len; + + if (curr_len < sizeof(struct eth_header) || + (be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto) !=3D ETH_P_IP)) { + return false; + } + offset =3D sizeof(struct eth_header); + curr_len -=3D sizeof(struct eth_header); + + if (curr_len < sizeof(struct ip_header) || + PKT_GET_IP_HDR(p)->ip_p !=3D IP_PROTO_UDP) { + return false; + } + offset +=3D PKT_GET_IP_HDR_LEN(p); + curr_len -=3D PKT_GET_IP_HDR_LEN(p); + + if (curr_len < sizeof(struct udp_header)) { + return false; + } + + offset +=3D sizeof(struct udp_header); + *data_ofs =3D offset; + *src_ip =3D PKT_GET_IP_HDR(p)->ip_src; + return true; +} + +static uint16_t handle_send_msg(HvSynDbg *syndbg, uint64_t ingpa, + uint32_t count, bool is_raw, + uint32_t *pending_count) +{ + uint16_t ret; + hwaddr data_len; + void *debug_data =3D NULL; + uint32_t udp_data_ofs =3D 0; + const void *pkt_data; + int sent_count; + + data_len =3D count; + debug_data =3D cpu_physical_memory_map(ingpa, &data_len, 0); + if (!debug_data || data_len < count) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + if (is_raw && + !get_udb_pkt_data(debug_data, count, &udp_data_ofs, + &syndbg->target_ip)) { + ret =3D HV_STATUS_SUCCESS; + goto cleanup; + } + + pkt_data =3D (const void *)((uintptr_t)debug_data + udp_data_ofs); + sent_count =3D sendto(syndbg->socket, pkt_data, count - udp_data_ofs, + MSG_NOSIGNAL, NULL, 0); + if (sent_count =3D=3D -1) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup; + } + + *pending_count =3D count - (sent_count + udp_data_ofs); + ret =3D HV_STATUS_SUCCESS; +cleanup: + if (debug_data) { + cpu_physical_memory_unmap(debug_data, count, 0, data_len); + } + + return ret; +} + +#define UDP_PKT_HEADER_SIZE \ + (sizeof(struct eth_header) + sizeof(struct ip_header) +\ + sizeof(struct udp_header)) + +static bool create_udp_pkt(HvSynDbg *syndbg, void *pkt, uint32_t pkt_len, + void *udp_data, uint32_t udp_data_len) +{ + struct udp_header *udp_part; + + if (pkt_len < (UDP_PKT_HEADER_SIZE + udp_data_len)) { + return false; + } + + /* Setup the eth */ + memset(&PKT_GET_ETH_HDR(pkt)->h_source, 0, ETH_ALEN); + memset(&PKT_GET_ETH_HDR(pkt)->h_dest, 0, ETH_ALEN); + PKT_GET_ETH_HDR(pkt)->h_proto =3D cpu_to_be16(ETH_P_IP); + + /* Setup the ip */ + PKT_GET_IP_HDR(pkt)->ip_ver_len =3D + (4 << 4) | (sizeof(struct ip_header) >> 2); + PKT_GET_IP_HDR(pkt)->ip_tos =3D 0; + PKT_GET_IP_HDR(pkt)->ip_id =3D 0; + PKT_GET_IP_HDR(pkt)->ip_off =3D 0; + PKT_GET_IP_HDR(pkt)->ip_ttl =3D 64; /* IPDEFTTL */ + PKT_GET_IP_HDR(pkt)->ip_p =3D IP_PROTO_UDP; + PKT_GET_IP_HDR(pkt)->ip_src =3D syndbg->servaddr.sin_addr.s_addr; + PKT_GET_IP_HDR(pkt)->ip_dst =3D syndbg->target_ip; + PKT_GET_IP_HDR(pkt)->ip_len =3D + cpu_to_be16(sizeof(struct ip_header) + sizeof(struct udp_header) + + udp_data_len); + eth_fix_ip4_checksum(PKT_GET_IP_HDR(pkt), PKT_GET_IP_HDR_LEN(pkt)); + + udp_part =3D (struct udp_header *)((uintptr_t)pkt + + sizeof(struct eth_header) + + PKT_GET_IP_HDR_LEN(pkt)); + udp_part->uh_sport =3D syndbg->servaddr.sin_port; + udp_part->uh_dport =3D syndbg->servaddr.sin_port; + udp_part->uh_ulen =3D cpu_to_be16(sizeof(struct udp_header) + udp_data= _len); + memcpy(udp_part + 1, udp_data, udp_data_len); + net_checksum_calculate(pkt, UDP_PKT_HEADER_SIZE + udp_data_len, CSUM_A= LL); + return true; +} + +static uint16_t handle_recv_msg(HvSynDbg *syndbg, uint64_t outgpa, + uint32_t count, bool is_raw, uint32_t opti= ons, + uint64_t timeout, uint32_t *retrieved_coun= t) +{ + uint16_t ret; + uint8_t data_buf[TARGET_PAGE_SIZE - UDP_PKT_HEADER_SIZE]; + hwaddr out_len; + void *out_data; + ssize_t recv_byte_count; + + /* TODO: Handle options and timeout */ + (void)options; + (void)timeout; + + if (!syndbg->has_data_pending) { + recv_byte_count =3D 0; + } else { + recv_byte_count =3D recv(syndbg->socket, data_buf, + MIN(sizeof(data_buf), count), MSG_WAITALL); + if (recv_byte_count =3D=3D -1) { + return HV_STATUS_INVALID_PARAMETER; + } + } + + if (!recv_byte_count) { + *retrieved_count =3D 0; + return HV_STATUS_NO_DATA; + } + + set_pending_state(syndbg, false); + + out_len =3D recv_byte_count; + if (is_raw) { + out_len +=3D UDP_PKT_HEADER_SIZE; + } + out_data =3D cpu_physical_memory_map(outgpa, &out_len, 1); + if (!out_data) { + return HV_STATUS_INSUFFICIENT_MEMORY; + } + + if (is_raw && + !create_udp_pkt(syndbg, out_data, + recv_byte_count + UDP_PKT_HEADER_SIZE, + data_buf, recv_byte_count)) { + ret =3D HV_STATUS_INSUFFICIENT_MEMORY; + goto cleanup_out_data; + } else if (!is_raw) { + memcpy(out_data, data_buf, recv_byte_count); + } + + *retrieved_count =3D recv_byte_count; + if (is_raw) { + *retrieved_count +=3D UDP_PKT_HEADER_SIZE; + } + ret =3D HV_STATUS_SUCCESS; + +cleanup_out_data: + cpu_physical_memory_unmap(out_data, out_len, 1, out_len); + return ret; +} + +static uint16_t hv_syndbg_handler(void *context, HvSynDbgMsg *msg) +{ + HvSynDbg *syndbg =3D context; + uint16_t ret =3D HV_STATUS_INVALID_HYPERCALL_CODE; + + switch (msg->type) { + case HV_SYNDBG_MSG_CONNECTION_INFO: + msg->u.connection_info.host_ip =3D + ntohl(syndbg->servaddr.sin_addr.s_addr); + msg->u.connection_info.host_port =3D + ntohs(syndbg->servaddr.sin_port); + ret =3D HV_STATUS_SUCCESS; + break; + case HV_SYNDBG_MSG_SEND: + ret =3D handle_send_msg(syndbg, msg->u.send.buf_gpa, msg->u.send.c= ount, + msg->u.send.is_raw, &msg->u.send.pending_cou= nt); + break; + case HV_SYNDBG_MSG_RECV: + ret =3D handle_recv_msg(syndbg, msg->u.recv.buf_gpa, msg->u.recv.c= ount, + msg->u.recv.is_raw, msg->u.recv.options, + msg->u.recv.timeout, + &msg->u.recv.retrieved_count); + break; + case HV_SYNDBG_MSG_SET_PENDING_PAGE: + syndbg->pending_page_gpa =3D msg->u.pending_page.buf_gpa; + ret =3D HV_STATUS_SUCCESS; + break; + case HV_SYNDBG_MSG_QUERY_OPTIONS: + msg->u.query_options.options =3D 0; + if (syndbg->use_hcalls) { + msg->u.query_options.options =3D HV_X64_SYNDBG_OPTION_USE_HCAL= LS; + } + ret =3D HV_STATUS_SUCCESS; + break; + default: + break; + } + + return ret; +} + +static void hv_syndbg_recv_event(void *opaque) +{ + HvSynDbg *syndbg =3D opaque; + struct timeval tv; + fd_set rfds; + + tv.tv_sec =3D 0; + tv.tv_usec =3D 0; + FD_ZERO(&rfds); + FD_SET(syndbg->socket, &rfds); + if (select(syndbg->socket + 1, &rfds, NULL, NULL, &tv) > 0) { + set_pending_state(syndbg, true); + } +} + +static void hv_syndbg_realize(DeviceState *dev, Error **errp) +{ + HvSynDbg *syndbg =3D HVSYNDBG(dev); + + if (!hv_syndbg_find()) { + error_setg(errp, "at most one %s device is permitted", TYPE_HV_SYN= DBG); + return; + } + + if (!vmbus_bridge_find()) { + error_setg(errp, "%s device requires vmbus-bridge device", + TYPE_HV_SYNDBG); + return; + } + + /* Parse and host_ip */ + if (qemu_isdigit(syndbg->host_ip[0])) { + syndbg->servaddr.sin_addr.s_addr =3D inet_addr(syndbg->host_ip); + } else { + struct hostent *he =3D gethostbyname(syndbg->host_ip); + if (!he) { + error_setg(errp, "%s failed to resolve host name %s", + TYPE_HV_SYNDBG, syndbg->host_ip); + return; + } + syndbg->servaddr.sin_addr =3D *(struct in_addr *)he->h_addr; + } + + syndbg->socket =3D socket(AF_INET, SOCK_DGRAM, 0); + if (syndbg->socket < 0) { + error_setg(errp, "%s failed to create socket", TYPE_HV_SYNDBG); + return; + } + + qemu_set_nonblock(syndbg->socket); + + syndbg->servaddr.sin_port =3D htons(syndbg->host_port); + syndbg->servaddr.sin_family =3D AF_INET; + if (connect(syndbg->socket, (struct sockaddr *)&syndbg->servaddr, + sizeof(syndbg->servaddr)) < 0) { + closesocket(syndbg->socket); + error_setg(errp, "%s failed to connect to socket", TYPE_HV_SYNDBG); + return; + } + + syndbg->pending_page_gpa =3D 0; + syndbg->has_data_pending =3D false; + hyperv_set_syndbg_handler(hv_syndbg_handler, syndbg); + qemu_set_fd_handler(syndbg->socket, hv_syndbg_recv_event, NULL, syndbg= ); +} + +static void hv_syndbg_unrealize(DeviceState *dev) +{ + HvSynDbg *syndbg =3D HVSYNDBG(dev); + + if (syndbg->socket > 0) { + qemu_set_fd_handler(syndbg->socket, NULL, NULL, NULL); + closesocket(syndbg->socket); + } +} + +static const VMStateDescription vmstate_hv_syndbg =3D { + .name =3D TYPE_HV_SYNDBG, + .unmigratable =3D 1, +}; + +static Property hv_syndbg_properties[] =3D { + DEFINE_PROP_STRING("host_ip", HvSynDbg, host_ip), + DEFINE_PROP_UINT16("host_port", HvSynDbg, host_port, 50000), + DEFINE_PROP_BOOL("use_hcalls", HvSynDbg, use_hcalls, false), + DEFINE_PROP_END_OF_LIST(), +}; + +static void hv_syndbg_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + device_class_set_props(dc, hv_syndbg_properties); + dc->fw_name =3D TYPE_HV_SYNDBG; + dc->vmsd =3D &vmstate_hv_syndbg; + dc->realize =3D hv_syndbg_realize; + dc->unrealize =3D hv_syndbg_unrealize; + dc->user_creatable =3D true; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); +} + +static const TypeInfo hv_syndbg_type_info =3D { + .name =3D TYPE_HV_SYNDBG, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(HvSynDbg), + .class_init =3D hv_syndbg_class_init, +}; + +static void hv_syndbg_register_types(void) +{ + type_register_static(&hv_syndbg_type_info); +} + +type_init(hv_syndbg_register_types) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 0bb3176edc..c885763a5b 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -54,6 +54,8 @@ #include "exec/memattrs.h" #include "trace.h" =20 +#include CONFIG_DEVICES + //#define DEBUG_KVM =20 #ifdef DEBUG_KVM @@ -965,6 +967,7 @@ static struct { .bits =3D HV_DEPRECATING_AEOI_RECOMMENDED} } }, +#ifdef CONFIG_SYNDBG [HYPERV_FEAT_SYNDBG] =3D { .desc =3D "Enable synthetic kernel debugger channel (hv-syndbg)", .flags =3D { @@ -973,6 +976,7 @@ static struct { }, .dependencies =3D BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_RELAXED) }, +#endif }; =20 static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *cs, int max, @@ -3233,11 +3237,13 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, env->msr_hv_tsc_emulation_status); } +#ifdef CONFIG_SYNDBG if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG) && has_msr_hv_syndbg_options) { kvm_msr_entry_add(cpu, HV_X64_MSR_SYNDBG_OPTIONS, hyperv_syndbg_query_options()); } +#endif } if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VAPIC)) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352197933119.38184091764901; Tue, 19 Apr 2022 00:09:57 -0700 (PDT) Received: from localhost ([::1]:35704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nghzo-0005yG-MM for importer@patchew.org; Tue, 19 Apr 2022 03:09:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmP-0001Hz-7u for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:38572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmN-0004aK-HL for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:00 -0400 Received: by mail-wm1-x32d.google.com with SMTP id r187-20020a1c44c4000000b0038ccb70e239so777916wma.3 for ; Mon, 18 Apr 2022 22:51:55 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UKt0DrjvzmY4G9YYzIJzkavU9qGS6+OIBXr7HJbElYM=; b=DjDcA3sD4wmPCGdIe2S4m/uKWbTC7vqSXElw2FT34jj93J7XlcGQ2flzftAs1XVf6V QKnHPuM0VM/HXNWdy5ev9BmALpHBC17S1XcnzbQOClogN0xZ2FMsLUQidOr8Iwk9S6Fs LvR+qxp4L2I/KYU6Q8Q/o7rl8B9/cqXz7dGNyHvHaF0ohR1PvuWTjN73tkyLMduOBxzJ FaUCULYXyAlLF9SqHRRpoCXcdpPp8/rSMWrrWtIbSQVjsH6BqvJIv3p83wr40RecV/+H t7tiVhB2Z1KY2HI9D8YyBlCqb/JDhACJgs3Zfd6jqP2xGwMlEQMRARtbzZcjZ8n+q/ZL pORg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UKt0DrjvzmY4G9YYzIJzkavU9qGS6+OIBXr7HJbElYM=; b=FUsA97M562kpJ9tUKr5xAw1kq3zBUk1NilbSH3Lj/gU0/7+o65mZzvMctqJdUtv3pa N3dRfrWc7CFX0LL1RtSzbT6AGCtcQvpztsleLEYFETp6wxiWx7vgB0kiU8zT2QK/i7gl jzv6U1/OH05Pmywtjsi92J8aaUqrtV5EcuEhyH7wBtN7Av3Be0mh+qCUQQ6p2tkUpEqn D/piynuZ+imzBir8m5d9rixpLasT0kCBiEJ72ckrj0ov3oYkFnlNTTXF8xJnLWStYjcN 3Y7KrDZRGJL+XCPNCs0985XdE+ovvLvojXP1FM79yMvtX98f+iOZz1h4celUjGbWROWP 5R8Q== X-Gm-Message-State: AOAM533hns4dvOFYVIXtime7IiJfLw28/1UqB2miSevhA3lMc3WdnH8b GWo+0I2EhZjzwko0ggnXcLv4ibdbySWs5g== X-Google-Smtp-Source: ABdhPJzAZ/TJsd40vnLU5hnzFg4LIkwCAz208xqSPEtVQMgGrr/fYrsrPVRwnjEC6d1R7VI+FO2dog== X-Received: by 2002:a1c:f605:0:b0:37b:b5de:89a0 with SMTP id w5-20020a1cf605000000b0037bb5de89a0mr14048106wmc.88.1650347514498; Mon, 18 Apr 2022 22:51:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 48/53] s390x: follow qdev tree to detect SCSI device on a CCW bus Date: Tue, 19 Apr 2022 07:51:04 +0200 Message-Id: <20220419055109.142788-49-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::32d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352199613100001 Content-Type: text/plain; charset="utf-8" Do not make assumptions on the parent type of the SCSIDevice, instead use object_dynamic_cast all the way up to the CcwDevice. This is cleaner because there is no guarantee that the bus is on a virtio-scsi device; that is only the case for the default configuration of QEMU's s390x target. Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- hw/s390x/ipl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 84971e537b..2dcc24175d 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -375,14 +375,18 @@ static CcwDevice *s390_get_ccw_device(DeviceState *de= v_st, int *devtype) object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE); if (sd) { - SCSIBus *bus =3D scsi_bus_from_device(sd); - VirtIOSCSI *vdev =3D container_of(bus, VirtIOSCSI, bus); - VirtIOSCSICcw *scsi_ccw =3D container_of(vdev, VirtIOSCSIC= cw, - vdev); - - ccw_dev =3D (CcwDevice *)object_dynamic_cast(OBJECT(scsi_c= cw), - TYPE_CCW_DEVICE= ); - tmp_dt =3D CCW_DEVTYPE_SCSI; + SCSIBus *sbus =3D scsi_bus_from_device(sd); + VirtIODevice *vdev =3D (VirtIODevice *) + object_dynamic_cast(OBJECT(sbus->qbus.parent), + TYPE_VIRTIO_DEVICE); + if (vdev) { + ccw_dev =3D (CcwDevice *) + object_dynamic_cast(OBJECT(qdev_get_parent_bus(DEV= ICE(vdev))->parent), + TYPE_CCW_DEVICE); + if (ccw_dev) { + tmp_dt =3D CCW_DEVTYPE_SCSI; + } + } } } } --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650355469473510.12831412539254; Tue, 19 Apr 2022 01:04:29 -0700 (PDT) Received: from localhost ([::1]:48782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiqZ-0004XO-VL for importer@patchew.org; Tue, 19 Apr 2022 04:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmQ-0001Ip-Qa for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:04 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmN-0004af-NH for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: by mail-wr1-x434.google.com with SMTP id e21so20911836wrc.8 for ; Mon, 18 Apr 2022 22:51:56 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2W5jIL1FBg/6ZA0XImRKz1Nkg1aJ+Tsf3oso25lUHHQ=; b=F5l4bDTSwLq8E+Y6IjLZQUYRIcXyNq8RImtQ9PJktdx6fWvhF0XsL6+nVGGPFgiW1K /e5J1McFRdkQ9MBhIN4k65OYD4kPqBaj3ZWbS9PLYccrKPz4UiuqL8FM6BNvxjRkKm3y DQ6c3z1Fee3rvJLRm2jGfNbZfoczFq8P77TWQaAFfntNL0MUoHE9BZWH/66d4QoUKwsA zMNxkj5V2SdLIF89g+cbGyk/8SiQ3WHIeyUBsrHkNGOmrKBYioz1kJNf7eD7318aLJHI 5sxtdgQ8iFYJJ3M7miVKm8TAmJ8PtLT9qECBupPCmqxnKMr8sX+Gwp3D4yqaD4aEEeVK SPbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2W5jIL1FBg/6ZA0XImRKz1Nkg1aJ+Tsf3oso25lUHHQ=; b=Bt4GJA8RCEujoOT2dIRoP9aitMM97jJiiRRZg8uU/mtL/XpxaebSzW7kFPT3suuw6q gagO35mLpAnhzBEJOK5pIjmeMUok97kKImNlVvK95tmUGbn+CQo4vqufhYhLBDR2TKlv tamMTsMkWQm4RKYHBwndTRXHM17CaA2uH5D77ZMB3i1pdPNYaMqFuvHAr3HsikUsWi09 GucZC2a7bXm2y0G9En479OekCVFUvIoxj+bA3/yfz3WR9tVBd4QhQjB5nD3uuo58ZAGG wgMsrlGplfHwsoW/16kQuviIIeBLl0fIYnhQnUoRXo80w9xz1EiYOMBGksGekhP2ITB4 i55g== X-Gm-Message-State: AOAM531k12Buy1lnJ7tJ2pOd0yiBpVaboaSWtkCkjszK6C6wOv+vFqXH QvsomvXuI4qVY9LI2InasAXLzE+NjRETYQ== X-Google-Smtp-Source: ABdhPJxlgxSo4XCoiqPpTmnxQAOrT04pOiIb+FY5rVTrQkoDs8q8X8IRYqtJA5vJoVoW4bYUGxkyPg== X-Received: by 2002:a05:6000:1a85:b0:205:a234:d0a5 with SMTP id f5-20020a0560001a8500b00205a234d0a5mr10658430wry.126.1650347515478; Mon, 18 Apr 2022 22:51:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 49/53] virtio-ccw: move vhost_ccw_scsi to a separate file Date: Tue, 19 Apr 2022 07:51:05 +0200 Message-Id: <20220419055109.142788-50-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650355470397100001 Content-Type: text/plain; charset="utf-8" Remove unecessary use of #ifdef CONFIG_VHOST_SCSI, instead just use a separate file and a separate rule in meson.build. Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- hw/s390x/meson.build | 1 + hw/s390x/vhost-scsi-ccw.c | 64 ++++++++++++++++++++++++++++++++++++++ hw/s390x/virtio-ccw-scsi.c | 47 ---------------------------- 3 files changed, 65 insertions(+), 47 deletions(-) create mode 100644 hw/s390x/vhost-scsi-ccw.c diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build index 28484256ec..feefe0717e 100644 --- a/hw/s390x/meson.build +++ b/hw/s390x/meson.build @@ -44,6 +44,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: file= s('virtio-ccw-serial.c' if have_virtfs virtio_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-ccw-9p.c'= )) endif +virtio_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-ccw.c'= )) virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-ccw.= c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-= ccw.c')) s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss) diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c new file mode 100644 index 0000000000..b68ddddd1c --- /dev/null +++ b/hw/s390x/vhost-scsi-ccw.c @@ -0,0 +1,64 @@ +/* + * vhost ccw scsi implementation + * + * Copyright 2012, 2015 IBM Corp. + * Author(s): Cornelia Huck + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#include "qemu/osdep.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/virtio.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "virtio-ccw.h" + +static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) +{ + VHostSCSICcw *dev =3D VHOST_SCSI_CCW(ccw_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + + qdev_realize(vdev, BUS(&ccw_dev->bus), errp); +} + +static void vhost_ccw_scsi_instance_init(Object *obj) +{ + VHostSCSICcw *dev =3D VHOST_SCSI_CCW(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_SCSI); +} + +static Property vhost_ccw_scsi_properties[] =3D { + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); + + k->realize =3D vhost_ccw_scsi_realize; + device_class_set_props(dc, vhost_ccw_scsi_properties); + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); +} + +static const TypeInfo vhost_ccw_scsi =3D { + .name =3D TYPE_VHOST_SCSI_CCW, + .parent =3D TYPE_VIRTIO_CCW_DEVICE, + .instance_size =3D sizeof(VHostSCSICcw), + .instance_init =3D vhost_ccw_scsi_instance_init, + .class_init =3D vhost_ccw_scsi_class_init, +}; + +static void virtio_ccw_scsi_register(void) +{ + type_register_static(&vhost_ccw_scsi); +} + +type_init(virtio_ccw_scsi_register) diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c index 6e4beef700..fa706eb550 100644 --- a/hw/s390x/virtio-ccw-scsi.c +++ b/hw/s390x/virtio-ccw-scsi.c @@ -70,56 +70,9 @@ static const TypeInfo virtio_ccw_scsi =3D { .class_init =3D virtio_ccw_scsi_class_init, }; =20 -#ifdef CONFIG_VHOST_SCSI - -static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) -{ - VHostSCSICcw *dev =3D VHOST_SCSI_CCW(ccw_dev); - DeviceState *vdev =3D DEVICE(&dev->vdev); - - qdev_realize(vdev, BUS(&ccw_dev->bus), errp); -} - -static void vhost_ccw_scsi_instance_init(Object *obj) -{ - VHostSCSICcw *dev =3D VHOST_SCSI_CCW(obj); - - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), - TYPE_VHOST_SCSI); -} - -static Property vhost_ccw_scsi_properties[] =3D { - DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, - VIRTIO_CCW_MAX_REV), - DEFINE_PROP_END_OF_LIST(), -}; - -static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); - - k->realize =3D vhost_ccw_scsi_realize; - device_class_set_props(dc, vhost_ccw_scsi_properties); - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); -} - -static const TypeInfo vhost_ccw_scsi =3D { - .name =3D TYPE_VHOST_SCSI_CCW, - .parent =3D TYPE_VIRTIO_CCW_DEVICE, - .instance_size =3D sizeof(VHostSCSICcw), - .instance_init =3D vhost_ccw_scsi_instance_init, - .class_init =3D vhost_ccw_scsi_class_init, -}; - -#endif - static void virtio_ccw_scsi_register(void) { type_register_static(&virtio_ccw_scsi); -#ifdef CONFIG_VHOST_SCSI - type_register_static(&vhost_ccw_scsi); -#endif } =20 type_init(virtio_ccw_scsi_register) --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650352385429845.3747467795096; Tue, 19 Apr 2022 00:13:05 -0700 (PDT) Received: from localhost ([::1]:38748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngi2p-0007zv-Re for importer@patchew.org; Tue, 19 Apr 2022 03:13:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmP-0001I2-Nj for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmN-0004aw-Hb for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:01 -0400 Received: by mail-wr1-x42b.google.com with SMTP id t1so20934558wra.4 for ; Mon, 18 Apr 2022 22:51:57 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eQM8z+11tMyk3iGP749JOfjOB3q97efnzrzjo4EkEco=; b=HL2Go5ViruRZnKXCWLcCwcn5L841ba4bx8nBfn7UyvaEoWx7H/7ZhNpGq969i7xmrx M3z8Ddi7kr1KyM8pE3VcEjymoJuLtfxF3Fw3fwGNk5G7wq2YHr+VRLbWDmCQxaItWsH4 QCF+7hq8og+WxThEeoqBKPs7JXiBzux22WlKObPDSSfnKwnoA2gQaJXfFdJqkwl1LQOd u9Lu9z0/KZ3R2WW2q5uCQCSuvqdmVKKFRkkru2LM1GI108etns06nJB8RqQu+pfDABJi LF5TfWBCY9lAuwCfDwjBHcW1qDl67UwAzr19JDOHGd3fstnvigFt4IMvt8+x9mxYWeCM 2UeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eQM8z+11tMyk3iGP749JOfjOB3q97efnzrzjo4EkEco=; b=txaZrrM3qwci5yoE8Vu5i93aItf+gN1P/3f9EPYqUuIcsvHmdywHbKZjhXHiJo9L1Q mSrqqRVkJn1yfaiP3l4hnxuTcNlgO5PMXjkDMZNCXNmahp44bAJNbZOd5q5jqNONeqA6 emNevnoq3ptRcmqNR24GRPGsMORJPD2VhCshyOhzMxyK26xKR4mh1RV6EyiLKmQJS94k oq2Aqdie1mSv0z/VPiRmtGyAfWsy2HfuQGOTJMeBjggH9TDoE9N6+/ioOQBOOv2V7Y6f Z/idzlcvLgcC0mEOSFOGyE4M+gcxUBbhBUgOgLEtp4ALaHYAIBbxdsBrmtQRfjwPPEPh jCRQ== X-Gm-Message-State: AOAM532Z/aRpqGPm0UebeC5vHaK11zNWi4DvHwDCbOl6PryoW3ydhv1j VExrDx7gkncAXWNq0LMtQW2qJfSRXepfEA== X-Google-Smtp-Source: ABdhPJzg1sLRJIzPyiF3F6MPVEaJw1LJGn3Mi/e6U6fZsVK6wD/2bh9AQb6BQWKP+NsoqYAvqlBcKQ== X-Received: by 2002:a5d:5981:0:b0:20a:8bc4:6731 with SMTP id n1-20020a5d5981000000b0020a8bc46731mr9294656wri.48.1650347516795; Mon, 18 Apr 2022 22:51:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 50/53] virtio-ccw: move device type declarations to .c files Date: Tue, 19 Apr 2022 07:51:06 +0200 Message-Id: <20220419055109.142788-51-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650352387648100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- hw/s390x/vhost-scsi-ccw.c | 9 +++ hw/s390x/vhost-vsock-ccw.c | 9 +++ hw/s390x/virtio-ccw-9p.c | 9 +++ hw/s390x/virtio-ccw-balloon.c | 9 +++ hw/s390x/virtio-ccw-blk.c | 9 +++ hw/s390x/virtio-ccw-crypto.c | 9 +++ hw/s390x/virtio-ccw-gpu.c | 9 +++ hw/s390x/virtio-ccw-input.c | 20 +++++ hw/s390x/virtio-ccw-net.c | 9 +++ hw/s390x/virtio-ccw-rng.c | 9 +++ hw/s390x/virtio-ccw-scsi.c | 9 +++ hw/s390x/virtio-ccw-serial.c | 9 +++ hw/s390x/virtio-ccw.h | 133 ---------------------------------- 13 files changed, 119 insertions(+), 133 deletions(-) diff --git a/hw/s390x/vhost-scsi-ccw.c b/hw/s390x/vhost-scsi-ccw.c index b68ddddd1c..40dc14bbc7 100644 --- a/hw/s390x/vhost-scsi-ccw.c +++ b/hw/s390x/vhost-scsi-ccw.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/vhost-scsi.h" + +#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VHostSCSICcw, VHOST_SCSI_CCW) + +struct VHostSCSICcw { + VirtioCcwDevice parent_obj; + VHostSCSI vdev; +}; =20 static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c index 246416a8f9..07845a9a00 100644 --- a/hw/s390x/vhost-vsock-ccw.c +++ b/hw/s390x/vhost-vsock-ccw.c @@ -12,6 +12,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/vhost-vsock.h" + +#define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VHostVSockCCWState, VHOST_VSOCK_CCW) + +struct VHostVSockCCWState { + VirtioCcwDevice parent_obj; + VHostVSock vdev; +}; =20 static Property vhost_vsock_ccw_properties[] =3D { DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, diff --git a/hw/s390x/virtio-ccw-9p.c b/hw/s390x/virtio-ccw-9p.c index 88c8884fc5..6f931f5994 100644 --- a/hw/s390x/virtio-ccw-9p.c +++ b/hw/s390x/virtio-ccw-9p.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/9pfs/virtio-9p.h" + +#define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(V9fsCCWState, VIRTIO_9P_CCW) + +struct V9fsCCWState { + VirtioCcwDevice parent_obj; + V9fsVirtioState vdev; +}; =20 static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-balloon.c b/hw/s390x/virtio-ccw-balloon.c index 4c7631a433..44287b9bbe 100644 --- a/hw/s390x/virtio-ccw-balloon.c +++ b/hw/s390x/virtio-ccw-balloon.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-balloon.h" + +#define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW) + +struct VirtIOBalloonCcw { + VirtioCcwDevice parent_obj; + VirtIOBalloon vdev; +}; =20 static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **e= rrp) { diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c index 2294ce1ce4..8e0e58b77d 100644 --- a/hw/s390x/virtio-ccw-blk.c +++ b/hw/s390x/virtio-ccw-blk.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-blk.h" + +#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkCcw, VIRTIO_BLK_CCW) + +struct VirtIOBlkCcw { + VirtioCcwDevice parent_obj; + VirtIOBlock vdev; +}; =20 static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c index 358c74fb4b..0fa2f89443 100644 --- a/hw/s390x/virtio-ccw-crypto.c +++ b/hw/s390x/virtio-ccw-crypto.c @@ -14,6 +14,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-crypto.h" + +#define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW) + +struct VirtIOCryptoCcw { + VirtioCcwDevice parent_obj; + VirtIOCrypto vdev; +}; =20 static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) { diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c index 5868a2a070..8d995fcb33 100644 --- a/hw/s390x/virtio-ccw-gpu.c +++ b/hw/s390x/virtio-ccw-gpu.c @@ -14,6 +14,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-gpu.h" + +#define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUCcw, VIRTIO_GPU_CCW) + +struct VirtIOGPUCcw { + VirtioCcwDevice parent_obj; + VirtIOGPU vdev; +}; =20 static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-input.c b/hw/s390x/virtio-ccw-input.c index 83136fbba1..61a07ba38d 100644 --- a/hw/s390x/virtio-ccw-input.c +++ b/hw/s390x/virtio-ccw-input.c @@ -14,6 +14,26 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-input.h" + +#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputCcw, VIRTIO_INPUT_CCW) + +struct VirtIOInputCcw { + VirtioCcwDevice parent_obj; + VirtIOInput vdev; +}; + +#define TYPE_VIRTIO_INPUT_HID_CCW "virtio-input-hid-ccw" +#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw" +#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw" +#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW) + +struct VirtIOInputHIDCcw { + VirtioCcwDevice parent_obj; + VirtIOInputHID vdev; +}; =20 static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **err= p) { diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c index 3860d4e6ea..484e617659 100644 --- a/hw/s390x/virtio-ccw-net.c +++ b/hw/s390x/virtio-ccw-net.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-net.h" + +#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIONetCcw, VIRTIO_NET_CCW) + +struct VirtIONetCcw { + VirtioCcwDevice parent_obj; + VirtIONet vdev; +}; =20 static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c index 2e3a9da5e8..a3fffb5138 100644 --- a/hw/s390x/virtio-ccw-rng.c +++ b/hw/s390x/virtio-ccw-rng.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-rng.h" + +#define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIORNGCcw, VIRTIO_RNG_CCW) + +struct VirtIORNGCcw { + VirtioCcwDevice parent_obj; + VirtIORNG vdev; +}; =20 static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c index fa706eb550..d003f89f43 100644 --- a/hw/s390x/virtio-ccw-scsi.c +++ b/hw/s390x/virtio-ccw-scsi.c @@ -15,6 +15,15 @@ #include "qapi/error.h" #include "qemu/module.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-scsi.h" + +#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSCSICcw, VIRTIO_SCSI_CCW) + +struct VirtIOSCSICcw { + VirtioCcwDevice parent_obj; + VirtIOSCSI vdev; +}; =20 static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { diff --git a/hw/s390x/virtio-ccw-serial.c b/hw/s390x/virtio-ccw-serial.c index 61958228d1..bf8057880f 100644 --- a/hw/s390x/virtio-ccw-serial.c +++ b/hw/s390x/virtio-ccw-serial.c @@ -15,6 +15,15 @@ #include "hw/qdev-properties.h" #include "hw/virtio/virtio-serial.h" #include "virtio-ccw.h" +#include "hw/virtio/virtio-serial.h" + +#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw" +OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW) + +struct VirtioSerialCcw { + VirtioCcwDevice parent_obj; + VirtIOSerial vdev; +}; =20 static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **er= rp) { diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 0168232e3b..fc131194bf 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -104,139 +104,6 @@ static inline int virtio_ccw_rev_max(VirtioCcwDevice = *dev) return dev->max_rev; } =20 -/* virtio-scsi-ccw */ - -#define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSCSICcw, VIRTIO_SCSI_CCW) - -struct VirtIOSCSICcw { - VirtioCcwDevice parent_obj; - VirtIOSCSI vdev; -}; - -#ifdef CONFIG_VHOST_SCSI -/* vhost-scsi-ccw */ - -#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VHostSCSICcw, VHOST_SCSI_CCW) - -struct VHostSCSICcw { - VirtioCcwDevice parent_obj; - VHostSCSI vdev; -}; -#endif - -/* virtio-blk-ccw */ - -#define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBlkCcw, VIRTIO_BLK_CCW) - -struct VirtIOBlkCcw { - VirtioCcwDevice parent_obj; - VirtIOBlock vdev; -}; - -/* virtio-balloon-ccw */ - -#define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW) - -struct VirtIOBalloonCcw { - VirtioCcwDevice parent_obj; - VirtIOBalloon vdev; -}; - -/* virtio-serial-ccw */ - -#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW) - -struct VirtioSerialCcw { - VirtioCcwDevice parent_obj; - VirtIOSerial vdev; -}; - -/* virtio-net-ccw */ - -#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIONetCcw, VIRTIO_NET_CCW) - -struct VirtIONetCcw { - VirtioCcwDevice parent_obj; - VirtIONet vdev; -}; - -/* virtio-rng-ccw */ - -#define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIORNGCcw, VIRTIO_RNG_CCW) - -struct VirtIORNGCcw { - VirtioCcwDevice parent_obj; - VirtIORNG vdev; -}; - -/* virtio-crypto-ccw */ - -#define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW) - -struct VirtIOCryptoCcw { - VirtioCcwDevice parent_obj; - VirtIOCrypto vdev; -}; - VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch); =20 -#ifdef CONFIG_VIRTFS -#include "hw/9pfs/virtio-9p.h" - -#define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(V9fsCCWState, VIRTIO_9P_CCW) - -struct V9fsCCWState { - VirtioCcwDevice parent_obj; - V9fsVirtioState vdev; -}; - -#endif /* CONFIG_VIRTFS */ - -#ifdef CONFIG_VHOST_VSOCK -#define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VHostVSockCCWState, VHOST_VSOCK_CCW) - -struct VHostVSockCCWState { - VirtioCcwDevice parent_obj; - VHostVSock vdev; -}; - -#endif /* CONFIG_VHOST_VSOCK */ - -#define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUCcw, VIRTIO_GPU_CCW) - -struct VirtIOGPUCcw { - VirtioCcwDevice parent_obj; - VirtIOGPU vdev; -}; - -#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputCcw, VIRTIO_INPUT_CCW) - -struct VirtIOInputCcw { - VirtioCcwDevice parent_obj; - VirtIOInput vdev; -}; - -#define TYPE_VIRTIO_INPUT_HID_CCW "virtio-input-hid-ccw" -#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw" -#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw" -#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW) - -struct VirtIOInputHIDCcw { - VirtioCcwDevice parent_obj; - VirtIOInputHID vdev; -}; - #endif --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165035348277336.61581543475779; Tue, 19 Apr 2022 00:31:22 -0700 (PDT) Received: from localhost ([::1]:33758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngiKX-0007bv-78 for importer@patchew.org; Tue, 19 Apr 2022 03:31:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmQ-0001In-La for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:04 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmN-0004b3-NI for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: by mail-wr1-x434.google.com with SMTP id i20so20892496wrb.13 for ; Mon, 18 Apr 2022 22:51:59 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/yzbv298xv/IZxkbFAG2dfaYpZApM3UnonMq2TBmO8U=; b=Z0WEPWeSuizELJIGyZIG8HKzMnIwEmPRXt03iy8+8YGZMkrbRgDsHxYq+uOeuizrcH 2qOBoen7rahiEKkiTOCaK7lZqK6LJ/LpRUvtTzdSfThM0uZJt+y+N0SdC31YdBcDGKSj b47xca0b93p+DE4aWXb80NMCLvuzsUG/zqXx+BiXoJeC2K2qh3sMfpc1b2/6wlDWEnJV /VRATerRlCIHQ5fHlo90SPktdJsxQqeuPUkO4CrNl/Z7b0A0hH+XY2jjkiBL5LzrhlHY IWr1Sb1LiWE5qvKm1WTTi3sKZDmICRMIA3IoEpMwyY5kkK8VcehiU72oMIMT4cArUerl aWZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/yzbv298xv/IZxkbFAG2dfaYpZApM3UnonMq2TBmO8U=; b=hZ1ya0/P0E8iTOzJ8wJXv7b9e7kI5ojjQyAaC4dMkQi/UtSP487WJ9mYjklrSSzGsI sgiJP37SEq9laYGsqNP4hHr+2BB8+J7nUgj6ETpCJZmPUwhyuQl+zrsx275UAik1I4zg 7X3hvmIY71odauhdku4WEQae8zG4dydV4QXOp5kwR7dRBlq3k5SdOVeFdQZnABRqI4Mi MQG+uHJSmcWpSqr3gHbzfhgdus5nvLMdtnZHGg7U0q9QH715gR1xKunCoTHm0T/l+X7w 2nom69UP99Q8DLRs9238QkeeOvoEf482/pAxBSPl7ND98hD/gmoHKQajphu5C8RYjzj8 eDiA== X-Gm-Message-State: AOAM530Jlypxy6Hb3kVEKV2SDT5NXrRueawa2KvyQgEKHzXJq0uZ//YI 0c1eHAEfGvcdwIdDqNz8iel2ApKsuDQuPw== X-Google-Smtp-Source: ABdhPJzkrZLtuapGFz+NNwewR0MuMuVSs8cMt6osaZpMotFoOkvtwr9roIhAEjdHYr80QLO4w01IiA== X-Received: by 2002:a5d:66d0:0:b0:207:a53f:5c2d with SMTP id k16-20020a5d66d0000000b00207a53f5c2dmr10348552wrw.440.1650347518309; Mon, 18 Apr 2022 22:51:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 51/53] virtio-ccw: do not include headers for all virtio devices Date: Tue, 19 Apr 2022 07:51:07 +0200 Message-Id: <20220419055109.142788-52-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650353483483100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- hw/s390x/ipl.c | 3 +++ hw/s390x/s390-virtio-ccw.c | 1 + hw/s390x/virtio-ccw.c | 2 ++ hw/s390x/virtio-ccw.h | 16 ---------------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 2dcc24175d..4b5eb77afd 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -27,11 +27,14 @@ #include "hw/s390x/css.h" #include "hw/s390x/ebcdic.h" #include "hw/s390x/pv.h" +#include "hw/scsi/scsi.h" +#include "hw/virtio/virtio-net.h" #include "ipl.h" #include "qemu/error-report.h" #include "qemu/config-file.h" #include "qemu/cutils.h" #include "qemu/option.h" +#include "standard-headers/linux/virtio_ids.h" #include "exec/exec-all.h" =20 #define KERN_IMAGE_START 0x010000UL diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 90480e7cf9..2d32647d08 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -25,6 +25,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/qemu-print.h" +#include "qemu/units.h" #include "hw/s390x/s390-pci-bus.h" #include "sysemu/reset.h" #include "hw/s390x/storage-keys.h" diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index c845a92c3a..15b458527e 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "exec/address-spaces.h" #include "sysemu/kvm.h" #include "net/net.h" #include "hw/virtio/virtio.h" @@ -19,6 +20,7 @@ #include "hw/virtio/virtio-net.h" #include "qemu/bitops.h" #include "qemu/error-report.h" +#include "qemu/log.h" #include "qemu/module.h" #include "hw/virtio/virtio-access.h" #include "hw/virtio/virtio-bus.h" diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index fc131194bf..fac186c8f6 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -13,24 +13,8 @@ #ifndef HW_S390X_VIRTIO_CCW_H #define HW_S390X_VIRTIO_CCW_H =20 -#include "hw/virtio/virtio-blk.h" -#include "hw/virtio/virtio-net.h" -#include "hw/virtio/virtio-serial.h" -#include "hw/virtio/virtio-scsi.h" #include "qom/object.h" -#ifdef CONFIG_VHOST_SCSI -#include "hw/virtio/vhost-scsi.h" -#endif -#include "hw/virtio/virtio-balloon.h" -#include "hw/virtio/virtio-rng.h" -#include "hw/virtio/virtio-crypto.h" #include "hw/virtio/virtio-bus.h" -#ifdef CONFIG_VHOST_VSOCK -#include "hw/virtio/vhost-vsock.h" -#endif /* CONFIG_VHOST_VSOCK */ -#include "hw/virtio/virtio-gpu.h" -#include "hw/virtio/virtio-input.h" - #include "hw/s390x/s390_flic.h" #include "hw/s390x/css.h" #include "ccw-device.h" --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650355059341199.39255572205377; Tue, 19 Apr 2022 00:57:39 -0700 (PDT) Received: from localhost ([::1]:40176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngijx-0006uR-L8 for importer@patchew.org; Tue, 19 Apr 2022 03:57:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmR-0001J5-6B for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:04 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:33355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmO-0004bB-6D for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: by mail-wr1-x42b.google.com with SMTP id x18so13072216wrc.0 for ; Mon, 18 Apr 2022 22:51:59 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cqlIvFlaJGSG4uCwFUjXAq5UT9k0mVtPWMV8t35g/4Q=; b=qxPII67YilZy6Bekl6HUpKn0Vyn2572u2C9jk+4dyPvy9o8varpVTABAVsYwka6sRs CSeA1jfPibz4LxKaBqq2h9fz8KvOm98Dx5RtVm2l3+6WGv+6mMk9WMYngl9Cyg08MJiC 279+JyI/Hd8eO+5iB/Q94BUwFTvkA8x2EWGJGrci9Z8vx2onbUQBfBnp40tpaEL4eN8C ByE8N9lweec5NfjQyJw5y3JGDeweLE6HiW0CJK3f6ZFJUymxpE5TyMSkZS5jnac1Uzq7 z28pyxGJQ1Tjcm8DhQdZWiEDM0+SJlPiMGWzeb8SSmXMkSIUMwUk4LCxKsco5WsvNZ9Z 25BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cqlIvFlaJGSG4uCwFUjXAq5UT9k0mVtPWMV8t35g/4Q=; b=mQ/HZGvcRG6vrje95y6inhw6c5Bide0pmrEQqobGTt1OCGNLXLNAhTp0QuRC4Ppaai Qi+QF8wvUoPwiy0PA6514KdTMgHrIqbQGSB6ResyNZaK+JlQDOSYhCV6nPScNc9Y4LmR Uz78VslpvKU40FdYpegDloTpFY8ziZpPe/W6TKkvUFBZ0LxJMzoJuktXkxRJfxy3NgO4 ZG4KWETIcGnB3qTzQSHzxUBL88AKSW3YHLlnd462PcoHZ6s8fvS4iv/BaODvcD6ziY70 oDeS2nQrH78CcbhgUPQXOlvU8fKp24m3S6uOTTEld+7KNpcdChUF9RlHAvgqP0O2kftV KGpg== X-Gm-Message-State: AOAM530sXLoEEy/+smUhkbY2DEsiO1eRKBfxYyp/aSdHtG9n92h/E+XO M4UazxxLwnJ0Sr1Pj3wHPXSMBBii4Zi4Og== X-Google-Smtp-Source: ABdhPJyLZteMV1HVVe17HwJzRqPeU/9wK9uVR9V1uti4S9AcRV8EYsGSTPIia2A+rUaxpPd0gJPUZg== X-Received: by 2002:a5d:64ed:0:b0:20a:a5ea:e0cd with SMTP id g13-20020a5d64ed000000b0020aa5eae0cdmr1576698wri.520.1650347518882; Mon, 18 Apr 2022 22:51:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 52/53] target/i386: do not access beyond the low 128 bits of SSE registers Date: Tue, 19 Apr 2022 07:51:08 +0200 Message-Id: <20220419055109.142788-53-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650355060569100001 Content-Type: text/plain; charset="utf-8" The i386 target consolidates all vector registers so that instead of XMMReg, YMMReg and ZMMReg structs there is a single ZMMReg that can fit all of SSE, AVX and AVX512. When TCG copies data from and to the SSE registers, it uses the full 64-byte width. This is not a correctness issue because TCG never lets guest code see beyond the first 128 bits of the ZMM registers, however it causes uninitialized stack memory to make it to the CPU's migration stream. Fix it by only copying the low 16 bytes of the ZMMReg union into the destination register. Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- target/i386/ops_sse.h | 75 +++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 6f1fc174b3..e4d74b814a 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -22,6 +22,7 @@ =20 #if SHIFT =3D=3D 0 #define Reg MMXReg +#define SIZE 8 #define XMM_ONLY(...) #define B(n) MMX_B(n) #define W(n) MMX_W(n) @@ -30,6 +31,7 @@ #define SUFFIX _mmx #else #define Reg ZMMReg +#define SIZE 16 #define XMM_ONLY(...) __VA_ARGS__ #define B(n) ZMM_B(n) #define W(n) ZMM_W(n) @@ -38,6 +40,22 @@ #define SUFFIX _xmm #endif =20 +/* + * Copy the relevant parts of a Reg value around. In the case where + * sizeof(Reg) > SIZE, these helpers operate only on the lower bytes of + * a 64 byte ZMMReg, so we must copy only those and keep the top bytes + * untouched in the guest-visible destination destination register. + * Note that the "lower bytes" are placed last in memory on big-endian + * hosts, which store the vector backwards in memory. In that case the + * copy *starts* at B(SIZE - 1) and ends at B(0), the opposite of + * the little-endian case. + */ +#if HOST_BIG_ENDIAN +#define MOVE(d, r) memcpy(&((d).B(SIZE - 1)), &(r).B(SIZE - 1), SIZE) +#else +#define MOVE(d, r) memcpy(&(d).B(0), &(r).B(0), SIZE) +#endif + void glue(helper_psrlw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) { int shift; @@ -516,7 +534,7 @@ void glue(helper_pshufw, SUFFIX)(Reg *d, Reg *s, int or= der) r.W(1) =3D s->W((order >> 2) & 3); r.W(2) =3D s->W((order >> 4) & 3); r.W(3) =3D s->W((order >> 6) & 3); - *d =3D r; + MOVE(*d, r); } #else void helper_shufps(Reg *d, Reg *s, int order) @@ -527,7 +545,7 @@ void helper_shufps(Reg *d, Reg *s, int order) r.L(1) =3D d->L((order >> 2) & 3); r.L(2) =3D s->L((order >> 4) & 3); r.L(3) =3D s->L((order >> 6) & 3); - *d =3D r; + MOVE(*d, r); } =20 void helper_shufpd(Reg *d, Reg *s, int order) @@ -536,7 +554,7 @@ void helper_shufpd(Reg *d, Reg *s, int order) =20 r.Q(0) =3D d->Q(order & 1); r.Q(1) =3D s->Q((order >> 1) & 1); - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_pshufd, SUFFIX)(Reg *d, Reg *s, int order) @@ -547,7 +565,7 @@ void glue(helper_pshufd, SUFFIX)(Reg *d, Reg *s, int or= der) r.L(1) =3D s->L((order >> 2) & 3); r.L(2) =3D s->L((order >> 4) & 3); r.L(3) =3D s->L((order >> 6) & 3); - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_pshuflw, SUFFIX)(Reg *d, Reg *s, int order) @@ -559,7 +577,7 @@ void glue(helper_pshuflw, SUFFIX)(Reg *d, Reg *s, int o= rder) r.W(2) =3D s->W((order >> 4) & 3); r.W(3) =3D s->W((order >> 6) & 3); r.Q(1) =3D s->Q(1); - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_pshufhw, SUFFIX)(Reg *d, Reg *s, int order) @@ -571,7 +589,7 @@ void glue(helper_pshufhw, SUFFIX)(Reg *d, Reg *s, int o= rder) r.W(5) =3D s->W(4 + ((order >> 2) & 3)); r.W(6) =3D s->W(4 + ((order >> 4) & 3)); r.W(7) =3D s->W(4 + ((order >> 6) & 3)); - *d =3D r; + MOVE(*d, r); } #endif =20 @@ -937,7 +955,7 @@ void helper_haddps(CPUX86State *env, ZMMReg *d, ZMMReg = *s) r.ZMM_S(1) =3D float32_add(d->ZMM_S(2), d->ZMM_S(3), &env->sse_status); r.ZMM_S(2) =3D float32_add(s->ZMM_S(0), s->ZMM_S(1), &env->sse_status); r.ZMM_S(3) =3D float32_add(s->ZMM_S(2), s->ZMM_S(3), &env->sse_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_haddpd(CPUX86State *env, ZMMReg *d, ZMMReg *s) @@ -946,7 +964,7 @@ void helper_haddpd(CPUX86State *env, ZMMReg *d, ZMMReg = *s) =20 r.ZMM_D(0) =3D float64_add(d->ZMM_D(0), d->ZMM_D(1), &env->sse_status); r.ZMM_D(1) =3D float64_add(s->ZMM_D(0), s->ZMM_D(1), &env->sse_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_hsubps(CPUX86State *env, ZMMReg *d, ZMMReg *s) @@ -957,7 +975,7 @@ void helper_hsubps(CPUX86State *env, ZMMReg *d, ZMMReg = *s) r.ZMM_S(1) =3D float32_sub(d->ZMM_S(2), d->ZMM_S(3), &env->sse_status); r.ZMM_S(2) =3D float32_sub(s->ZMM_S(0), s->ZMM_S(1), &env->sse_status); r.ZMM_S(3) =3D float32_sub(s->ZMM_S(2), s->ZMM_S(3), &env->sse_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_hsubpd(CPUX86State *env, ZMMReg *d, ZMMReg *s) @@ -966,7 +984,7 @@ void helper_hsubpd(CPUX86State *env, ZMMReg *d, ZMMReg = *s) =20 r.ZMM_D(0) =3D float64_sub(d->ZMM_D(0), d->ZMM_D(1), &env->sse_status); r.ZMM_D(1) =3D float64_sub(s->ZMM_D(0), s->ZMM_D(1), &env->sse_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_addsubps(CPUX86State *env, ZMMReg *d, ZMMReg *s) @@ -1153,7 +1171,7 @@ void glue(helper_packsswb, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.B(14) =3D satsb((int16_t)s->W(6)); r.B(15) =3D satsb((int16_t)s->W(7)); #endif - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_packuswb, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1180,7 +1198,7 @@ void glue(helper_packuswb, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.B(14) =3D satub((int16_t)s->W(6)); r.B(15) =3D satub((int16_t)s->W(7)); #endif - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_packssdw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1199,7 +1217,7 @@ void glue(helper_packssdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.W(6) =3D satsw(s->L(2)); r.W(7) =3D satsw(s->L(3)); #endif - *d =3D r; + MOVE(*d, r); } =20 #define UNPCK_OP(base_name, base) \ @@ -1227,7 +1245,7 @@ void glue(helper_packssdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.B(14) =3D d->B((base << (SHIFT + 2)) + 7); \ r.B(15) =3D s->B((base << (SHIFT + 2)) + 7); \ ) \ - *d =3D r; \ + MOVE(*d, r); \ } \ \ void glue(helper_punpck ## base_name ## wd, SUFFIX)(CPUX86State *env,\ @@ -1245,7 +1263,7 @@ void glue(helper_packssdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.W(6) =3D d->W((base << (SHIFT + 1)) + 3); \ r.W(7) =3D s->W((base << (SHIFT + 1)) + 3); \ ) \ - *d =3D r; \ + MOVE(*d, r); \ } \ \ void glue(helper_punpck ## base_name ## dq, SUFFIX)(CPUX86State *env,\ @@ -1259,7 +1277,7 @@ void glue(helper_packssdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.L(2) =3D d->L((base << SHIFT) + 1); \ r.L(3) =3D s->L((base << SHIFT) + 1); \ ) \ - *d =3D r; \ + MOVE(*d, r); \ } \ \ XMM_ONLY( \ @@ -1272,7 +1290,7 @@ void glue(helper_packssdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) \ r.Q(0) =3D d->Q(base); \ r.Q(1) =3D s->Q(base); \ - *d =3D r; \ + MOVE(*d, r); \ } \ ) =20 @@ -1313,7 +1331,7 @@ void helper_pfacc(CPUX86State *env, MMXReg *d, MMXReg= *s) =20 r.MMX_S(0) =3D float32_add(d->MMX_S(0), d->MMX_S(1), &env->mmx_status); r.MMX_S(1) =3D float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_pfadd(CPUX86State *env, MMXReg *d, MMXReg *s) @@ -1378,7 +1396,7 @@ void helper_pfnacc(CPUX86State *env, MMXReg *d, MMXRe= g *s) =20 r.MMX_S(0) =3D float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status); r.MMX_S(1) =3D float32_sub(s->MMX_S(0), s->MMX_S(1), &env->mmx_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_pfpnacc(CPUX86State *env, MMXReg *d, MMXReg *s) @@ -1387,7 +1405,7 @@ void helper_pfpnacc(CPUX86State *env, MMXReg *d, MMXR= eg *s) =20 r.MMX_S(0) =3D float32_sub(d->MMX_S(0), d->MMX_S(1), &env->mmx_status); r.MMX_S(1) =3D float32_add(s->MMX_S(0), s->MMX_S(1), &env->mmx_status); - *d =3D r; + MOVE(*d, r); } =20 void helper_pfrcp(CPUX86State *env, MMXReg *d, MMXReg *s) @@ -1424,7 +1442,7 @@ void helper_pswapd(CPUX86State *env, MMXReg *d, MMXRe= g *s) =20 r.MMX_L(0) =3D s->MMX_L(1); r.MMX_L(1) =3D s->MMX_L(0); - *d =3D r; + MOVE(*d, r); } #endif =20 @@ -1438,7 +1456,7 @@ void glue(helper_pshufb, SUFFIX)(CPUX86State *env, Re= g *d, Reg *s) r.B(i) =3D (s->B(i) & 0x80) ? 0 : (d->B(s->B(i) & ((8 << SHIFT) - = 1))); } =20 - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_phaddw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1455,7 +1473,7 @@ void glue(helper_phaddw, SUFFIX)(CPUX86State *env, Re= g *d, Reg *s) XMM_ONLY(r.W(6) =3D (int16_t)s->W(4) + (int16_t)s->W(5)); XMM_ONLY(r.W(7) =3D (int16_t)s->W(6) + (int16_t)s->W(7)); =20 - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_phaddd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1467,7 +1485,7 @@ void glue(helper_phaddd, SUFFIX)(CPUX86State *env, Re= g *d, Reg *s) r.L((1 << SHIFT) + 0) =3D (int32_t)s->L(0) + (int32_t)s->L(1); XMM_ONLY(r.L(3) =3D (int32_t)s->L(2) + (int32_t)s->L(3)); =20 - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_phaddsw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1483,7 +1501,7 @@ void glue(helper_phaddsw, SUFFIX)(CPUX86State *env, R= eg *d, Reg *s) XMM_ONLY(r.W(6) =3D satsw((int16_t)s->W(4) + (int16_t)s->W(5))); XMM_ONLY(r.W(7) =3D satsw((int16_t)s->W(6) + (int16_t)s->W(7))); =20 - *d =3D r; + MOVE(*d, r); } =20 void glue(helper_pmaddubsw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -1585,7 +1603,7 @@ void glue(helper_palignr, SUFFIX)(CPUX86State *env, R= eg *d, Reg *s, #undef SHR } =20 - *d =3D r; + MOVE(*d, r); } =20 #define XMM0 (env->xmm_regs[0]) @@ -1718,7 +1736,7 @@ void glue(helper_packusdw, SUFFIX)(CPUX86State *env, = Reg *d, Reg *s) r.W(5) =3D satuw((int32_t) s->L(1)); r.W(6) =3D satuw((int32_t) s->L(2)); r.W(7) =3D satuw((int32_t) s->L(3)); - *d =3D r; + MOVE(*d, r); } =20 #define FMINSB(d, s) MIN((int8_t)d, (int8_t)s) @@ -1984,7 +2002,7 @@ void glue(helper_mpsadbw, SUFFIX)(CPUX86State *env, R= eg *d, Reg *s, r.W(i) +=3D abs1(d->B(d0 + 3) - s->B(s0 + 3)); } =20 - *d =3D r; + MOVE(*d, r); } =20 /* SSE4.2 op helpers */ @@ -2324,3 +2342,4 @@ void glue(helper_aeskeygenassist, SUFFIX)(CPUX86State= *env, Reg *d, Reg *s, #undef L #undef Q #undef SUFFIX +#undef SIZE --=20 2.35.1 From nobody Sun May 19 02:26:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650354545530260.32718377299193; Tue, 19 Apr 2022 00:49:05 -0700 (PDT) Received: from localhost ([::1]:59886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngibg-00015c-Ai for importer@patchew.org; Tue, 19 Apr 2022 03:49:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nggmR-0001J4-0W for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:04 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:44977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nggmO-0004bM-S2 for qemu-devel@nongnu.org; Tue, 19 Apr 2022 01:52:02 -0400 Received: by mail-wr1-x434.google.com with SMTP id b19so20894429wrh.11 for ; Mon, 18 Apr 2022 22:52:00 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:e3ec:5559:7c5c:1928]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm15763510wmb.3.2022.04.18.22.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 22:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z7L4IeRSV0TUqkZzYtCMlxQlVhxwA60J0hTVN8JRD+w=; b=b2hR5+EJc/Vmls3N47VEJdhKeyyhItVaNU4zbxLnTLuP94POVgE3mvDMVvxv3dEdbK O2wLmuBBVvx2GB4YbOzh14rqcaK6eVhZu2E8yQUuDWI5lfwVn60ZG7zCXoIvk+fQeVPO UXZLN4Wy3X0UeHkDybJXYbdaTPGDJOrxaE6mOpaXSo25Qe7LS4iatGEHX9B4g/TBwNPQ Q4o0wYe3bWUlVXkbf3yXnp0yZa2VK3S64tYaCASr2Rq+5eNpfTo1EceZs9fCicCh3LJc av/uvp7zYBvPcMzN8yWn9sc3Je004IobWzeIhYDW0evm0ToCJ1x7QJGxx3n1GyKzkLwT aIFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Z7L4IeRSV0TUqkZzYtCMlxQlVhxwA60J0hTVN8JRD+w=; b=dSc1AJa8/dfGC9b02wQLDRTrIeJZ2HSigT+kwmjhL2b5W6nLAL8wkgqgNkHB2STQvh zHUgVFIH4nKdhxe7F72ptEsnslRMtyiyTWFFiMsSRCizF+ScvOYpzUz+F155o/hvw9q3 jI90TahFBeUZtfrCkd57G3nEgXdsNAjH7dHmjWnMskjP2l07TVS0PpSvr5jxsmHDjKq+ KMz43pndzuJEzn6nlU6DZyT+fPAOHpJo380ohjolgKWinZI9NyDEOud7Lw04XgIVQ30x KjAcugTwHw8W8SAnMWCa8SEibTgI86j2y8qauE3a9MLKHvOSJxSN/hQ0/fj5zHbdafcC 0LvQ== X-Gm-Message-State: AOAM533BaaLbwOrK3C4hKtfX4HS9mZXs8nFKTyQ5r6PCrEWFfwCkgOgA /uvWvkiHkMNp5xIuXoBfSpYPUWisMrFlLQ== X-Google-Smtp-Source: ABdhPJz7jM3ByfUtggy39zB4+ETW6SwW6pJO4/yzlZ3+bDHXb6wwoOX6RPS5qUXjbxajdAoD3VMxRw== X-Received: by 2002:a5d:49c1:0:b0:20a:a65b:4648 with SMTP id t1-20020a5d49c1000000b0020aa65b4648mr1375652wrs.707.1650347519511; Mon, 18 Apr 2022 22:51:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 53/53] target/i386: Remove unused XMMReg, YMMReg types and CPUState fields Date: Tue, 19 Apr 2022 07:51:09 +0200 Message-Id: <20220419055109.142788-54-pbonzini@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419055109.142788-1-pbonzini@redhat.com> References: <20220419055109.142788-1-pbonzini@redhat.com> MIME-Version: 1.0 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::434; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650354546766100001 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In commit b7711471f5 in 2014 we refactored the handling of the x86 vector registers so that instead of separate structs XMMReg, YMMReg and ZMMReg for representing the 16-byte, 32-byte and 64-byte width vector registers and multiple fields in the CPU state, we have a single type (XMMReg, later renamed to ZMMReg) and a single struct field (xmm_regs). However, in 2017 in commit c97d6d2cdf97ed some of the old struct types and CPU state fields got added back, when we merged in the hvf support (which had developed in a separate fork that had presumably not had the refactoring of b7711471f5), as part of code handling xsave. Commit f585195ec07 then almost immediately dropped that xsave code again in favour of sharing the xsave handling with KVM, but forgot to remove the now unused CPU state fields and struct types. Delete the unused types and CPUState fields. Signed-off-by: Peter Maydell Message-Id: <20220412110047.1497190-1-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 6b61124887..9661f9fbd1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1219,20 +1219,6 @@ typedef struct SegmentCache { float64 _d_##n[(bits)/64]; \ } =20 -typedef union { - uint8_t _b[16]; - uint16_t _w[8]; - uint32_t _l[4]; - uint64_t _q[2]; -} XMMReg; - -typedef union { - uint8_t _b[32]; - uint16_t _w[16]; - uint32_t _l[8]; - uint64_t _q[4]; -} YMMReg; - typedef MMREG_UNION(ZMMReg, 512) ZMMReg; typedef MMREG_UNION(MMXReg, 64) MMXReg; =20 @@ -1531,11 +1517,7 @@ typedef struct CPUArchState { ZMMReg xmm_t0; MMXReg mmx_t0; =20 - XMMReg ymmh_regs[CPU_NB_REGS]; - uint64_t opmask_regs[NB_OPMASK_REGS]; - YMMReg zmmh_regs[CPU_NB_REGS]; - ZMMReg hi16_zmm_regs[CPU_NB_REGS]; #ifdef TARGET_X86_64 uint8_t xtilecfg[64]; uint8_t xtiledata[8192]; --=20 2.35.1