From patchwork Tue May 23 16:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 684999 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1824483wrt; Tue, 23 May 2023 09:36:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6J01U/zusDtw11QGqkTiTVJzdY9yxqmoB2E45xlR3tEpIk6KDTS7r6SckDeV1hI3UkbBBv X-Received: by 2002:ac8:5b8e:0:b0:3f6:a210:1fd2 with SMTP id a14-20020ac85b8e000000b003f6a2101fd2mr16418107qta.68.1684859818511; Tue, 23 May 2023 09:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684859818; cv=none; d=google.com; s=arc-20160816; b=D/v9lR5z4L/aWajq3p/5zDe95Jx/MRwrB+bU3zQPIlQ2p+hAx0mE6hpccmB8K5oOpd sotzQCqgiB2QzXBKNxmcYNVHP6yTXAhXnQosIeANouut88zDOMY5dx72bsE76ZeGiz3f ePGdMyuF628ceYO4QAIcEQXtlCScy/JCPW3UQvLdn2Q2cPkK0ELufhIPTOo26GuvvwFx hYAJNXz8D85YbiKOTw5c2wr6MG0N15eo73ZtEUXeXOTrgOdRm+v4pwIuvGAEZMxn/4cJ rViOdbXb1YeFZEl4H33lZiE+3that4YQRTxy+UGbgHRHluQ5iDz+/T77KIVg2ymuQxtV WpVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2/nlgPLhLbIsykS3dfTZmYeBfdaG3SqKteCE5YtDUbs=; b=qUiHaH/s38NXc6AK5wEaQYF2AIt4Ow3GAIhkzO8Kgf4+o/OlAj9OdfQDq3PylRG+KZ UGW+fKTGgXsv2/pmQoPXSPTr3y/lcIo22nnQKZhSON7rWZwI33SrkXFVq6W5pHeWWyw+ spetwEdn2yhpC4KaLNHKF389Ap15g7qjQSGEHXarVx5ZcMHgau4d8zNz6U7q0EWvOFXD 67KAjFRR2bgA9+Wvw1hRa9/2tQ13ZoYG55kmma+gOgSu54EQQOFDLitEA9P0/uPXXnYV 7QMwKKXv6w9PpJzkDDTWC9DLX1b0VkflHkkfCQA9kHIdbyBxTheMAw/LG8xduukSrb6M 8sXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E3OiAtLc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h1-20020ac85841000000b003f6a8c3198csi4310843qth.200.2023.05.23.09.36.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 May 2023 09:36:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E3OiAtLc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1Uzg-0008Up-6V; Tue, 23 May 2023 12:36:16 -0400 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 1q1Uze-0008Tt-B9 for qemu-devel@nongnu.org; Tue, 23 May 2023 12:36:14 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1Uzc-0001a3-8G for qemu-devel@nongnu.org; Tue, 23 May 2023 12:36:14 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f6094cb26eso458185e9.2 for ; Tue, 23 May 2023 09:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684859770; x=1687451770; 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=2/nlgPLhLbIsykS3dfTZmYeBfdaG3SqKteCE5YtDUbs=; b=E3OiAtLcYCc+oNau0yNrzuqvE6y6mHF+NR0VFAMvcS06mzBM5ltNJ9usCYHgJ5HrsG v/S4B4pQTFG9refhWhSy2P1wHvbQ2xHbVepIkqlQjnleX1LQCwavJMWy6BF9NpBlXk9u 9b+swkqFc/mG6pdrgKeutw+kmWKFiG8mSpINufCZsEjpDQXDZAnAlgan6aQaRFexttF5 Nb5ByQ1YlBeB6PCW7cZfkXynAQbi5G2d5FZG25BSlFIboJ+4KlyABGvCy6ZFhgHpJBlu 2+r/FPPMOuLJzxY7qa9fPaclZYC90X/vEwxzBdcF7FtNwJ+NrUYuWxXmFJhvuh1vhNWY rEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684859770; x=1687451770; 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=2/nlgPLhLbIsykS3dfTZmYeBfdaG3SqKteCE5YtDUbs=; b=NWJlpxgGTplqGrvlnCsAcbd4VwtsxXBBpQQXHmxu6mTRDjmhVU3CAIuxH5ePtW7Wq6 O2x+ezCWwVP+ScwwE9OzQgF4t/Llnm5JmXFtAdeYycDCwbJx5jcco9Ab5tzWNQNGZYjH M9SmL4wJP/0Wq+N5o3rocKUXqDulkvVZvnVV7bPkhbl0lKazGMRH1+69r4NgJZ0Hc8yc NYNfcHwVTsCfXplfM0uo8dxil65a38w5avOsniwYRsWMu/zH7MQ5rPa2iZX+7r4ONFQV gUWrEUs3nHCBuMFco12CfkREHf98cFQRXe57hvUi8cm+VfMLpHdK5el5IH3Oh/ySRG+e w41Q== X-Gm-Message-State: AC+VfDx7is1vMsP6uucPMn1c84oq0eLTryalNt+Ay/bc3ufW5r3Hk/K4 OBse6kGb91X+6E+TIqcJqn6+Mw1LSaMf5aiInuk= X-Received: by 2002:a5d:50d2:0:b0:2cf:e517:c138 with SMTP id f18-20020a5d50d2000000b002cfe517c138mr9579070wrt.66.1684859770636; Tue, 23 May 2023 09:36:10 -0700 (PDT) Received: from localhost.localdomain (vil69-h02-176-184-48-94.dsl.sta.abo.bbox.fr. [176.184.48.94]) by smtp.gmail.com with ESMTPSA id w6-20020a5d6086000000b003064600cff9sm11600325wrt.38.2023.05.23.09.36.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 May 2023 09:36:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Raphael Norwitz , Peter Xu , Halil Pasic , Thomas Huth , "Gonglei (Arei)" , David Hildenbrand , Christian Borntraeger , Paolo Bonzini , "Michael S. Tsirkin" , Kevin Wolf , qemu-block@nongnu.org, Eric Farman , Fam Zheng , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Stefan Hajnoczi , Hanna Reitz , Cornelia Huck , Eric Auger , Ilya Leoshkevich , qemu-s390x@nongnu.org Subject: [PATCH 01/11] softmmu: Introduce qemu_target_page_mask/qemu_target_page_align helpers Date: Tue, 23 May 2023 18:35:50 +0200 Message-Id: <20230523163600.83391-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230523163600.83391-1-philmd@linaro.org> References: <20230523163600.83391-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since TARGET_PAGE_MASK and TARGET_PAGE_ALIGN are poisoned in target-agnostic code, introduce the qemu_target_page_mask() and qemu_target_page_align() helpers to get these values from target-agnostic code at runtime. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- include/exec/target_page.h | 2 ++ softmmu/physmem.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/exec/target_page.h b/include/exec/target_page.h index bbf37aea17..660416920b 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -15,6 +15,8 @@ #define EXEC_TARGET_PAGE_H size_t qemu_target_page_size(void); +unsigned qemu_target_page_mask(void); +uint64_t qemu_target_page_align(uint64_t value); int qemu_target_page_bits(void); int qemu_target_page_bits_min(void); diff --git a/softmmu/physmem.c b/softmmu/physmem.c index efaed36773..14fcba4fb2 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -3347,6 +3347,16 @@ size_t qemu_target_page_size(void) return TARGET_PAGE_SIZE; } +unsigned qemu_target_page_mask(void) +{ + return TARGET_PAGE_MASK; +} + +uint64_t qemu_target_page_align(uint64_t value) +{ + return TARGET_PAGE_ALIGN(value); +} + int qemu_target_page_bits(void) { return TARGET_PAGE_BITS;