From nobody Tue Nov 26 22:33:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704161027; cv=none; d=zohomail.com; s=zohoarc; b=mRGrdjbhtOLLXbQ8IgA6gjYQc18bisFdAkaEWJ+i7lGnRc0OUw5jSDnsDqYtIiOGa7j6P4oMxSdyOXCVx3o0y3suRIVLDpxG+dQIlbXl98+XBsel0WM2M0U5vZ0Fbbe0cGY1EDrZ9bS5Wki0orEwswg/w2WylfWBPMXvT0SAIwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704161027; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=SjN83cVYCiop/vN+SdqqhBrpQ2lAiZ7szn5smiP5b+Q=; b=MH4dtAsC4N1nSlFJLlJ7Q0eOOIq8vb636jgYcc7YAb1z17hQNKX5rw1tQjttk7jwdOGmd9mQOyDg2qQ/YSFrFLhi/bblvwSgr9U/dv9NxN+MaegcnaE8fZ0T9oTLesUun+j397DIQzYGpgQxexzvlOKv0rPRcyBTOI+Dr2Cc/F0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704161027385982.6440522429681; Mon, 1 Jan 2024 18:03:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKU3I-0003KY-TU; Mon, 01 Jan 2024 20:58:44 -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 1rKU3I-0003K5-9y for qemu-devel@nongnu.org; Mon, 01 Jan 2024 20:58:44 -0500 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKU3G-00071g-RW for qemu-devel@nongnu.org; Mon, 01 Jan 2024 20:58:44 -0500 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3bbd6e377ceso3057820b6e.1 for ; Mon, 01 Jan 2024 17:58:42 -0800 (PST) Received: from stoup.. (124-149-254-207.tpgi.com.au. [124.149.254.207]) by smtp.gmail.com with ESMTPSA id g33-20020a635221000000b0058ee60f8e4dsm19561891pgb.34.2024.01.01.17.58.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 17:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704160721; x=1704765521; darn=nongnu.org; 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=SjN83cVYCiop/vN+SdqqhBrpQ2lAiZ7szn5smiP5b+Q=; b=sbaovuYRX985LPidP+U2lfMs8Y5PZ9ZgvqEEWAFQtNbaFIBlS1YS0y6odAF/kWEOuF fOqyMJXg2y3xyjYyVe3vYdmph/44jF7l0wUPvmEUPBc3c9YEjXYMp24jt1rMu2k0g3fy V9zxY3lu1YvivS3ltdousGJEl0gc+QUwmikZ1sn69b+8tPwfk4bIUwDW/mxiP+LLiuR+ hFzH2ONXIGom9exAaVO6Asulzk+1O5gC1B+WC/5V1NwKSCC/RJ+RdfAmxU2u7D/MIi0n uh2CnF00BDgMPwethy1x4aILx1dZQSx/3gYede5VzVGpNFd1d/H+65+DNmbkglUb1Nul HDhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704160721; x=1704765521; 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=SjN83cVYCiop/vN+SdqqhBrpQ2lAiZ7szn5smiP5b+Q=; b=FgEOi3yembWsQ17O5NdJYnEQPq+VnJseG/iwp92rEcBeuPHPtTLvuu5eY8+FY4s/24 t/Rg+iFzB6BCaEpd/RYSTwFMICbucObL4stpfEM4BuQ9als8dda6H9QEkivIOQC0otd4 xrg82cc1K8nNGtGTH16JFtEHKO1fu7I70B0ZhwgDN6xFWmsZoWYdV/5/wFy06+sojwjh 86RNzhvU8l3fvnifap+fSSik3ZhOkUi+Gk0vfOFe3ZLpm/qPtdTa3ghhD96n95hfLtAY 6Lq/sUSLWt3Phb/UnZVMfFJfk26UaBbOI5p0CORjjJoEAS0HrJmdSRvyukqBzXVKkdwG z8Hg== X-Gm-Message-State: AOJu0YzD5zATeToHwptX2R3Y0P0uyFGz0EN0BKxS3R+fnkVPlqTbvp8A r4zrDlKb4oBDtD0CSu2P11GtlBT50Ea5WSOcNjjI4ai4CDs= X-Google-Smtp-Source: AGHT+IHSAkNQIUF9l/OvgwFEI9CCyA655dCGDJQx1UepLwuAqHCzcmzVD6cVpvpmTZ7xvPvJdcPbnw== X-Received: by 2002:a05:6808:208e:b0:3bb:f5f4:e5ce with SMTP id s14-20020a056808208e00b003bbf5f4e5cemr4818747oiw.41.1704160721692; Mon, 01 Jan 2024 17:58:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN Date: Tue, 2 Jan 2024 12:57:49 +1100 Message-Id: <20240102015808.132373-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102015808.132373-1-richard.henderson@linaro.org> References: <20240102015808.132373-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704161027855100001 Content-Type: text/plain; charset="utf-8" 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 --- system/physmem.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index c09953270f..c1e48dfb6a 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1680,7 +1680,8 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsi= ze, Error **errp) =20 assert(block); =20 - newsize =3D HOST_PAGE_ALIGN(newsize); + newsize =3D TARGET_PAGE_ALIGN(newsize); + newsize =3D REAL_HOST_PAGE_ALIGN(newsize); =20 if (block->used_length =3D=3D newsize) { /* @@ -1916,7 +1917,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, Mem= oryRegion *mr, return NULL; } =20 - size =3D HOST_PAGE_ALIGN(size); + size =3D TARGET_PAGE_ALIGN(size); + size =3D REAL_HOST_PAGE_ALIGN(size); + file_size =3D 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 =3D NULL; + int align; =20 assert((ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC | RAM_NORESERVE)) =3D=3D 0); assert(!host ^ (ram_flags & RAM_PREALLOC)); =20 - size =3D HOST_PAGE_ALIGN(size); - max_size =3D HOST_PAGE_ALIGN(max_size); + align =3D qemu_real_host_page_size(); + align =3D MAX(align, TARGET_PAGE_SIZE); + size =3D ROUND_UP(size, align); + max_size =3D ROUND_UP(max_size, align); + new_block =3D g_malloc0(sizeof(*new_block)); new_block->mr =3D mr; new_block->resized =3D resized; --=20 2.34.1