From patchwork Fri Aug 18 17:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 714657 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp629178wrs; Fri, 18 Aug 2023 10:15:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpQ5htv32om9FSc5RKUMaKD+eAgQ+2LSX8v4+xNrc56xHorUnNhmmGPPzCepjx+MESaREl X-Received: by 2002:a05:622a:1054:b0:410:ca1:62b2 with SMTP id f20-20020a05622a105400b004100ca162b2mr4527169qte.60.1692378921343; Fri, 18 Aug 2023 10:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692378921; cv=none; d=google.com; s=arc-20160816; b=0AGnZxc4JCMTBwhrOT4VKxT/LPosq4jYWVr7sJmBl00boqmOxQuWSv410iixueovoF /2GYZ04amhb/dugIGdy4SM+fvxuNstAomwQBDQ05P/Usuu0Vd4f0KRYrjykkW6Ph4Lgq 3UChl5CvEajBlU4lHOmb7DJv4tfNBMT1AUG22ZNy0onNNNuCam97iTkTW/4XFLe4DthC 1torqrnLHmmxqXmSjoRNtTtDmFsUfrAleVrWduOdvrSYPOeBVxuOx39w3BwT7At198zb engOR7wKiakOuVrLg1W36XndoeUQdDUYlFpGNEVl5F0RUaBRqzCGb+64+8IhCFDQdBUz RdIA== 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:to:from :dkim-signature; bh=zm6LGbzRYY77HgezAnXq5Cmr5DPYLmRbQvieaAAbplU=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=gGn3cv+45CXVc5Kbd3da4b4CjYjM/HiJCaL6gF8zIenHHR85gIDBcSOluhrOy/xmzT 1WBq6rBlts9eENKUGIcvereU/HszxpDaMhptvwgykk7pbuEQMkZi9hsgDDB8I2f645GC jRtH5I2bZUoBOQiZv1uXQZn5YsHbC9TKnwXC7b3Mna/ILwa2hpZrvS82lub4M4Iz6n5U exdlJJa96K+mJamTf/Z88IJCmSq5gNXuxfXoUIFymeGdkW35nW81hYlTFQTooTdyEr+4 YHtjdcJ9wCn/B23b5oSpfCym3eSJHTwtjcRy8Z9FUnVz1Uu/8mWLqXc7fCnI31KIIBSn AsZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h8miP2KV; 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 c13-20020a05622a058d00b0040ee47cae96si1490218qtb.621.2023.08.18.10.15.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 10:15:21 -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=h8miP2KV; 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 1qX31j-0008EZ-2G; Fri, 18 Aug 2023 13:12:47 -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 1qX31i-0008EB-3V for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:12:46 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX31f-00081X-TF for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:12:45 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1bba48b0bd2so8738905ad.3 for ; Fri, 18 Aug 2023 10:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692378762; x=1692983562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zm6LGbzRYY77HgezAnXq5Cmr5DPYLmRbQvieaAAbplU=; b=h8miP2KVjiASi/7WufWnevxrGkCfGySgUm2aRmkUQjL4Ulw/8lN1OEt0ESpD25Ui8H TuIOtlN70v3+sTMzyu6UhC0avpKzMK93Eip6mRh6QouX0vpNomyc4i6B5+aARk2UudmC mn6/lk2s7bpNb4P7wZ2uLDWHvFClI/rjL+pdz2iVgyfhxB+ExXzdHZyWIMnOEvwzJYjz rzGE5MvnEYpDz+/I9herQurC9Gbu84nbYGgnuAfoqCTe2IuGLiNgTtg8dF3IqygDnxnP kiqlfy2B6SYFQj3v0xYiFFh3Lbf++BFZNIaSbIwWbsYrjAAboneBgFEhsdj9eGrQQoDf HFJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692378762; x=1692983562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zm6LGbzRYY77HgezAnXq5Cmr5DPYLmRbQvieaAAbplU=; b=BjNnAeGnDufDnMBVF4Mo/V+c+mahN0CpbJTmXSa2VvTCO0PF86w1+5avWyO/bHzJox XHrcr+1e2hRwrRSelyR9AzFrQPYW3kW+x6SFZhwKKcJv7oVKZHuBbEaNYDjJ2HsJsuWo LU+6b0MD46K8cdoQdZuH+nA/Eeb+YOmq4mSUGF5SMKewnqy4ZTuESprHMFmWJK/aW9VE Kr8VCbh1qv8mgbVbAKrQ35R0K6sAR3Ntjoab1zsFYcOhbcSvBQGCNnhVzJvnHwyH+4d4 KaXpKTpGYmzStLyfwrkjYnFmTjeOWIbr+7vnWdJkd/Z3xMTZAvn2Byc9i1Foz8Q1j82C GCuw== X-Gm-Message-State: AOJu0Yzgvxv5XWIoW9ss5zM0elvlW7SPq1VMlDzN3Ka5jFYvEZlmQRSr o7GqGt7dythGC9Rw5op59AZhZXvdOHfGIoLdQYA= X-Received: by 2002:a17:903:1248:b0:1bb:fffd:63d8 with SMTP id u8-20020a170903124800b001bbfffd63d8mr3283905plh.36.1692378762590; Fri, 18 Aug 2023 10:12:42 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:cf24:6daf:2b9e:7972]) by smtp.gmail.com with ESMTPSA id jw24-20020a170903279800b001adf6b21c77sm2020025plb.107.2023.08.18.10.12.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 10:12:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c Date: Fri, 18 Aug 2023 10:12:04 -0700 Message-Id: <20230818171227.141728-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818171227.141728-1-richard.henderson@linaro.org> References: <20230818171227.141728-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This removes a hidden use of qemu_host_page_size, using instead the existing host_page_size local within each function. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 48a6ef0af9..35f270ec2e 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -147,7 +147,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) last = start + len - 1; host_start = start & -host_page_size; - host_last = HOST_PAGE_ALIGN(last) - 1; + host_last = ROUND_UP(last, host_page_size) - 1; nranges = 0; mmap_lock(); @@ -345,8 +345,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) start &= -host_page_size; } start = ROUND_UP(start, align); - - size = HOST_PAGE_ALIGN(size); + size = ROUND_UP(size, host_page_size); if (reserved_va) { return mmap_find_vma_reserved(start, size, align); @@ -506,7 +505,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, */ if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { host_len = len + offset - host_offset; - host_len = HOST_PAGE_ALIGN(host_len); + host_len = ROUND_UP(host_len, host_page_size); start = mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); if (start == (abi_ulong)-1) { errno = ENOMEM; @@ -551,7 +550,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, void *p; host_len = len + offset - host_offset; - host_len = HOST_PAGE_ALIGN(host_len); + host_len = ROUND_UP(host_len, host_page_size); host_prot = target_to_host_prot(target_prot); /* Note: we prefer to control the mapping address. */ @@ -581,7 +580,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } last = start + len - 1; - real_last = HOST_PAGE_ALIGN(last) - 1; + real_last = ROUND_UP(last, host_page_size) - 1; /* * Test if requested memory area fits target address space @@ -749,7 +748,7 @@ static void mmap_reserve_or_unmap(abi_ulong start, abi_ulong len) last = start + len - 1; real_start = start & -host_page_size; - real_last = HOST_PAGE_ALIGN(last) - 1; + real_last = ROUND_UP(last, host_page_size) - 1; /* * If guest pages remain on the first or last host pages,