From patchwork Tue Apr 16 13:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 789213 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp296609wrb; Tue, 16 Apr 2024 06:54:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCapb5i833jczuddYMlN6NGap7g9iaV3Ir380SCKIxep4FjlbDLdnqd/dCq/iaoIqDabC/r7CyfdCWE0ByIssh X-Google-Smtp-Source: AGHT+IEn0F0pTKBQW3P3muD2idOFCkWksZvNP8ZrpWN2H4xDZFdZcQT8P48FcFrYb7tr8PMtZiNe X-Received: by 2002:a05:620a:12f6:b0:78e:db54:e5fe with SMTP id f22-20020a05620a12f600b0078edb54e5femr8786401qkl.11.1713275674599; Tue, 16 Apr 2024 06:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713275674; cv=none; d=google.com; s=arc-20160816; b=GeNnDR10uiV5MXGLtVPkI2KAGoWfFBrA9DM2zoimjMRwkweF10iQoCLcGGDBQ6I26w J1E+/v+aX+zDOKhMCcjvp3jQ7GJOEFvk9AgKLwJe16L/Vs9+GdRlTd+MgHwj1IuePWXk 7xhkOw1kjl/M44bwRlvrUaYAakg0a9l+9pFzGD/Pz/ymDVXgpgZiNgPKGduMCsc/xg1z pdtHsBibiuzvGl1mdDP3TcV3n2EDfHanA7tuGrB16O4zpkFfo2wWMXX3gmQvdBzZHxvu t6LBHvRzr3ycevwf3IZXQYPMA8GOZK5HxYasLpH6sqa26fhyoUXvpQHva5DGFjxorQ65 Ythg== 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=oke/YPM4C6ufallz55sQ7YyPAmP6LUvQ2Lhm6MsGGjM=; fh=i/qt2IY8D6rlbppcT4ZgEovixdm23W0hw3Pg4MhQHns=; b=uW46NqR8Wkmh6j4GZ/ngnXWu1gXv9LrnlleFgQFhW6BexbAqvV/PH7OWcj/L2XqG+2 fn2oFRIBSbw5w+9e9YNmMIwvhZdhlv2v9n9qf+KwfJEDKNiPpUD1TSN2H78rNqG/zS3B TWDKJalIxoEkFNlED+sHuFqKP6NUY2d9xcgLmZSuJKUpYmWZ3uPx7sOI0viJPV3wgXOA NXKsQA7HR9gZaHOEoAroWk46jbOSwRXN+YCgPUWUKbM12TTu0Ym/c5jA8Kjz6yrpPqej BunNkgutO4iI3hlLDs9bDB0AnoEV43hMej9U0bzAC1AAVup22BrYHsNQvxSH8sU+RXnG COkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SZ+OYxK/"; 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 a26-20020a05620a16da00b0078eba18c1e5si12500642qkn.705.2024.04.16.06.54.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2024 06:54:34 -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="SZ+OYxK/"; 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 1rwjGU-0003qf-43; Tue, 16 Apr 2024 09:54:26 -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 1rwjGS-0003XC-00 for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:54:24 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwjGO-0001uU-Vr for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:54:23 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-56c5d05128dso4790629a12.0 for ; Tue, 16 Apr 2024 06:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713275659; x=1713880459; 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=oke/YPM4C6ufallz55sQ7YyPAmP6LUvQ2Lhm6MsGGjM=; b=SZ+OYxK/vkDRQuDA3dPwPK0lyX9ODIo9jwYJuPFtQwoFsui376b7V9ARlz0dQ1IclO FNz5rqDpLUgJJs16KAtwvksbEevRSm/5wHDyVmiZ/Cmcm+Sqz6bEcbyEts+IbOddfNnF xggipkPAH5QkhKP7IxewtKrIwRheBq9cKvKvOlX/nwPxK1wyA9MT7RFWe4J0v3XS2eL4 Sg0moTCT8dkmskCThBqSH8+Z7zVCalPKg2wRKDH+RJAu34N3u73taT9tFc7U66NJ9+oP HWHxZnRbGJy8DJMkzP18pobyIpOCVlu9PgrLw9OJqTFRS/lx+qYb9apqeMeI2gPVHkEJ vIbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275659; x=1713880459; 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=oke/YPM4C6ufallz55sQ7YyPAmP6LUvQ2Lhm6MsGGjM=; b=l2WBdozj6Vbm3acEkPf5rxSCAyiElcchs/KOiJLfSUH+nx26O7vovY2iilM31omzkE E0KqBC2lmpLRw6eCAnHSPpYr9/MWPWE/yyHehzib9qdDpGqkozzdeZZgrmgv5hG9t6Bg Drg2zuyht6pxE+gYSQ9ERJxDvnlS0rr2KTBIu6BdFDkSvCIkHS8tn5mRyfWSwVIgzCIE A1ExbxlN8mA3H+akSi+Mxjh4Gl8aLlxmaQfYybruSpk26D4zFpewIeIgPH8654t74dkP EsT9fn+NkZ8ObJpzqXZEsCTWfhD04AHG5aqCiqSzDOR9PBinuIX3Je5mMeqxQMW/VgqP GoDg== X-Gm-Message-State: AOJu0Yxwx7bUhy5BMcrsuQI6KI09m8ryxDvUoNwqLK2reMBmUG3ODI42 NzIZ0ITlFU6LNQK01Yxf1rKF4ngh4gwy12Wipv0O9SyeN5yt93SP+fKIJIlIFpNbd7FjCybq+c+ R X-Received: by 2002:a17:906:46c8:b0:a52:42ce:7da6 with SMTP id k8-20020a17090646c800b00a5242ce7da6mr5855717ejs.10.1713275658677; Tue, 16 Apr 2024 06:54:18 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id rh4-20020a17090720e400b00a5255afc856sm4100307ejb.84.2024.04.16.06.54.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 06:54:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Ani Sinha , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Zhao Liu , David Hildenbrand , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Richard Henderson , Eduardo Habkost , Cleber Rosa , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PATCH v3 13/22] hw/i386/pc: Remove PCMachineClass::enforce_aligned_dimm Date: Tue, 16 Apr 2024 15:52:42 +0200 Message-ID: <20240416135252.8384-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416135252.8384-1-philmd@linaro.org> References: <20240416135252.8384-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.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=unavailable 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 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(). Reviewed-by: Zhao Liu Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 3 --- hw/i386/pc.c | 14 +++----------- tests/avocado/mem-addr-space-check.py | 9 ++++----- 3 files changed, 7 insertions(+), 19 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; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2bf1bfd5b2..c7bfdfc1e1 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 = PC_MACHINE_GET_CLASS(pcms); MachineState *machine = MACHINE(pcms); ram_addr_t size; hwaddr addr; @@ -724,10 +723,8 @@ static void pc_get_device_memory_range(PCMachineState *pcms, size = machine->maxram_size - machine->ram_size; addr = ROUND_UP(pc_above_4g_end(pcms), 1 * GiB); - if (pcmc->enforce_aligned_dimm) { - /* size device region assuming 1G page max alignment per slot */ - size += (1 * GiB) * machine->ram_slots; - } + /* size device region assuming 1G page max alignment per slot */ + size += (1 * GiB) * machine->ram_slots; *base = addr; *device_mem_size = size; @@ -1285,12 +1282,9 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs) static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { - const PCMachineState *pcms = PC_MACHINE(hotplug_dev); const X86MachineState *x86ms = X86_MACHINE(hotplug_dev); - const PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); const MachineState *ms = MACHINE(hotplug_dev); const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); - const uint64_t legacy_align = TARGET_PAGE_SIZE; Error *local_err = NULL; /* @@ -1315,8 +1309,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, return; } - pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), - pcmc->enforce_aligned_dimm ? NULL : &legacy_align, errp); + pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), NULL, errp); } static void pc_memory_plug(HotplugHandler *hotplug_dev, @@ -1780,7 +1773,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->smbios_defaults = true; pcmc->gigabyte_align = true; pcmc->has_reserved_memory = true; - pcmc->enforce_aligned_dimm = true; pcmc->enforce_amd_1tb_hole = true; /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K reported * 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..85541ea051 100644 --- a/tests/avocado/mem-addr-space-check.py +++ b/tests/avocado/mem-addr-space-check.py @@ -31,11 +31,10 @@ def test_phybits_low_pse36(self): at 4 GiB boundary when "above_4g_mem_size" is 0 (this would be true 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 leaves - total hotpluggable actual memory size of 59 GiB. If the VM is started - 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 directly. + for dimm alignment for all machines. That leaves total hotpluggable + actual memory size of 59 GiB. If the VM is started 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 directly. Note that 64-bit pci hole size is 0 in this case. If maxmem is set to 59.6G, QEMU should fail to start with a message "phy-bits are too low". If maxmem is set to 59.5G with all other QEMU parameters identical, QEMU