From patchwork Fri Oct 25 14:21:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 177757 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3803871ill; Fri, 25 Oct 2019 07:43:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrEzW4Yud5LT6W7u3RQntWGQbHMbG1Bm6gxz5o9GAy8tAz02gaoFHbhvbWJvwLYzxoij/U X-Received: by 2002:a50:b634:: with SMTP id b49mr4328690ede.77.1572014590293; Fri, 25 Oct 2019 07:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572014590; cv=none; d=google.com; s=arc-20160816; b=IsfARGvImXC70yT7EOP/a2++4CbURNTKfe106eU2yhirrIHZZdbfJ9cDl5oc6OLXup bP5tdlffixYYhxiu4kKieZgrHQ+FUjdvZPzP1oB7AkdXvwIvSHP4neSE0iJblC4i30Uj auZ5Qp8JUzAbcfbClpOmlt9HAmfYKicvdKhSHIqVdOZ//ge2Cyn9yWzOxNy2tpQRb3au FLaxRU703M+6NThiuQ74T06kyWi/s+QGtJx5B5lvjN0QjebzSljAgvApb68TILEGNKxg dw/BrlTub0ycdoZezr4R5NJMAZWuOCsZmwu801EZ2x/pOdSGgD/0iqFR9iMhMPmeeXk4 QlCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=XXN4/2a2+6dy7fA+RkJ2f7Fcs3d5SyLj63Al4EWJuoY=; b=wio4caqKyCoefASwzx9LBKDtpb8oUlykHcRjDmf8ESMfvNh/2zLh3XenRc/yt+/e2x N036CKiPkIOUXRm//LcT50X8rxRu2CUQaOGJrRVsTcT42ks8RAO9A+IsLkt2Rjf9Au0w rlso3YJrqvwJ2KgYynpCsLNyMqaoS+vRaDoilz97NO/p4kG38QDqrTAqo++ubzD4OOaE Eb18747+XlEwiJXAX+fD3ubw8ApdGHKs+Dm6A7z86Sohp3DrleDJ1XOalWLljIo/Kv7m L94Dv1xMtSOq8RXDuqdLvv+JB6fesxCrBOCmSxJnN3DzIsFOFiLUBUDuw0zq+0mLbHZz TlUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iVVAIhMB; 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 g14si1233360ejx.238.2019.10.25.07.43.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 07:43:10 -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=iVVAIhMB; 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]:33064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iO0o0-0007g9-Ql for patch@linaro.org; Fri, 25 Oct 2019 10:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44383) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iO0Tm-0005Be-QD for qemu-devel@nongnu.org; Fri, 25 Oct 2019 10:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iO0Tl-0001ff-Hy for qemu-devel@nongnu.org; Fri, 25 Oct 2019 10:22:14 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:42371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iO0Tl-0001fN-7m for qemu-devel@nongnu.org; Fri, 25 Oct 2019 10:22:13 -0400 Received: by mail-qt1-x82d.google.com with SMTP id w14so3451279qto.9 for ; Fri, 25 Oct 2019 07:22:13 -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 :mime-version:content-transfer-encoding; bh=XXN4/2a2+6dy7fA+RkJ2f7Fcs3d5SyLj63Al4EWJuoY=; b=iVVAIhMBW5/uhD8NT5xQNE5ySyRimlk7WiQwN8AeZvtJ3r3uaipzyszVb11WaS3Kjb LvUtOxrPZKw9K0D0BsZrrPsbdUu8uTpyE1aPjubuFnWih2TaBYrblSlgdnt1vtk9AMmY lg1N6xMxUKE9lnbs+lT+2FQG4D6DfVAMlQDk/VR85mNTp4OmQZWTO7k4UpAlyhT7S2vF 87RQjiDUpdqjfWiQQli2Dqk2K3zIZdJSN0DEHBX6rgdIdHeynhXT+aJ/CBeGqM6Bbbsx NqHAwLhIenV6mM7uVf0EJ+LNBHX+14tmaxEYhv0rLvZ2Wx1kZAyGb/yx/+cbP4gZ1ZQO Qr7Q== 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:mime-version:content-transfer-encoding; bh=XXN4/2a2+6dy7fA+RkJ2f7Fcs3d5SyLj63Al4EWJuoY=; b=DFssHhAmO0pKn9T8WFexDX3cJOMq7R2+tJ1NFhUkucsZs6UPIKKAzl+Q+nfZ0vlc2m iIipzohZ1uNAFgYPVzZrDoGEyEfNO+eMdRO1HiVwkucQ8D3etfoDW2AxZDkGe/jwSJds Cv+41SYzWQYUHdt0442Ps/wRZ52xp7hBWCYz/XQ/v+b8g/cQsDWAjXnVIQLUkJykWFog N0MPQZJxKnJVEptQHP1Vb428YDkB/VysVjowNoaOjo8jLI23qXN+X1aFObtaVPbQ+QCW bLUWN1n4oS58IRwJ+wIXLgusrtMnWZPgCm/kQ/HNSMTmkCLyuBCErrtgPw6zJnlkOcVB X9gA== X-Gm-Message-State: APjAAAXWAEDQv2r5yHxhcMfro25ZkzjcMZfTbY+xZRpKmWASRXIHZ3QM akxbAztVRxe9XXZIyrj6o9qrSmDLnd4= X-Received: by 2002:aed:228b:: with SMTP id p11mr1520365qtc.196.1572013332264; Fri, 25 Oct 2019 07:22:12 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-50.nyc.biz.rr.com. [172.254.253.50]) by smtp.gmail.com with ESMTPSA id q17sm1137050qtq.58.2019.10.25.07.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 07:22:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/12] exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY Date: Fri, 25 Oct 2019 10:21:56 -0400 Message-Id: <20191025142159.12459-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191025142159.12459-1-richard.henderson@linaro.org> References: <20191025142159.12459-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::82d 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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. Reviewed-by: Alex Bennée Reviewed-by: David Hildenbrand Reviewed-by: Paolo Bonzini Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 8 ++++++-- exec-vary.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index ba6d3306bf..08b3a5ab06 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -213,6 +213,7 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val typedef struct { bool decided; int bits; + target_long mask; } TargetPageBits; # if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY) extern const TargetPageBits target_page; @@ -221,15 +222,18 @@ extern TargetPageBits target_page; # endif # 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 -#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) -#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS) #define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE) /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even diff --git a/exec-vary.c b/exec-vary.c index e0befd502a..0594f61fef 100644 --- a/exec-vary.c +++ b/exec-vary.c @@ -97,5 +97,6 @@ void finalize_target_page_bits(void) init_target_page.bits = TARGET_PAGE_BITS_MIN; } init_target_page.decided = true; + init_target_page.mask = (target_long)-1 << init_target_page.bits; #endif }