From nobody Tue Feb 10 11:55:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=1568936202; cv=none; d=zoho.com; s=zohoarc; b=KsPtelY0Wee4FNmqaRkA01jtAxa0kAg4/nV+Na3kJ7QNW1r//douufyeBBGFvh4MvVaDht5Er8iWpNo9nQvqu6VQ32uKeiI6H7CBRNPruD7ko76aNTBnnSV/zM0stRagY3c9KBmFCQXXxYDMnVL3LFECUwUxRSNddnx+7Jt0iO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568936202; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eTxCu2cA0J5WLFUs9gnavWyyP8aOc6nLl3OMieDyOi4=; b=FMlMyQNWalxk0EdShR1AaZn2FuibweWV8HyEXvObPbhIrpSWx/4sOZgpPH6/teRxxWyMBZuD230n6zZKlJyejUlv2TLu3rIhHD9ooLMIN5ay3lq2ZHflCRYD8Sjx+zhCs/nQY6Ram2xdEf5FoSzjlYuujsCIasSA//UwWUb+veE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568936202229503.4556355216606; Thu, 19 Sep 2019 16:36:42 -0700 (PDT) Received: from localhost ([::1]:49792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB5ya-0004lz-Jy for importer@patchew.org; Thu, 19 Sep 2019 19:36:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39323) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB5sD-0006N2-Si for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:30:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iB5sC-0000or-Do for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:30:05 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iB5sC-0000ob-8X for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:30:04 -0400 Received: by mail-pg1-x544.google.com with SMTP id c17so2740479pgg.4 for ; Thu, 19 Sep 2019 16:30:04 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id h8sm103340pfo.64.2019.09.19.16.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 16:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eTxCu2cA0J5WLFUs9gnavWyyP8aOc6nLl3OMieDyOi4=; b=xoEDfWuROv4YFw1LWKYMRw2b9hAAwTGmud08hZSU5t1+yR/CkGrEmolBOqpNUU/6bU EnH1o4MNLUHLkiittMyysm+wsy4b+fPUPAM2R5asjkTqQU5xNm3PF+LqS7uwsi4Y3gaC 40JESRBLKt0WSFFa82fu09B4QkLWX7Z1OTZR779n8HeXfQLHtHssmxJ75/uKWR0/Pnco jURXiY/bDMgGUaUeSr27SL+7rCsSqg5z4QkARxJHCXHkYdUvkx+afuyY4LSzGIdpGPpa zAFtn/bR1WtTSq6WhQNJZY0W5IFJJ0VDbRSlce858WUlAc/HJFdZN3roEWSEREdaUnOw AVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eTxCu2cA0J5WLFUs9gnavWyyP8aOc6nLl3OMieDyOi4=; b=tQJLi2n3R9f42dpJsR0qY27H/10lVOHAsN8G61IDZGI9NIpSdZMzIolqWKTDPNP3x9 ADE7c9UiXB1CQTBTkxK6u3BEAxzeoUe6l0WQx8lX4zbbhob3D86Bk9OMjv/yvjanlLKw gMz+VvkjYZf/yMzV7fzJoVEZ8ZwP6WsewtKw6bg0fNF1IFDvqsgUsoulDiKgpfdOfL2b pXm6ePVxvwB3oYOEHa4W3HaAdqtL5b6lhNCh9CfZQSU+TcqrxGZCQa0AxV0YAc+gzJM5 cBG4ZvJe24XumciI705wR/bM7jy3X+rdkUemGKKmBUukN2lohVA6J/InWaXIZ/Lq8EEv XUtw== X-Gm-Message-State: APjAAAUAkL9lv6ySwnEaRbEe/ZftExSjgN9eLB9QRHFXEv1+71LGTP5v O6HaWT99cht2Z1Huitv2qKQgCst+/AM= X-Google-Smtp-Source: APXvYqwwhF8uJe8zv+kLWI3rt2GaSs+KwcKFLVz3pJwN1s8gAMhlaji3y9pamKrXkACHXqv0/Ra51g== X-Received: by 2002:a63:1b66:: with SMTP id b38mr11652296pgm.54.1568935802877; Thu, 19 Sep 2019 16:30:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/7] exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY Date: Thu, 19 Sep 2019 16:29:52 -0700 Message-Id: <20190919232952.6382-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190919232952.6382-1-richard.henderson@linaro.org> References: <20190919232952.6382-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This eliminates a set of runtime shifts. It turns out that we require TARGET_PAGE_MASK more often than TARGET_PAGE_SIZE, so redefine TARGET_PAGE_SIZE based on TARGET_PAGE_MASK instead of the other way around. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 8 ++++++-- exec-vary.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 5246770271..2db73c7a27 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -213,19 +213,23 @@ static inline void stl_phys_notdirty(AddressSpace *as= , hwaddr addr, uint32_t val typedef struct { bool decided; int bits; + target_long mask; } TargetPageBits; extern const TargetPageBits target_page; # ifdef CONFIG_DEBUG_TCG # define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits) +# define TARGET_PAGE_MASK (assert(target_page.decided), target_page.mask) # else # define TARGET_PAGE_BITS target_page.bits +# define TARGET_PAGE_MASK target_page.mask # endif +# define TARGET_PAGE_SIZE ((int)-TARGET_PAGE_MASK) #else #define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS +#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) +#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS) #endif =20 -#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) -#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS) #define TARGET_PAGE_ALIGN(addr) \ (((addr) + ~TARGET_PAGE_MASK) & TARGET_PAGE_MASK) =20 diff --git a/exec-vary.c b/exec-vary.c index 67cdf57a9c..26daf281f2 100644 --- a/exec-vary.c +++ b/exec-vary.c @@ -83,5 +83,6 @@ void finalize_target_page_bits(void) init_target_page.bits =3D TARGET_PAGE_BITS_MIN; } init_target_page.decided =3D true; + init_target_page.mask =3D (target_long)-1 << init_target_page.bits; #endif } --=20 2.17.1