From nobody Mon Feb 9 09:32:34 2026 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=1711533187; cv=none; d=zohomail.com; s=zohoarc; b=luzCaJh0ePpl+WbvqGSK8lddWLEdjAGEiru6LGNBjpvgyvB3wD2o3tMEz1i6Rp/e+eMPABNaUay6JYUE97zrJ5teNzyzmRHu/ec5wlM2MCRqLraprmcpsu3ww6myacBinn/PjAExLD0qIvFI4GpxxFZgjJ0ymGPdc16lHgi1Xic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711533187; h=Content-Type:Content-Transfer-Encoding:Cc:Cc: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; bh=TS+v/eLxATnG0O4x0k9d/m89qYtDW6sLXZHCB+9mUOM=; b=Bi126rKwv9mA1RnAEktMmZzr7df7SPoTrCmDmq9DjKWp50fRC/0o8CEEGWfQARDNuiqS4FB63RJ44hOXkxWP9jPwmMCzMxgmex/eRDoeho1K6B1WUmE2/LmYxPRNf6vhtstfDlyN1ysFxcC2qMWoWCQkGVcekyxizwrSU2Um52Y= 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 1711533187032729.6594865771492; Wed, 27 Mar 2024 02:53:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPxf-00050v-0o; Wed, 27 Mar 2024 05:52: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 1rpPxd-0004xN-C5 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:52:45 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPxa-0006rK-C9 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:52:45 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a466a27d30aso799594766b.1 for ; Wed, 27 Mar 2024 02:52:41 -0700 (PDT) Received: from m1x-phil.lan ([176.187.205.175]) by smtp.gmail.com with ESMTPSA id z3-20020a170906668300b00a4750a4a1f7sm4032454ejo.6.2024.03.27.02.52.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 27 Mar 2024 02:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711533161; x=1712137961; 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=TS+v/eLxATnG0O4x0k9d/m89qYtDW6sLXZHCB+9mUOM=; b=jdQBZRnOkpJ8/r4tBy+y31qMhhw/Qd8zOrxk5Dl7CvjavlM5srxochgjV1prS8gLKP t3mCsoYKyOqf/ieytxrA7jwoJ2gayui9zIqukuxOspf4s4bIqyNPUKPqu8n3+NSOhrQ6 /VwVttCMA4QcSRx08WlqJ+ogTqR9O8dyI1a0xBP6+k0bkKENSmJUshDEs99TzjEXhuQb 4q/szYbSA3XcJyQYMyPXHueRv5cRsHx40k7WbKyKGfhpuwFfUkW1WhUdfOvpl4zcSIph NScH8h9D4HAuD/l/brM554D6VyLA0k9og/kLiGoIqJWEvGWlLSwUIOKttp77/Cz+VlBY 4LXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711533161; x=1712137961; 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=TS+v/eLxATnG0O4x0k9d/m89qYtDW6sLXZHCB+9mUOM=; b=FIf2yiO72OoJrJIczyS6i7EttftD5UEotp/kldiQ0Cr00m4TBQVrQgAZkMao9sQZmL lhM7cSpoojl0qjvKZ3zvIG4MWt4h+HWXEFYn+pEsI7A70Qs6rr63H2TV5Ki2ZnTqorMR xyr0k8En5kxLGhxmllrKdrQE8aMNLxZztEAvYCa+hWzFI/Eas1RvZubOa+KLBEuRva7O Zq8mC5NfzI6ecf8sdg4+r5wkJSMPfkVZUhI7uE9tWVN7ZoG0rNFzFLDDQRb0CO5mbrwR UqF9rTHW+Cdn0ReUqn3Kdpc5H+5Sn10aTR4erZn8wg9kn5mBoDWmPKWMANaun/KLDK0y etCw== X-Forwarded-Encrypted: i=1; AJvYcCVlR/Qn2lNJINpXZCDCdNdhdR+z7FTJsKRWsbvvuF35//Bxtm8zdDYNcYonwNzq7w00mbJ1waw98aSh2VQKi7b7XP9MfWY= X-Gm-Message-State: AOJu0YxVWl2eIBTQz5SN0JO3iFrxbQxxDdZBaBxQlu/kjKz3s13ErsEo OM1QQx3xVdwIj1CURhYEUP77YPXOuwNhFFoOxlQU6l9SbvUGIrPUWIR058Cp0Js= X-Google-Smtp-Source: AGHT+IGwO0//GshnE3F7qsJKYqNnQPVm/trKifCPk4qGgQPBXwdvKOgA6tQeLu1DYmh6v8j5rd93hQ== X-Received: by 2002:a17:907:9805:b0:a4e:c5b:4b08 with SMTP id ji5-20020a170907980500b00a4e0c5b4b08mr161880ejc.11.1711533160796; Wed, 27 Mar 2024 02:52:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Thomas Huth , qemu-devel@nongnu.org, Igor Mammedov Cc: Paolo Bonzini , devel@lists.libvirt.org, Zhao Liu , Gerd Hoffmann , "Michael S. Tsirkin" , Ani Sinha , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PATCH-for-9.1 v2 12/21] hw/i386/pc: Remove PCMachineClass::enforce_aligned_dimm Date: Wed, 27 Mar 2024 10:51:14 +0100 Message-ID: <20240327095124.73639-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240327095124.73639-1-philmd@linaro.org> References: <20240327095124.73639-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1711533187679100001 PCMachineClass::enforce_aligned_dimm was only used by the pc-i440fx-2.1 machine, which got removed. It is now always true. Remove it, simplifying pc_get_device_memory_range(). Update the comment in Avocado test_phybits_low_pse36(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Zhao Liu --- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 14 +++----------- tests/avocado/mem-addr-space-check.py | 3 +-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c2d9af36b2..231aae92ed 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -74,8 +74,6 @@ typedef struct PCMachineState { * * Compat fields: * - * @enforce_aligned_dimm: check that DIMM's address/size is aligned by - * backend's alignment value if provided * @acpi_data_size: Size of the chunk of memory at the top of RAM * for the BIOS ACPI tables and other BIOS * datastructures. @@ -114,7 +112,6 @@ struct PCMachineClass { /* RAM / address space compat: */ bool gigabyte_align; bool has_reserved_memory; - bool enforce_aligned_dimm; bool broken_reserved_end; bool enforce_amd_1tb_hole; =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f9650a2821..adbc43ab90 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -716,7 +716,6 @@ static void pc_get_device_memory_range(PCMachineState *= pcms, hwaddr *base, ram_addr_t *device_mem_size) { - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); MachineState *machine =3D MACHINE(pcms); ram_addr_t size; hwaddr addr; @@ -724,10 +723,8 @@ static void pc_get_device_memory_range(PCMachineState = *pcms, size =3D machine->maxram_size - machine->ram_size; addr =3D ROUND_UP(pc_above_4g_end(pcms), 1 * GiB); =20 - if (pcmc->enforce_aligned_dimm) { - /* size device region assuming 1G page max alignment per slot */ - size +=3D (1 * GiB) * machine->ram_slots; - } + /* size device region assuming 1G page max alignment per slot */ + size +=3D (1 * GiB) * machine->ram_slots; =20 *base =3D addr; *device_mem_size =3D size; @@ -1285,12 +1282,9 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i825= 9_irqs) static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *d= ev, Error **errp) { - const PCMachineState *pcms =3D PC_MACHINE(hotplug_dev); const X86MachineState *x86ms =3D X86_MACHINE(hotplug_dev); - const PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); const MachineState *ms =3D MACHINE(hotplug_dev); const bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); - const uint64_t legacy_align =3D TARGET_PAGE_SIZE; Error *local_err =3D NULL; =20 /* @@ -1315,8 +1309,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, return; } =20 - pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), - pcmc->enforce_aligned_dimm ? NULL : &legacy_align, er= rp); + pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), NULL, errp); } =20 static void pc_memory_plug(HotplugHandler *hotplug_dev, @@ -1778,7 +1771,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) pcmc->smbios_defaults =3D true; pcmc->gigabyte_align =3D true; pcmc->has_reserved_memory =3D true; - pcmc->enforce_aligned_dimm =3D true; pcmc->enforce_amd_1tb_hole =3D true; /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K rep= orted * to be used at the moment, 32K should be enough for a while. */ diff --git a/tests/avocado/mem-addr-space-check.py b/tests/avocado/mem-addr= -space-check.py index af019969c0..ad75170d52 100644 --- a/tests/avocado/mem-addr-space-check.py +++ b/tests/avocado/mem-addr-space-check.py @@ -31,8 +31,7 @@ def test_phybits_low_pse36(self): at 4 GiB boundary when "above_4g_mem_size" is 0 (this would be tru= e when we have 0.5 GiB of VM memory, see pc_q35_init()). This means total hotpluggable memory size is 60 GiB. Per slot, we reserve 1 GiB of = memory - for dimm alignment for all newer machines (see enforce_aligned_dimm - property for pc machines and pc_get_device_memory_range()). That l= eaves + for dimm alignment for all machines. That leaves total hotpluggable actual memory size of 59 GiB. If the VM is star= ted with 0.5 GiB of memory, maxmem should be set to a maximum value of 59.5 GiB to ensure that the processor can address all memory direc= tly. --=20 2.41.0