From patchwork Tue Apr 16 13:52:44 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: 789217 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp296931wrb; Tue, 16 Apr 2024 06:55:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU55lfa7uSgVXeSkVdALVPFv5ZNIa3yjJWlnJ608lZfktKCFe6AfG4L6nlFijE28UhhoDrdm4MLWZHxtRygmAXk X-Google-Smtp-Source: AGHT+IEXzA098FZySmXltAzEAjdpRanWCm0DAXhea7uYP+WIkOGpS0xdS5YV9HV9Slu0dEKx1Ori X-Received: by 2002:a05:620a:40c9:b0:78e:d698:43a3 with SMTP id g9-20020a05620a40c900b0078ed69843a3mr11938269qko.41.1713275718929; Tue, 16 Apr 2024 06:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713275718; cv=none; d=google.com; s=arc-20160816; b=W9WBVwcLhzWiAOPS7RopPjkxYLLZLEsqvOKrsXJpk6wLpipKXFPFqrIngwDV4CCn6O /mKIS79fnJL9z8W9AnHDRUx/758tRH6NeoevGqiDFz/7SqFmf3p/yOPdoJHLTp+zT6nj 35lraeQF4Jx6wnTcrIMhLu6eYgldzDbknHzzb9IF5fUBHpW4lgR01utsxXy3ZcbjV+pf qUYuvK2sNFVuCeq7CmIY16flMla61PiHAYsGk2jxNlIVMHtxcZCIc1/uHEnUksf3oyNV 1srEzTTVN02V6jYFUW4spqiR1yGlKA4rAXfN/e38E+kh2XeBN8FZ/5NnsbdAsBPoMYA/ qAxQ== 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=zrloeWXgUOLOMISBfKf4pjkEgrJ1tsN5/Rvv0yaa8aA=; fh=MjJjXoKL+44k3EwhasVTCw9xu4GGdb6XUjeode+tQoE=; b=CbZSzFWa4X1s6HTAsS7QhfD1axrK8ZZahcwnKA6PQrEXO4NETcK3LzZ6Ud3c0aLweT qZd3J1FNjQkDiifTEvWo6G/6wdcIMDs+DfqXViFbcN//5bz9oyEI7CWh6RfmwIJEVYNe fyiEh/4E13k6BzOXk8xYCJHqI+kPaIaBpHsgPsXN4EAMnAbnYnKFzuJ2srGrhbqCwBEe T1F0Pec9TQ52Ecgz7+fRSupVZ26qrvsVCy0kBXMJ/P6yVFTPzWMA7vZ9FdsXvyUZTT4g oOq9iFkywxtnbHDW8Tp+lbuiol3Au8G3jlvk4HJTINX78ZG1VHBgumSS5vNeUc9DuQEK 975w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fzafj7hM; 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 br37-20020a05620a462500b0078edc196108si7659572qkb.143.2024.04.16.06.55.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2024 06:55:18 -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=Fzafj7hM; 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 1rwjGz-0005Ru-N1; Tue, 16 Apr 2024 09:54:57 -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 1rwjGf-0004oS-6I for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:54:39 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwjGb-0001wJ-RD for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:54:35 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-516d756eb74so5371732e87.3 for ; Tue, 16 Apr 2024 06:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713275672; x=1713880472; 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=zrloeWXgUOLOMISBfKf4pjkEgrJ1tsN5/Rvv0yaa8aA=; b=Fzafj7hMbLKlpjRfypiJcKv5gPj1AxjV/xBEtxUo/DSOldjWNKzm0DXgU1qPo/qnYW cG7PzFS7HbXWL1Qv1AZd/t1EYliBFJhEQz+rgP6Yo/q9VApondwWqFwmZZl6d2k/3t/T PwHgItfX0plm6Nib4/elGmBtFFI97uEK84/3aK9ge4oZDPQCA9I9jExXMVqkVbxshs5c 07Um0uwG1HIW9LCYChxs4osoB3jl1wEL3OAgtLVWkd3CwWYH8aHGac4/1hFSV2o+zVY+ 3hwQr37tl1dw5r2BPlwUJ4naBWpkjAYT/J/SucLwi2KiKTFL+gcFDQ2Q4ZEoi0x6hS3I RqHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275672; x=1713880472; 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=zrloeWXgUOLOMISBfKf4pjkEgrJ1tsN5/Rvv0yaa8aA=; b=aAYPaG6pJ8Y+bffY2ViDsa7q0W3QEvFoWv2s+Qi2GU1wYOEYFjQPlsGqS9vRSjZuyq JTh9wi8DYev0crFNh0Glh/xnepgri3xWVaabRWlCby3SYOzriyazMW4PAPOX/yBl0YSZ EN328GQVekyq91rr4qYutj9TmPupp5z5t4Fopk4vm5E19G/gB4qtbtCUm7eMLgYTB+Ik 7KbsqYmXArm6k8TUcqOrNY9XJ3c6PD1XGF/tP5MF9cSLVONti6WRvLtxCOYBhLKOdsbH UzAAqOkz25M2l/t7yht0fbCkGhetlaVrcJnMxJSk3kiem81kjriwq9F3gfROMa9loVrY m7qw== X-Gm-Message-State: AOJu0Yz2SfAnwlKISyT/RaCPU3xmMoMAuIOaITOz6s53M817UhgtpNN4 4c9QkM+t7zIA3nEJnhWTPvj+FmhwRG7Z1dgl3+BHbzPielmGwY7oIuzEP/r8Y5Wqg7FcxbRujME p X-Received: by 2002:a05:6512:694:b0:519:3243:3083 with SMTP id t20-20020a056512069400b0051932433083mr816018lfe.14.1713275671881; Tue, 16 Apr 2024 06:54:31 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id w17-20020a1709067c9100b00a4a396ba54asm6866832ejo.93.2024.04.16.06.54.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 06:54:31 -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 , Xiao Guangrong Subject: [PATCH v3 15/22] hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug() Date: Tue, 16 Apr 2024 15:52:44 +0200 Message-ID: <20240416135252.8384-16-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::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.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 '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: David Hildenbrand 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 9ba21b9967..633724f177 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); }