From patchwork Wed Mar 27 09:51:16 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: 783118 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2108263wrt; Wed, 27 Mar 2024 02:56:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXrkVZfDe5H3YmPhhgNGCzFnErelb+Bj4REM32ESMoqWXOJdd+/8jhbQhVgj3YSHdOHwtsmSeGc+Q2QK2mBrTsF X-Google-Smtp-Source: AGHT+IEmPQ4FYqlg9zZB1sKegae/4w+YPwkSzc+IGF1QjsxsErgZBoPhnMj6Wm2ET0acDdE0N3F1 X-Received: by 2002:a05:620a:4389:b0:789:ea39:51e3 with SMTP id a9-20020a05620a438900b00789ea3951e3mr4440014qkp.18.1711533391812; Wed, 27 Mar 2024 02:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711533391; cv=none; d=google.com; s=arc-20160816; b=QRRP7Ku9xDPUxm23QLiofaF2sKk76Z5oMPo9Ek1oU+iCtPsTOVd9vAoT5zE6dyuoPb 9E8SWcfeNIuHqgXutGo/EZL+lsvBRhp6lE0LKyaoQhN9urHMJzCq2sG8+RZA3vqIglU2 L4Mvn/0OvVXA2/zj1+DGUxKh3i+SjVDcnjLFhe1IWv+TiAvBukhloKHVjdpbdUGWmLg6 rp+P+H4wZamP8V6bOyimETfC8WJlEuE7y4BLQB+JwMXCXwSkarNXIplcBPuyil1ZWLul V0wrBlWbtL64PG3HtnubYY8EOk2t1a/JmUvSEU9S1ZG4IhY8QzVr+pcqY/vvBh9hVW/W 2kTw== 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=gPtQl8VQdcPIthcbUuo8ZeG6r8Vl6GIVI8lnD51wSpI=; fh=AInXy0aQEW+seEi0PXroErHJrc42kY5riVhcr+nhyKM=; b=KnUzaVNqdGPFKxB54FZFLEzF/Tu006bUTrg6tv20KxZaGr5pJs6MT3/iqGFelIkdA6 Ywty830LO2Vd8JdslMmZSMkQY7X7Jp71pdJWu3Hln5jXWjzY708esLKxlLj8ElKK9dYv KCoN5PCGuCTirEJrwE/3XqMSbfzjTjfWXU27F6OsxOvKS0kD5WthRmUzcaFkL1Gpdo3Q wdW7jiRirwfoK0if/MHyjXlSqDGO7QBBsyvcCTq9+l51lMhsNSSQxGGigJtIiLIz67tq hUfwEWzysT3aq+JAkKaPjN9nWu2NnpqhfPeXou/zvTUY7wC3GRjFWrnTmvgKRAskXz4x 8PJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=axfc6iue; 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 az31-20020a05620a171f00b0078a6fac853asi987191qkb.645.2024.03.27.02.56.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2024 02:56:31 -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=axfc6iue; 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 1rpPxr-0005lm-IB; Wed, 27 Mar 2024 05:52:59 -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 1rpPxp-0005hT-Cv for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:52:57 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPxn-0006vo-OD for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:52:57 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-56b8e4f38a2so8325175a12.3 for ; Wed, 27 Mar 2024 02:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711533174; x=1712137974; 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=gPtQl8VQdcPIthcbUuo8ZeG6r8Vl6GIVI8lnD51wSpI=; b=axfc6iuezntewMLBzO6nHlUzvyuMoK/KXDe9ikcqcMhEpaSTBc8Gz2CbFx1jG5cdWU 6z+p96fkHZt+Dv+6k4ytGZeK5vM/ebTjawdV8v9oVyPKEP/fF/piNMfmXzvw6/9TFuUh mfdbEKb8FVvs6S5SWEHsD1/sBF5sgpujAFXJJhoPfeU06+ED5Bk1iKWFPr5YvSHAoHSh S4Aps3b8DkCaIwu9XYkIhf49kNWB6TLYNEB+8H2Iy6RggnQKvHD500V8wL3+OtW7zFMA 6DzLJIsMsuIYQax/K03ekLQkvcHtWVGlesd64zQNDIGttvRdLf7eSyD0peIbCGSH9sRi nWAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711533174; x=1712137974; 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=gPtQl8VQdcPIthcbUuo8ZeG6r8Vl6GIVI8lnD51wSpI=; b=SWLYpBOuExdasTZzyB0Vf7xoY0ScQ2ppdZIZ8N9XtAXpK4KelKW4A6/nAgdh1yGk9Z QdHzPlrGUVEM0C3FjCOT2wJ8HSjh3cAdSjq9yBeFV6QqceRvZKWkodRShdcWGrACTUh0 4EOJulzPePGb6hnKynOVo1IgKKutE4Whb7sVpvxT4UkiE8NQvBP31ALYm1CW/DHSH2Kr 4bZEtRmfNZcB0WKFI5F+XJWbfFQkPhyt934zr+SYBW8cY9misx5CAQlq0ij8oUcoB7XR HFim/Q5YL4GJ7MmGONfnN3WAL4aNuQo3HtLDL/QWoYKbmOapduvblN5Z2ws0J8HEROR7 /n9w== X-Forwarded-Encrypted: i=1; AJvYcCUiCZFV9vfVID3CGDqIUuLuH186p0FG6tS8Ad0RPQgqG7xDeyMo2DGsIixTLeE9dKNjth4U1WQXmCbWv3QTr17GpUwij1k= X-Gm-Message-State: AOJu0Yy/wO8wlcod8kScVzg8vMW+AP3U0oKdy7sPO3K7Yia2DqqSUZXi o2GogUYx/myUJd1DcYiJ9C4LkFwfqR3AeNxT5ZGCnUpoVRcIFPPQCw4ZAU3MYww= X-Received: by 2002:a50:8706:0:b0:56c:19d2:85b2 with SMTP id i6-20020a508706000000b0056c19d285b2mr2852259edb.35.1711533174342; Wed, 27 Mar 2024 02:52:54 -0700 (PDT) Received: from m1x-phil.lan ([176.187.205.175]) by smtp.gmail.com with ESMTPSA id r1-20020aa7cb81000000b0056c052f9fafsm4251852edt.53.2024.03.27.02.52.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 27 Mar 2024 02:52:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , David Hildenbrand , Xiao Guangrong Subject: [PATCH-for-9.1 v2 14/21] hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug() Date: Wed, 27 Mar 2024 10:51:16 +0100 Message-ID: <20240327095124.73639-15-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 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 'legacy_align' is always NULL, remove it, simplifying memory_device_pre_plug(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20240305134221.30924-12-philmd@linaro.org> Reviewed-by: Zhao Liu --- include/hw/mem/memory-device.h | 2 +- hw/i386/pc.c | 3 +-- hw/mem/memory-device.c | 12 ++++-------- hw/mem/pc-dimm.c | 2 +- hw/virtio/virtio-md-pci.c | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h index e0571c8a31..c0a58087cc 100644 --- a/include/hw/mem/memory-device.h +++ b/include/hw/mem/memory-device.h @@ -169,7 +169,7 @@ uint64_t get_plugged_memory_size(void); unsigned int memory_devices_get_reserved_memslots(void); bool memory_devices_memslot_auto_decision_active(void); void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms, - const uint64_t *legacy_align, Error **errp); + Error **errp); void memory_device_plug(MemoryDeviceState *md, MachineState *ms); void memory_device_unplug(MemoryDeviceState *md, MachineState *ms); uint64_t memory_device_get_region_size(const MemoryDeviceState *md, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index baa1b228a9..44283d3165 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1377,8 +1377,7 @@ static void pc_hv_balloon_pre_plug(HotplugHandler *hotplug_dev, { /* The vmbus handler has no hotplug handler; we should never end up here. */ g_assert(!dev->hotplugged); - memory_device_pre_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev), NULL, - errp); + memory_device_pre_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev), errp); } static void pc_hv_balloon_plug(HotplugHandler *hotplug_dev, diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index e098585cda..a5f279adcc 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -345,7 +345,7 @@ uint64_t get_plugged_memory_size(void) } void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms, - const uint64_t *legacy_align, Error **errp) + Error **errp) { const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md); Error *local_err = NULL; @@ -388,14 +388,10 @@ void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms, return; } - if (legacy_align) { - align = *legacy_align; - } else { - if (mdc->get_min_alignment) { - align = mdc->get_min_alignment(md); - } - align = MAX(align, memory_region_get_alignment(mr)); + if (mdc->get_min_alignment) { + align = mdc->get_min_alignment(md); } + align = MAX(align, memory_region_get_alignment(mr)); addr = mdc->get_addr(md); addr = memory_device_get_free_addr(ms, !addr ? NULL : &addr, align, memory_region_size(mr), &local_err); diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 836384a90f..27919ca45d 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -69,7 +69,7 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp) &error_abort); trace_mhp_pc_dimm_assigned_slot(slot); - memory_device_pre_plug(MEMORY_DEVICE(dimm), machine, NULL, errp); + memory_device_pre_plug(MEMORY_DEVICE(dimm), machine, errp); } void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine) diff --git a/hw/virtio/virtio-md-pci.c b/hw/virtio/virtio-md-pci.c index 62bfb7920b..9ec5067662 100644 --- a/hw/virtio/virtio-md-pci.c +++ b/hw/virtio/virtio-md-pci.c @@ -37,7 +37,7 @@ void virtio_md_pci_pre_plug(VirtIOMDPCI *vmd, MachineState *ms, Error **errp) * First, see if we can plug this memory device at all. If that * succeeds, branch of to the actual hotplug handler. */ - memory_device_pre_plug(md, ms, NULL, &local_err); + memory_device_pre_plug(md, ms, &local_err); if (!local_err && bus_handler) { hotplug_handler_pre_plug(bus_handler, dev, &local_err); }