From patchwork Tue Mar 5 13:42:13 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: 13582455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E315C54E41 for ; Tue, 5 Mar 2024 13:47:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhV5X-0003rf-GC; Tue, 05 Mar 2024 08:44:15 -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 1rhV5A-0003V7-67 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 08:43:48 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhV58-00044z-B0 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 08:43:47 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a4467d570cdso581460166b.3 for ; Tue, 05 Mar 2024 05:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709646223; x=1710251023; 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=x8AzlbW71FoZEbM9SW64EPE4l+5scV2AZFmKYcyJfIM=; b=wHxqtGdcezR18g7FNz8JygeMHBklQ8jR+dtu1BZwM8jpRS4u62gATBbXQstEMIckWm L2H8z8jsIopzK9b9iQ8a4oU9fvvLPbMZ4JSckdGBARGM4E4OJ7N3MI3ibxeLhe3/bTa5 nvGixWdIsbWPM/edb7WItc1/gD4rKnZJAx/QgM49ec23DbOH0CJuBmdbYiuWpVvRqP1E Oz0ZbxlHvDmqlN9iFtRbkfbs6mH1+inqzOtOZamT2QUILHITCea8dPFYZ2PdvVHIKn9b 6PhVpjrpoCu9ObFQkFo3+K+QzpPL7RRzWfBmJfTfoAYHIXoaSIDKxfkTRdOSNAp+RNgO v4cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709646223; x=1710251023; 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=x8AzlbW71FoZEbM9SW64EPE4l+5scV2AZFmKYcyJfIM=; b=Xf7CdHkhlA8Smd53jQVPeTpDEDYvCFPPlc4YNvspCkxWHMlnZ8v+/gn7ea414RVAJ9 Tl1i0487WB/UnH8yxEmsrpgBuEiGFT7aQffrsceSCR5yiVqzgdq1IkNuTgt+hOmnWp3K kEFpX0iC3aCzTcqIRdfHKQhvtexMxy4mgjNgUPRyzGt0KrcRG2JFv+Th6oZQDw9VfgI8 vzPTvd4e/K8DPGIyXM18/iiiIoKRrdqRVefq7knsjfRJzTfyglFiQ8UdZUx07Y5XB70O 7wMO/iXleqavcc2S8mP10B5mAg0s3y4yOtkSbM4/m1tq9fN7M1KdZN30AqoU7FmIvREP o/kw== X-Gm-Message-State: AOJu0Yzc1sHOl/pSKyzndRtfD6Btc39/ZPSOkPDTenzZiBqA4dGuT3Ns wqe6sOHIsZIijF0fvbv7VQG1rf1o5QaA9DRb/e1whLjiZXDKvAQpa6i9p8vrmmBwdOzm1suQmE9 4 X-Google-Smtp-Source: AGHT+IF/fc6fgxSnTTF8ZveiPTSNL1c4g7TqI8j5ZSILt7XGF8o4gWsr5K5gYzg0J7LmS56WjirHBg== X-Received: by 2002:a17:906:4712:b0:a45:84e7:b265 with SMTP id y18-20020a170906471200b00a4584e7b265mr2910138ejq.7.1709646223113; Tue, 05 Mar 2024 05:43:43 -0800 (PST) Received: from m1x-phil.lan ([176.176.177.70]) by smtp.gmail.com with ESMTPSA id f27-20020a170906085b00b00a44ef54b6b6sm3649227ejd.58.2024.03.05.05.43.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Mar 2024 05:43:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Igor Mammedov , Richard Henderson , kvm@vger.kernel.org, Marcelo Tosatti , devel@lists.libvirt.org, David Hildenbrand , Ani Sinha , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Gerd Hoffmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Xiao Guangrong Subject: [PATCH-for-9.1 11/18] hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug() Date: Tue, 5 Mar 2024 14:42:13 +0100 Message-ID: <20240305134221.30924-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240305134221.30924-1-philmd@linaro.org> References: <20240305134221.30924-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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 --- 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 b4736822e4..ea7b05797b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1393,8 +1393,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); }