From nobody Tue Nov 26 10:53:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708736771; cv=none; d=zohomail.com; s=zohoarc; b=OFhszPR/Ccc5+7yL1R9w9qwGNtVyZVgE7hcgJgJ9a9juw7XHZwRcfLsHel2lyFu/06XIGQQlLQ2bKM+pWV/ksDXV0hZNPVPSYLWgGa0fnmQsdDU3i1E1z/m9pVKWXRgkSvE4qEI++n2rwKiUEfFoqKOT1ldb2/bygu5LGtq5m2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708736771; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4p3730s1ZW+5tccU/rwEB7GvlawtPCatyb8CYdCU2hc=; b=iS/VTiez4GMCtGMjglnk5ghMBncf2P72L4XW1/DchZ7Dw0YokSVnvbHAhn9lP7zTBkkWG7QBlDLWh+4Vj0tRrD1I/F3j402oSgBsSZeEGd8AU9EFU511mBApuA4Gukk8WJmKdEW/IhgWGzSHnEDKH1D5szGVpdPWDDyqab5zxAM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708736771031437.594479820042; Fri, 23 Feb 2024 17:06:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdgTq-0006Ft-Ol; Fri, 23 Feb 2024 20:05:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdgTo-0006FI-1f for qemu-devel@nongnu.org; Fri, 23 Feb 2024 20:05:28 -0500 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdgTm-0006qd-3u for qemu-devel@nongnu.org; Fri, 23 Feb 2024 20:05:27 -0500 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e4e7e2594cso794888b3a.2 for ; Fri, 23 Feb 2024 17:05:25 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id g17-20020a62e311000000b006ddc7ed6edfsm93513pfh.51.2024.02.23.17.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 17:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708736724; x=1709341524; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4p3730s1ZW+5tccU/rwEB7GvlawtPCatyb8CYdCU2hc=; b=fd5pV9hJsgOkq88HcJsVQLIPUdcY/aCJe6p2xzXj6qDRAHfZaJQ0NGQhVvQfNj7Dkt Zjj8TQ+v2spSrzwKB1QHheJNlcIVGs7qL/Lkp8nRks6q1mFRw1kv7XdGo4aG/ZGMYdwj w6/ZL/0wqsCOFMzA4UrI8coMGv+wLCJsB8EiZ1LZfCpgKVdHSH25MQ0aq2TAm/0DGcVv sbu+SqM6nL3iqS4DtGHU88g57wPdU086mXoS8amvJx9B/uZwYkkDsNBSi7U5ATw0GZ+2 pZEpASrHuY9KhDKbwu1IAa85HZM7kSiYXnC4Pvu5c0Ym7YPKMje3BormUt3BfsDCU2cr PLEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708736724; x=1709341524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4p3730s1ZW+5tccU/rwEB7GvlawtPCatyb8CYdCU2hc=; b=HdxM/8GlsXP1Mqx9SAkFW2cyuHjRR8KkGSEzvZcrkA6ALI7LtyEz1MA9p2AL5StmTs P17exW54WTk23t3sBP4h0LdnupJc8xU65IUenCRVWNqE8aCVbXXiuY2Q4KU5izE453/8 /Hzxo1XUROaxPS0iIKoO9lNc0ojNqbmgi7ShQTrfKAQqba9wNNRV6YqfA9K+mXzmI8Vp 848bXRYvtwC9AlnL7b8MQbst65QCPZ8PUjyFwaU/By0mkFspcB4WgUQOaMnd0zfWAdbd VfeT2VokxoEz2uthSY/4OIH1dtwMoKh99HJjg0OSHDcfoyPDNC5Bi86wLV8hFI8A/oFJ j6ig== X-Gm-Message-State: AOJu0YzxH075wXxANmXXJkPUM6EYGYvboPNgjWDn5KG6wXrFMsVMzhff PLEfzx9XA4VECtPTCpaSf3+fC4Yi5T50GMQz7465ii7X9GrQwsnLHGYH8W1q+Dx/USKJvHxiwgn E X-Google-Smtp-Source: AGHT+IEKinhZUKCRO+f+9ql5o4Uxw5k8d2l2n8inQR+LsKQL+v8cNP8f7zksozQ2HPdAvFlUDzOZlw== X-Received: by 2002:a05:6a00:9a8:b0:6e4:890a:7af with SMTP id u40-20020a056a0009a800b006e4890a07afmr1844471pfg.26.1708736724356; Fri, 23 Feb 2024 17:05:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich , Helge Deller Subject: [PULL v2 32/39] cpu: Remove page_size_init Date: Fri, 23 Feb 2024 15:05:17 -1000 Message-Id: <20240224010517.619640-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240224010517.619640-1-richard.henderson@linaro.org> References: <20240224010517.619640-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708736772989100002 Move qemu_host_page_{size,mask} and HOST_PAGE_ALIGN into bsd-user. It should be removed from bsd-user as well, but defer that cleanup. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Tested-by: Ilya Leoshkevich Acked-by: Helge Deller Message-Id: <20240102015808.132373-28-richard.henderson@linaro.org> --- bsd-user/qemu.h | 7 +++++++ include/exec/cpu-common.h | 7 ------- include/hw/core/cpu.h | 2 -- accel/tcg/translate-all.c | 1 - bsd-user/main.c | 12 ++++++++++++ cpu-target.c | 16 ---------------- system/vl.c | 1 - 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index dc842fffa7..c05c512767 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -39,6 +39,13 @@ extern char **environ; #include "qemu/clang-tsa.h" =20 #include "qemu-os.h" +/* + * TODO: Remove these and rely only on qemu_real_host_page_size(). + */ +extern uintptr_t qemu_host_page_size; +extern intptr_t qemu_host_page_mask; +#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size) + /* * This struct is used to hold certain information about the image. Basic= ally, * it replicates in user space what would be certain task_struct fields in= the diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 9ead1be100..6346df17ce 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -20,13 +20,6 @@ void cpu_exec_init_all(void); void cpu_exec_step_atomic(CPUState *cpu); =20 -/* 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_host_page_size; -extern intptr_t qemu_host_page_mask; - -#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()) =20 /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */ diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4385ce54c9..5c2d55f6d2 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1179,8 +1179,6 @@ bool target_words_bigendian(void); =20 const char *target_name(void); =20 -void page_size_init(void); - #ifdef NEED_CPU_H =20 #ifndef CONFIG_USER_ONLY diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 1c695efe02..c1f57e894a 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -256,7 +256,6 @@ bool cpu_unwind_state_data(CPUState *cpu, uintptr_t hos= t_pc, uint64_t *data) =20 void page_init(void) { - page_size_init(); page_table_config_init(); } =20 diff --git a/bsd-user/main.c b/bsd-user/main.c index 6ab3efd6c0..512d4ab69f 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -49,6 +49,13 @@ #include "host-os.h" #include "target_arch_cpu.h" =20 + +/* + * TODO: Remove these and rely only on qemu_real_host_page_size(). + */ +uintptr_t qemu_host_page_size; +intptr_t qemu_host_page_mask; + static bool opt_one_insn_per_tb; uintptr_t guest_base; bool have_guest_base; @@ -307,6 +314,9 @@ int main(int argc, char **argv) (void) envlist_setenv(envlist, *wrk); } =20 + qemu_host_page_size =3D getpagesize(); + qemu_host_page_size =3D MAX(qemu_host_page_size, TARGET_PAGE_SIZE); + cpu_model =3D NULL; =20 qemu_add_opts(&qemu_trace_opts); @@ -404,6 +414,8 @@ int main(int argc, char **argv) } } =20 + qemu_host_page_mask =3D -qemu_host_page_size; + /* init debug */ { int mask =3D 0; diff --git a/cpu-target.c b/cpu-target.c index 86444cc2c6..4c0621bf33 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -45,9 +45,6 @@ #include "trace/trace-root.h" #include "qemu/accel.h" =20 -uintptr_t qemu_host_page_size; -intptr_t qemu_host_page_mask; - #ifndef CONFIG_USER_ONLY static int cpu_common_post_load(void *opaque, int version_id) { @@ -474,16 +471,3 @@ const char *target_name(void) { return TARGET_NAME; } - -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(); - } - if (qemu_host_page_size < TARGET_PAGE_SIZE) { - qemu_host_page_size =3D TARGET_PAGE_SIZE; - } - qemu_host_page_mask =3D -(intptr_t)qemu_host_page_size; -} diff --git a/system/vl.c b/system/vl.c index b8469d9965..7913cc28aa 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2118,7 +2118,6 @@ static void qemu_create_machine(QDict *qdict) } =20 cpu_exec_init_all(); - page_size_init(); =20 if (machine_class->hw_version) { qemu_set_hw_version(machine_class->hw_version); --=20 2.34.1