From patchwork Fri Mar 1 23:05:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 777098 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp1603270wrn; Fri, 1 Mar 2024 15:15:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWJkxkd71HCpIk5ruNnfZgtyZlS7paMQDPEIuSS2RUZJ3h7LqwkFXlD0Mh5OZdrjCF4BQhW7pD3UQM1Sx9D2M/9 X-Google-Smtp-Source: AGHT+IF1iDTbMEKhaqYrqbrbRE2fHCg0aU5SRfIywobsmcCxyc+Ue6YPNhR/P/2xd5ZAKBE0auiH X-Received: by 2002:ad4:4dc9:0:b0:690:44df:b33 with SMTP id cw9-20020ad44dc9000000b0069044df0b33mr3454160qvb.42.1709334905318; Fri, 01 Mar 2024 15:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709334905; cv=none; d=google.com; s=arc-20160816; b=OlMsfyuYfyRYOqYEUbxS+Q9wLsLIvgydIc/9Zo/b3wWxm9Q2iD6ISO8BlVeyZCTNsY xY1VDtQg53HRFdpMDgU8Yz519D18D84garh1bs/Iz8TefpEWcIcVHLMvasVuiXfvdFAA 6NZjY/MFpp+8u4m10h4WXQogmNNFYpDUf7ZaKD6s5m1wxgmFM66JF3sdUE5lQ42O6rkn YGHpsriUJZoTmZf6yU98HNuuVputp5+D7RJBwrIl+6gamCEFmixTMXHDeskRR1EfI+SS 3tVGLYDnX3S6YuH07YKf0YO2myUEr1Ii4epvg8xe7J28Ni4ANesR/myZ3WWiGqDy5yPl 8Ujw== 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=K5KQN5vcI0KBxXe8ErUYFGLj7ZU4KIuwkr3avJe+C4E=; fh=TypceWkQqZAd58MbMvFzjbJhJVwYT3Z2Jon575mPbgg=; b=TkIExtZSu43ldY2W3Z0fCNf6o+7195I6hUVxGp90S/wORlgfRhruJhuOR04Umy2X2u z3AybQUeemqSNViXUCG9UJKK2mMiJRF2ILF6ncl0tSprHscmTTnDFa9/WYn4LPTvOSgd tIZakyGJJC1vHYDUabXmDQDjhcOhCvfjvrnS6PuL6DeOx6XEBUhTQ8/xL16ZZb7/alLj VrCf0K0A4DulNPHqnVoQ54l9H/En3qQE+cPjYVaoRevIoIYdXFzdo+DwbybyAUos2avV MDmiKXnFYzk6O+fI7tlt0TDBzRj8X+Y6yOl3kCz6SpDO5f91b/9El13AhI+3WkPEMDPY wL2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MkwIIK/h"; 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 4-20020ad45b84000000b0068fc839406csi4631690qvp.378.2024.03.01.15.15.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2024 15:15:05 -0800 (PST) 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="MkwIIK/h"; 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 1rgByB-0005Xe-4n; Fri, 01 Mar 2024 18:07:11 -0500 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 1rgBy5-0005GP-JN for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:07:06 -0500 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rgBy4-0004JU-2c for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:07:05 -0500 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1dca8b86ee7so25633895ad.2 for ; Fri, 01 Mar 2024 15:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709334422; x=1709939222; darn=nongnu.org; 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=K5KQN5vcI0KBxXe8ErUYFGLj7ZU4KIuwkr3avJe+C4E=; b=MkwIIK/hIwNe3EivDUniCDfh/yvahtYbkCUjNJM3FMw71NbcP2T6BVUHaP6JjCG4r6 SqmCYQALDc+sSo4sd6v/oh8aJA19DGMHAOTKgd8GeHHa/mSvZnzcwDJ+CfVNTSwsTyjp Zq+BAn3aSgKsrRl7/gfyj6x71NPUa8BQgTXrcMwbJP1X5CPI4IPLdxVSgFDhzzcvGPCO ZpWwACjpU4y59LSDMorz0WSazWIyn3QgwVU5Pg6mHHZq4Vo2FltEz5cvBnDTnLlEQW9S u+/RldH1FcWYJINLaQ3Z7g5e5701udbk8xZ9q6OiJiadAslGQeFcYOf+Mp5tMzalzSMt 2G5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709334422; x=1709939222; 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=K5KQN5vcI0KBxXe8ErUYFGLj7ZU4KIuwkr3avJe+C4E=; b=ISMjJ7XhXSxwUAiKGmuE/HWE7Ok2fDYFQGfRHCMuxCTZ8vHx1/nHU9AIdJ80+9IfuW b3t9EdIZ43p0YYSOYK27q+LbkwEft+R3QBII4pXNYaVyR7r8eIPsAM7Tk9SBo+49uQYW A4SfLTMfEfrwBeVin6selK4mVM4IBM9VAYXyxm9yaLDwU5iRjbyowwbH9+6kSM39s2uP xQ2AO60w21XLlblLUQ2tA7zXdMPL5dCjb3GgHPY6+QrV8/EXIkFk/1AMXH8tbGw32W52 rJ1i8lmNh9i+q5vzy+M9D7lMc4hXtOCmMne1BzSDQ7et7WJsYppABoEunACFO2avRNto ga1g== X-Gm-Message-State: AOJu0YxDZ0/PxSylqD235vSpBbyn6rT/+afm9N1a8GkU4tw9/d86/KMl S6YcXJ4f9vGFmpLqNpERfo1mPGnifC5CPk7xPwfvbljEAjYrsCBYdE8iFhfeYlo50ycz/BVA1LX i X-Received: by 2002:a17:902:868f:b0:1dc:a82f:c6cb with SMTP id g15-20020a170902868f00b001dca82fc6cbmr2864710plo.16.1709334421828; Fri, 01 Mar 2024 15:07:01 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id lc11-20020a170902fa8b00b001dc668e145asm3988580plb.200.2024.03.01.15.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:07:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Ilya Leoshkevich , Helge Deller Subject: [PATCH 28/60] linux-user: Remove HOST_PAGE_ALIGN from mmap.c Date: Fri, 1 Mar 2024 13:05:47 -1000 Message-Id: <20240301230619.661008-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301230619.661008-1-richard.henderson@linaro.org> References: <20240301230619.661008-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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=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 Reviewed-by: Pierrick Bouvier Reviewed-by: Ilya Leoshkevich Acked-by: Helge Deller Message-Id: <20240102015808.132373-11-richard.henderson@linaro.org> --- 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 53e5486cc8..d11f758d07 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -191,7 +191,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(); @@ -389,8 +389,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); @@ -550,7 +549,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; @@ -595,7 +594,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. */ @@ -625,7 +624,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 @@ -794,7 +793,7 @@ static int 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,