From patchwork Thu Feb 15 06:19:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 772867 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp681530wre; Wed, 14 Feb 2024 22:25:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUqZAot0jhSid/sZPhbGiLFz/DGzCujXpuSGPk88hbVBo4QmTImaWg6VJzdmqIGqMKZqVRvCwq978YdcRe/N/1g X-Google-Smtp-Source: AGHT+IFS76gvQyDILCH954uXSCB4yFQF5OBSWs4FQrHp2yr9mzPa7WtX25DkhlTeITy1UZC3Mhu4 X-Received: by 2002:ac8:5acd:0:b0:42c:7ea2:42e5 with SMTP id d13-20020ac85acd000000b0042c7ea242e5mr1092143qtd.4.1707978358686; Wed, 14 Feb 2024 22:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707978358; cv=none; d=google.com; s=arc-20160816; b=KhCT+AcCKSgli8apoVm4Y25V62KeqJmMeg2UrV1pT4pEb1NHMQr82QyjrolUEEukqd xSjYcCpC3sdp1PzFfIrk7Fl09hvUfU4VHkg0mNv4wXQTRfNb2I9xS5I24pmaawU8sgAB v2pgVLUj2fwYRM7Eum6THWBv9eFDRtiOiAZ4Q4MXR6mexR0rAyBS7CP6RPMHykfDeGrS TIXix0nTDyeXC2L+UaZlgvIxX38YGrrHpQBAiuNYg7V/ovbisfYkUEzJ11FAFLULJMx2 KAC//tOt/qU2GC7g/SC2fzAY522nEtCrV1+sIDhHO0xzyJ2YlqROk+3xG48X8Bx/OajP rJlw== 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=xf7vdSAvh/ZeTBRvXJBUTE4ih7Lx/NEC7LNkf984wzI=; fh=v7v6q89OJlq+NxHejbJ/ziw7VE+fSww09twjGPM2dQM=; b=wKNDP8KbQWo/m1nbtBTaa7OJTgB0egBIOPujWXpmYWFhU28HqvPyHAWocggAWFrIhv 7G6+J875yz9ZqMf15yJlBPFXHuluJEZv88dwmNd0M2kzPFSJlEAdCO1p4jKHPejzSx+7 kzYXxyUVzt3s0RblItG0Uaq3iTX5HYlRCYE8YB+RfbsZKxuou/zY8peAk3KOsHKwMLNe 5LWuYvGHKuLp57lyisyRrnSQlEBgd/WBOQJbqQjE/gjsX4ejvKsFayfrR4BwxN0nNPqz HeO4Ydent4X8RNSh6tue7PyF/PGvmIT6Zt6KO9RkyZejSmN717xZ2e6n4GwXOS+hpREM Ciwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="b5/s+50j"; 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 s3-20020ac87583000000b0042db23b5002si670719qtq.348.2024.02.14.22.25.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2024 22:25:58 -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="b5/s+50j"; 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 1raV75-0002NH-7n; Thu, 15 Feb 2024 01:20:51 -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 1raV6x-0002KX-VU for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:20:44 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raV6w-0005UT-CK for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:20:43 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1db5212e2f6so3915055ad.1 for ; Wed, 14 Feb 2024 22:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707978041; x=1708582841; 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=xf7vdSAvh/ZeTBRvXJBUTE4ih7Lx/NEC7LNkf984wzI=; b=b5/s+50jnCvU47HaumMDOWrixy55mYqUwuR/6/oF8ZQh98ljwurwbGyaUJpWEeBiQI zJezHEtpBOsPxXYxLtr+vX4OOvMok2YfDATUmCLrdm0OBK4frbaQlykTQuBlRjWSweu2 9ZR3U82t7EJkjTadc+hfBFjOr9b+20MMPwMTqQ3HROvo8MYClsIZVFOaIKYFUCQiE4CI yPKJ7JMENxmklh6Hm5IhJaypXHHMMPphmCWGx58g5DP4+QrrsUruxOkOB1nFOgpYm/bn c26MCpjMBQ0wX3NAKttexun9VrCuldaixBOYQ9l8tttNS1Fyn8TcXTAzqyNehQFaV4yU JqBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707978041; x=1708582841; 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=xf7vdSAvh/ZeTBRvXJBUTE4ih7Lx/NEC7LNkf984wzI=; b=NQB30TGLvCnykAgZOXOpmMrURX03AFVn0M2KfIdbH/J9t1Bv1EPp3ebvOnj+ZW+59H wj3Csa55aycXYbpj5KSXIachBABKlY/RXywxWNiK/0gWCoE4+AsXHFW2JrxnnB+KgC0G nccYHmT4LXQNlxj26HGgfPl7wua7/tjy3N3B606kIXjeAR6Lyk+FkN+t1ZBtlGqmeOxA Iqu8EXhumNFOksD5lX33MkkDTPIEn6tXYq86amRHeILJ+74PPcVzloSJ2WlB2qZMLWJZ 0bbO/OWC5U4XIhB4c3ZDN7vIk37bUguh7fKRiBn2TrXgJWFAAH5p9h9Q1IUaPG2GBg8c c4gA== X-Gm-Message-State: AOJu0Yx8XCyOQrIo991lrBuLB+es6dG/cgo1gLuktYXNVSPxXMb5Q8T6 HNHJWiCySRqQOn6GGsHBRzeIP1k0xyg2Q9lnwMwUXDMrJTExKxguaSbF+0kfUKkSd4Sw2x7ZK+u G X-Received: by 2002:a17:902:d2d2:b0:1da:2128:eb3b with SMTP id n18-20020a170902d2d200b001da2128eb3bmr6822345plc.28.1707978041161; Wed, 14 Feb 2024 22:20:41 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id d5-20020a170902b70500b001d6f29c12f7sm464418pls.135.2024.02.14.22.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 22:20:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Pierrick Bouvier , Helge Deller Subject: [PATCH v4 14/36] softmmu/physmem: Remove HOST_PAGE_ALIGN Date: Wed, 14 Feb 2024 20:19:56 -1000 Message-Id: <20240215062018.795056-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215062018.795056-1-richard.henderson@linaro.org> References: <20240215062018.795056-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 Align allocation sizes to the maximum of host and target page sizes. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich Reviewed-by: Pierrick Bouvier Acked-by: Helge Deller Message-Id: <20240102015808.132373-15-richard.henderson@linaro.org> --- system/physmem.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 508dcb7494..6b7c5747da 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1680,7 +1680,8 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp) assert(block); - newsize = HOST_PAGE_ALIGN(newsize); + newsize = TARGET_PAGE_ALIGN(newsize); + newsize = REAL_HOST_PAGE_ALIGN(newsize); if (block->used_length == newsize) { /* @@ -1916,7 +1917,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, return NULL; } - size = HOST_PAGE_ALIGN(size); + size = TARGET_PAGE_ALIGN(size); + size = REAL_HOST_PAGE_ALIGN(size); + file_size = get_file_size(fd); if (file_size > offset && file_size < (offset + size)) { error_setg(errp, "backing store size 0x%" PRIx64 @@ -2014,13 +2017,17 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size, { RAMBlock *new_block; Error *local_err = NULL; + int align; assert((ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC | RAM_NORESERVE)) == 0); assert(!host ^ (ram_flags & RAM_PREALLOC)); - size = HOST_PAGE_ALIGN(size); - max_size = HOST_PAGE_ALIGN(max_size); + align = qemu_real_host_page_size(); + align = MAX(align, TARGET_PAGE_SIZE); + size = ROUND_UP(size, align); + max_size = ROUND_UP(max_size, align); + new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->resized = resized;