From patchwork Mon Jun 17 07:11:10 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: 804863 Delivered-To: patch@linaro.org Received: by 2002:adf:fb90:0:b0:360:93e7:1765 with SMTP id a16csp434780wrr; Mon, 17 Jun 2024 00:14:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXgQIHqARGqTFcYqrqx020BUkNzz5BOwMCsZzMtGSaA7aueiQKCwds9Zk1DCbhkwpqzm83BF96XyJA5Xr3u08+ X-Google-Smtp-Source: AGHT+IFvYVd3n3JHxoVy5Lrw6buzpjzsBHJXsXibroN3Y7RKh7TmaLZ1xofuzC24VJmw1PUeeuLg X-Received: by 2002:a05:620a:444c:b0:795:559e:3d00 with SMTP id af79cd13be357-798d23f9ba4mr1214786885a.4.1718608484316; Mon, 17 Jun 2024 00:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718608484; cv=none; d=google.com; s=arc-20160816; b=wBWV0WdmPApZxvz4V3Ydut4p4K7FR9/kC12+yd7USIyx0qr+mYAW5jJh+BS2tLXVS7 QmOVdp0MMv741JqFbuTo6XNwla6qcX2UWs6exDwI8ZVcq3YgJsUbhfnt+HTG4sJ8ZBxM N2rS0PanYs6MHQQQ7DmjX41Kay9uGkuNSzbF3iw+ENdLT3jcLCLOIORgNQ+XjxzxDIAB It0l76BvEqY2y6Ux7DX8ZEPsJnXO0yA8qr6cAOLCZi9gytcGf3tx7L7qwhD+qsdkxyvd ZditVTtvYtjy7M+k+lwf0KtH90CPkjDs01mVsz5nh4R/2u1dBHjl5Y33AdlFBcxp8rNa ANMw== 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=p1PAfSOioCsPYSEzokEcxN3G7yqqrG+D69U3fBdQq5A=; fh=9hRd7LaHH17BLGyK0dL14LbVs/1RFaqe1fMw44lA9A0=; b=DppNqBSDzLSooV+0nMQe2gAdY2NpLk1+dlPECm1wjl51k1qk8D6yAWBtXEmtd/QAaf Wlv1xhvbMRbRRVjxqOmCu+v49iQigBoXgx8Qaror1pRU25cbuROSSA3GXrow1EfpIkhu JdR6p80XrrI3Ey4gIqKuNwiuojJkvpHfwZtKnSVxJqJ5huYdGSyrNSXCklMC7mlLScBX cBKyAqJJL5PvK8tMzK5tkzzFk10igUfjA03BFBA3BRim/9AZAep11+3YQfnk3Ht3hZET Wsj609NksRrEFUWDBGDV6hKMzOPPaQU5U/p/TxqAqi9uktdUQ69/+bDTtlkEsMwijHde Ro4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aqxgnRjV; 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 af79cd13be357-798abf65d1asi891833385a.681.2024.06.17.00.14.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jun 2024 00:14:44 -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=aqxgnRjV; 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 1sJ6Xr-0007NF-D2; Mon, 17 Jun 2024 03:12:51 -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 1sJ6Xp-00079J-6d for qemu-devel@nongnu.org; Mon, 17 Jun 2024 03:12:49 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJ6Xn-0002Ng-80 for qemu-devel@nongnu.org; Mon, 17 Jun 2024 03:12:48 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a63359aaaa6so605265266b.2 for ; Mon, 17 Jun 2024 00:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718608365; x=1719213165; 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=p1PAfSOioCsPYSEzokEcxN3G7yqqrG+D69U3fBdQq5A=; b=aqxgnRjV8cFeeJQh3d1dVkScl2fD6TzqOqJc3AD4IN2gky7Gr6mIz+cICUO2ytqf5U GFFCqBts3XwpqybdDbiPjbeuwukZMUiSMJFPdHnIiBkAxWGgRSuhGeg5PxdmCKV8NgjL S+vjOGKm7xWaPPxn7FU28fSi/TJgo2VmrNbuJKk6KtvbuKd6AtyoeopnkGnGMYzar84+ p1Srn2t9AUpI0P0eG5GGbkFYJOkMgKVIw8ULLOYMIheSHhSuuh9MgJMVbYaOSp6qkDS5 BV28GrmEHWdRCCQZsUJHOWyFSVCiJUc17KfFGBOYzwK38IkXF2YyXyCsaEOhMVeoWg4Y n4nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718608365; x=1719213165; 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=p1PAfSOioCsPYSEzokEcxN3G7yqqrG+D69U3fBdQq5A=; b=LIXT48NdDYvzDIjf3SPo0AjS7X1mrHFICwbOuM6FSMXnVqz2M2Zz2VYnNJOacckzCI jYFiEivpbCsV0B76Z15dejig98DRa9Oi1JFQN6/7fXW8G4TJrjeM2islC52U+xrPELZt YlrNEW6pzupTPeW474Nxv+ag4Hs5m9hv0xsc/cF82Kfm29U+Ff5PAu1eCFpqGoOOPtDL 5bF3aWdJn7uAQcoSHZs2mxrR46pbUt+VsufqOwG1uQE/S+mjuNRL8iYjX0qee3i/E/CU ZVloXaJTNFitcMaOkfPPMf7mF+GYIHkZS2dQzCEI5KauGchSQzdkParvk+4C5iwzTXfo Ojcg== X-Gm-Message-State: AOJu0YwolmK1f+tXDl4HgxLbNgq+AWdFGziiT6dtqvsUoxl/xXDoB+nQ mzz1xeBhfjVdKarEIq5iK8L0uY5o18cZxB23D0rCJxUVML+e+H/DDr+DUfe/5mzxggAWVqkBEI5 RcYU= X-Received: by 2002:a17:906:457:b0:a68:c744:725b with SMTP id a640c23a62f3a-a6f60d2cd0cmr518531566b.32.1718608365496; Mon, 17 Jun 2024 00:12:45 -0700 (PDT) Received: from m1x-phil.lan ([176.176.169.90]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56da3f50sm493279766b.14.2024.06.17.00.12.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 17 Jun 2024 00:12:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Thomas Huth , David Hildenbrand , Zhao Liu Subject: [PATCH v6 15/23] hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug() Date: Mon, 17 Jun 2024 09:11:10 +0200 Message-ID: <20240617071118.60464-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240617071118.60464-1-philmd@linaro.org> References: <20240617071118.60464-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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+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 Reviewed-by: David Hildenbrand Reviewed-by: Zhao Liu Reviewed-by: Igor Mammedov --- 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 2d0a517c4c..8a9c025754 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1395,8 +1395,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); }