From patchwork Wed Oct 23 15:44:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 177329 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp985688ill; Wed, 23 Oct 2019 09:48:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwH0RQ3BJCpP+rPt1qGrchacCvTV8cu4pVlYdqjSEWKcaSbUlqjlLhJ7psbGFhT17V2Akn+ X-Received: by 2002:a50:984b:: with SMTP id h11mr21411967edb.248.1571849303756; Wed, 23 Oct 2019 09:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571849303; cv=none; d=google.com; s=arc-20160816; b=wHsZ8GI0ZWK2dviNCn/7kdJfB6Z6K9xUbCPGpainRFHfl390PjeFTHSgzKkEXLnWW9 7SF3WML4jM2AucpCu1BAOjqdXrnd/fx38rzj2nJ30LQfAqEGd55MZexvQSIOEsVMWFpK dcy269QiOxosbYWu01IsMVsvxUO2bN5h4xtXIR0l9XQMqE4f/1duX70RdNQwPNbzLoAo GobAxePVx7JGj/nwQzA/8j14C+/O4grEBes4AE4W5d9K5KVtdOJR5Mzd8+jLiifVnciZ X+43t2w5wW0PrbhCfmtVE3eIC/YQvb1VgxeJwNkRF9/sQ61AfDje/2b2gqDOgwyIvfs1 1Rwg== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=VdwoVOQvGjyK5xwO9CwTmTvaoS1oPRDJG2i202FKHeA=; b=gtoLABLnz0dOG6fCq1YnzB9geWRD9BiJaIweQaxG7vqp3FpmbtkoGJpQQnVuJTPWKF 90wXHfe1g0iEngqoa8BBUKM9++RKMj+CRj3AouSNyZ6/Ck42XFIGOyIHqgHuLOjbcS6B vSyqb7pV7daTqXF1w/ZHnFmnGbjDixNX7MzuYkM/UXRktFUZsAUsDT68ao+OGwQaQAsP J6tT3eTbDZb3TBjyWvV01SX8bFo/83P9vnIeOUjVaDYUiodcUgHXQN8JnVBlTQs2nOZO 8MUbAkU9jezwPsdTQl6QV/X4o5uJGFOMfOZ7wbgOukyX3QsjAT/xYQEeSpp9ynH/Mqmp zoOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K3Y/xAHu"; 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 s58si9103988edm.45.2019.10.23.09.48.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Oct 2019 09:48:23 -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="K3Y/xAHu"; 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]:41588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNJo6-0000o8-CG for patch@linaro.org; Wed, 23 Oct 2019 12:48:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42496) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIp1-0004cO-3T for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNIoz-0005RH-33 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:45:14 -0400 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:46766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNIox-0005Ki-2p for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:45:11 -0400 Received: by mail-qt1-x82f.google.com with SMTP id u22so32898232qtq.13 for ; Wed, 23 Oct 2019 08:45:09 -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=VdwoVOQvGjyK5xwO9CwTmTvaoS1oPRDJG2i202FKHeA=; b=K3Y/xAHulnNNkqoZ/f937AsEOym8U2bSpJC+sPBBbW+dYInTBLMUarGjWz/8pd3Fto BqzAZleXOIMYOnW79c2Kk5xoEdMp79nwd9yBk7M5YciIH5SyoviOKAJhyGjmlhUB9hjy g775Gf07wETmxgEuzSCy0j37hpPqANcbYLNQ6fF0QDwV2lyVmcdg8Af2xgR59TphVPSV YAsjidGwfzRGvQ0a7fG/Nbhoic2TMgTpOR530Jhxh3yM6Dbhpq8PsqYnvT8C0us86r4J Pt6akoAzwDHrURwgNGVjt2nRXB5CAwde8XHmjWHl3HIOxiaugQtjBsaV+FY2OsZr/J2T k8jQ== 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=VdwoVOQvGjyK5xwO9CwTmTvaoS1oPRDJG2i202FKHeA=; b=Y1xfFbPY/5QHUH0170WOqpJ3joNow5+xINe/2gbhqokSLzX+pligL4MI1LaX7l/E8T 3nJ0rFYV0fTddCtHWyFswMyY8l9S4ckqSMf/+7kKBagoRkYfUaNkcfPoUGBTbUhaTtII 7p+TMrcAaRSCZHeLyStbZuG78w+J5xqGD8GrmPDLhuHG4mPzd+Bnrxq52RUnXYmKW7W6 btHV4gqEnmEgXDf59yT6vXeZ6D5cUu6CL1NvoLfH/03EZNZ++zSIJVAMV89oJyTt/wbs fAxdxvwZ91lVfNvn8e+gbDjhFxuN4LkjY4pcR9gZlqXMP6p0fpeVZsKKZVATlV7MVBTh XPuQ== X-Gm-Message-State: APjAAAWHlA2xL4YtKegi7uuJ8tVcE54euWajZLkOoqTTgt4lpYVtwY72 EreyKb1c+d89ovLEh/Qq1nKcViiiwVY= X-Received: by 2002:a05:6214:1ca:: with SMTP id c10mr5266708qvt.233.1571845508689; Wed, 23 Oct 2019 08:45:08 -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 o1sm2456272qtb.82.2019.10.23.08.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:45:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/7] cpu: use ROUND_UP() to define xxx_PAGE_ALIGN Date: Wed, 23 Oct 2019 11:44:59 -0400 Message-Id: <20191023154505.30521-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023154505.30521-1-richard.henderson@linaro.org> References: <20191023154505.30521-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::82f 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, alex.bennee@linaro.org, Wei Yang Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wei Yang Use ROUND_UP() to define, which is a little bit easy to read. Reviewed-by: Michael S. Tsirkin Reviewed-by: David Gibson Reviewed-by: David Gibson Reviewed-by: Juan Quintela Signed-off-by: Wei Yang Message-Id: <20191013021145.16011-2-richardw.yang@linux.intel.com> Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index ad9ab85eb3..255bb186ac 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -220,7 +220,7 @@ extern int target_page_bits; #define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) #define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1) -#define TARGET_PAGE_ALIGN(addr) (((addr) + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK) +#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE) /* 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. @@ -228,9 +228,8 @@ extern int target_page_bits; extern uintptr_t qemu_host_page_size; extern intptr_t qemu_host_page_mask; -#define HOST_PAGE_ALIGN(addr) (((addr) + qemu_host_page_size - 1) & qemu_host_page_mask) -#define REAL_HOST_PAGE_ALIGN(addr) (((addr) + qemu_real_host_page_size - 1) & \ - qemu_real_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_size) /* same as PROT_xxx */ #define PAGE_READ 0x0001