From patchwork Mon Nov 20 21:32:46 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: 745384 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1533257wrt; Mon, 20 Nov 2023 13:35:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxJyfT3axC9xp60omWdU+wOhA7BUTMu3MsTUNM8PXtTBXkgnsFIacnwND9wEeE0u+ZJrqG X-Received: by 2002:a05:622a:38e:b0:41e:1c0d:35f9 with SMTP id j14-20020a05622a038e00b0041e1c0d35f9mr10814138qtx.30.1700516152394; Mon, 20 Nov 2023 13:35:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516152; cv=none; d=google.com; s=arc-20160816; b=SfevSIh1I0Uy9l5/ABPbYVZLWpfaYiri+ZgVxfIkZtJzBWNftaD87vPaP8ViSy396p GbvHDZIAI4I8/Raw2hGlMwEOaoYE+XNYj2gYROZr4HFWZf734oVUc3W3+CMHWlXpBbP/ I8KAzClQMlXptXxBnHFW4TTWKNu42gzddAdV9El1sBPrE/iQEpQ/pAt5a7oYVXWI0Ppv 0vYHi5Ksto0xN56maXzYeGN2VgtmlneJkxxmQetnm52rnuQWHtIg/x8MGJm4FFPWZcBm zaJwnqH3G7sN7zknN3DnVbobxg9p9KnaX0XuOV/3H3he1eWOuY93ItXiY/T2CCUQFi58 0lZg== 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=fJ1tGChnS+y/+vqRU30qRdlKveuA7pm7ifWNUTeCbQ8=; fh=toXMQ9nuJ3L4CLQ8EKaTQ8L/ltDlD3GauRZSJpgYVzU=; b=SI4iHTKdRE30u5drZ3PGtDVsxe+5c1YEtK6nYAK4jAgEfAS6pMpDPpKDOAHryce3Sn 0gINOjGO4WzTalYzqW9Kdri4LHaLqR5KriJJe3p8jCVqsNdJ6R1VNtDWOtwBIkDv2GaV Cm5d1WHByOos1gBm5uPPSu5hUI350ewI9FKPBFuN+HWSuAsB2xtVs54Ib8ltSQ6/55CC 7IyBt7X1bcNTLNoNq4m9JBpT/XVdL7iuvspV4ATrqN6SJogQKKjnRbtuEj1jWWmFHvpr 8dE8YyI6qxgmMbvxPmK6HNPbTbzDP1/Usk/xSddgRqgEBRW3016rEwzVp9HzjJiSBCgX T2gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LbtoaCYO; 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 e11-20020ac85dcb000000b0041514842260si8045370qtx.256.2023.11.20.13.35.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:35:52 -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=LbtoaCYO; 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 1r5Bvj-0004mJ-Cm; Mon, 20 Nov 2023 16:35:43 -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 1r5BvR-000387-6u for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:35:26 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5BvH-0003rz-T8 for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:35:23 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-409299277bbso17767055e9.2 for ; Mon, 20 Nov 2023 13:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516114; x=1701120914; 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=fJ1tGChnS+y/+vqRU30qRdlKveuA7pm7ifWNUTeCbQ8=; b=LbtoaCYOXYyLmbo/ul88SjSjs3XWMMEu3I2lWuwfdJBQphPhEAAHhlSJgRJKeujnzr 4FXCGNKKmCE90yLmYWun6eOdTLmSG3D75998b1uNou53O14Ywmz1s6rfESHodNcS3lZU 8UEt8+MexczjZfXo8wf16Af4WuaMeQGUVQHwMOntqfNXR8YszlpPsjd7ncslIcpHj10e mjfdlVO76QuVpGAPLy1nIUaS/JXmCRVFofF0h+DQWB94Geu7Z9UrDXjvs8t628FB1vgM mlD9oDTNRkoBXhv/ZuAWXhoDPv9hHkKOF6XM4Rwk77ZRGKKZSBLzAMsUSQHAH3SwKxKL 6J0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516114; x=1701120914; 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=fJ1tGChnS+y/+vqRU30qRdlKveuA7pm7ifWNUTeCbQ8=; b=A3MqigkomR+ae37wxzBGoxJA13sHXInKEY7W7Ym5IgWM42fQjJXYuLcEHiXM2IpjUp kuipOtqX6O71HpMDvWec7oNEN2oIoKd43k5oKCkr3T6XszkCFxhIFVoEMTjl6NrNNGsd +fXu34vmGaROhMfK40yxt9+q5SHUby+M1TNuA8l1lsRdKIEVleiwkmNan1ADWaNRFqf7 NBIAPLvFwYZW1oGLSHqqfYUakk24JBk8+TUUdnprK63MuBfPj0aN+S6rQLoI8ze048ka LE2GQBezJPWk+AE22wnrACEVNlBGoJ0NEV4i+eEGGwZR35oZs3R+bUajJE1kK0FdsBWZ 45eg== X-Gm-Message-State: AOJu0Yy6wRrR7xwghtJRTrrhzKYJ4jGDOUZ87+Zuko5wS14vs6+OBz6U nNeoKq4rlMdUsSQP3SrdRdZhgFH6WQ2+RRotJOc= X-Received: by 2002:a5d:464a:0:b0:32d:9a1b:5d79 with SMTP id j10-20020a5d464a000000b0032d9a1b5d79mr5092751wrs.33.1700516113920; Mon, 20 Nov 2023 13:35:13 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id i11-20020a5d55cb000000b003143867d2ebsm12261018wrw.63.2023.11.20.13.35.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:35:13 -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 12/25] memory: Have memory_region_init_ram_from_file() handler return a boolean Date: Mon, 20 Nov 2023 22:32:46 +0100 Message-ID: <20231120213301.24349-13-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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=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 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 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 218b35a849..2034a48544 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1376,8 +1376,10 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram_from_file(MemoryRegion *mr, +bool memory_region_init_ram_from_file(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index f424282526..4a36779ba1 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1633,7 +1633,7 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr, } #ifdef CONFIG_POSIX -void memory_region_init_ram_from_file(MemoryRegion *mr, +bool memory_region_init_ram_from_file(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -1656,7 +1656,9 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } void memory_region_init_ram_from_fd(MemoryRegion *mr,