From patchwork Mon Nov 20 21:32:40 2023 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: 745380 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1532745wrt; Mon, 20 Nov 2023 13:34:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmA9LZDQiJffBvjpzS5QS1W5NbOwF0uVlkADxXnRHg5kkBkkbhoXl8S70Z4YcL/QDeD4/h X-Received: by 2002:a05:6214:5809:b0:63d:580:9c68 with SMTP id mk9-20020a056214580900b0063d05809c68mr1022596qvb.32.1700516066699; Mon, 20 Nov 2023 13:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516066; cv=none; d=google.com; s=arc-20160816; b=hkSREIMoB9zVdFROCNY870XW15oGfd4XeXuCeI9olDi02QmQ2zMIgjZLtLX3qbSn91 l9rfRfBAX5ImE30cVOySPapcI5A8HXZThBkLeSYASGVdtESg3s6J/F7RTBBww5jc52HD 1Pp8f0ivyd7lSMd1/h7xFqdoTK82OynplUuv2djDKGyGPCSs8qvAjYvo5wRb9qjVopau 0Y/7vJHJtRmQxKJkMqZUvkL6bfkZ103QZBIOgewZQuYf2qlIRDaWtSX+fIglLmk46HIC CPGPpfD6TNeJGTL69aCFI/BeW+BVWKGql2Yvq6iwMw261NIHvYtjfiHYsz3TRhWZU5VW BMeg== 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=QBwxNmvGLLiXqhul31X+YfHhcCHLwXIU2jAo+ECLv+g=; fh=toXMQ9nuJ3L4CLQ8EKaTQ8L/ltDlD3GauRZSJpgYVzU=; b=HCsWzkmlO4oyXBA1j+myqRRTj/0MywQQe+ccmYVmXG6qSKlSbrC68T/7IiRf8mdxAc jF57MPkYnDWKB4+h6AX+Rf0JfJyuNlSjVEe6kpPPJLhi5bsNL+dhkGJzBuLTXYVLU6QA LYQpGXDHnIT+81GPgs6tB34dM5Jz167P1GgBvPYBjMLDcORhFUx4+tEeKHJsZt73h7r4 PxoyDKnscc8oPm0QtwgnwIASlxxtIhULD4ym6QJm4ApEH4WCYWhaSeHjNaB/RyHRR1sp A0Eplfu9NPKljC8BzXFIe3JiMg0LOW137cxLf2dRu56UzSwQ+k7pHEES+/DAUFPhLxpr UcPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B9ioF4l8; 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 g10-20020a0cfdca000000b0066db3467946si7928859qvs.461.2023.11.20.13.34.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:34:26 -0800 (PST) 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=B9ioF4l8; 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 1r5BuF-0001RG-Ia; Mon, 20 Nov 2023 16:34:11 -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 1r5BuC-0001ON-Gh for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:34:08 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5BuA-0003PH-Ft for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:34:07 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-332cc1f176bso402325f8f.2 for ; Mon, 20 Nov 2023 13:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516044; x=1701120844; 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=QBwxNmvGLLiXqhul31X+YfHhcCHLwXIU2jAo+ECLv+g=; b=B9ioF4l86mJ2HmniwrgFW9kmnsIW/KovEavtrtHrjV5TtcuGMCIhRxnHgJ7eQxP0sC y+7g5oKDwqYoNcQKp5CeygIROOVB/LwCeS9G/awhb2j3wfqS+HcEcJOIU6JYK0L91Iif ybXbRB6efcajU4tCbFgNMGNOP+7F7fB8dEdupbtssNm9vCdH698GAQBRvk9CM2CBYrxx ltJTaTqeGTw7Ie9lLiiwgowK+w1iCzZFPXdkoJaBjfw84GtsQ5ofrq9jV0vrZgG5GwoR ycqKwFoQx9lBTozjxwZxvQM4T28IsapjhhvPqnUbDNujPQK7DFoSjsIMQqkY1iYDVKKM qV0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516044; x=1701120844; 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=QBwxNmvGLLiXqhul31X+YfHhcCHLwXIU2jAo+ECLv+g=; b=HigChOZZBGaWIuZ8oeK97hwNSYenLQ5lo8cF9iyraLMmS9fl4sVknF0EOSR5Wa7/C9 SEAl/cJqMlg1uy3KykUcVNveUSN5sOcbXFl3U9SzIwB7lPWJLYnAgfwC3GuS7h3E2g0Y +kqOS64tsk7ulZ8r7Pwpq8eJRbfdO5TD8Paj2y3noZnE8dSsbSMtlPqJif3cEikUGQmV 8ERuFWY0veh+ehlr9Wiz+jHqR1NfhGcFX4eOFIB+lT1th7mim/qqHKefOh+0Gge4GO2K TnyPcCc/11AeRvP7AbAX6HW5GXXkPTcTqFWDsci4+HdLrjlGhBzzBB2GgDV+ycdu6MGK nD7Q== X-Gm-Message-State: AOJu0YyV34DxlVFZKHlAN5wGxGtw7nUwZ3buYTzKsoRk61JEtto9TbiF 0koZiMECw84WVrXaiLijZySPoycLzTWuLtwpxKk= X-Received: by 2002:adf:a3c3:0:b0:332:c284:c3c7 with SMTP id m3-20020adfa3c3000000b00332c284c3c7mr3558809wrb.37.1700516044460; Mon, 20 Nov 2023 13:34:04 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id p9-20020a5d6389000000b00332cc3e0817sm1072899wru.39.2023.11.20.13.34.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:34:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Peter Maydell , "Michael S. Tsirkin" , qemu-arm@nongnu.org, Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , Igor Mammedov , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9?= =?utf-8?q?dric_Le_Goater?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Xu Subject: [PATCH-for-9.0 06/25] memory: Have memory_region_init_ram() handler return a boolean Date: Mon, 20 Nov 2023 22:32:40 +0100 Message-ID: <20231120213301.24349-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231120213301.24349-1-philmd@linaro.org> References: <20231120213301.24349-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have cpu_exec_realizefn() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan --- include/exec/memory.h | 4 +++- system/memory.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 8e6fb55f59..788872e4a4 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1582,8 +1582,10 @@ void memory_region_init_iommu(void *_iommu_mr, * give the RAM block a unique name for migration purposes. * We should lift this restriction and allow arbitrary Objects. * If you pass a non-NULL non-device @owner then we will assert. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram(MemoryRegion *mr, +bool memory_region_init_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index ca05c4defa..4142eac498 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3597,7 +3597,7 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) } } -void memory_region_init_ram(MemoryRegion *mr, +bool memory_region_init_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -3606,7 +3606,7 @@ void memory_region_init_ram(MemoryRegion *mr, DeviceState *owner_dev; if (!memory_region_init_ram_nomigrate(mr, owner, name, size, errp)) { - return; + return false; } /* This will assert if owner is neither NULL nor a DeviceState. * We only want the owner here for the purposes of defining a @@ -3616,6 +3616,8 @@ void memory_region_init_ram(MemoryRegion *mr, */ owner_dev = DEVICE(owner); vmstate_register_ram(mr, owner_dev); + + return true; } void memory_region_init_rom(MemoryRegion *mr,