From patchwork Mon Apr 8 08:36:04 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: 786897 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp1236866wrw; Mon, 8 Apr 2024 01:37:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVfBmqRrqIxHdY+fYIbB9KjYdu5qhHaMIxZCWseB3GnBDvPNcfwNRiC8LiRdX/H19YyJfFE7cWeHKaJwn22PQPH X-Google-Smtp-Source: AGHT+IEU4HcwOFgQRANZ0AK/CDm6ZcDaY1aN/wjy9eQh4ZAPNzpJaGvjbaBU83vYbjYLKItqzDg5 X-Received: by 2002:a05:6214:18ea:b0:69b:82a:e7fc with SMTP id ep10-20020a05621418ea00b0069b082ae7fcmr4654482qvb.59.1712565465718; Mon, 08 Apr 2024 01:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712565465; cv=none; d=google.com; s=arc-20160816; b=oeErJ6IwMiozCJiGNePbKfk/2vsRwTsk7MN1QyHguQ3gDaZZLLWybt+XXvF2Gd/f1b dz6GpbVv4FfXSlBeOStvVD4Vp1/N6hPQ9oK/gbz1YhwQ2N8f/G06zHi5mQWZYjJ0jhL+ 0cK3BPbFbLp1zfNdUcMhpOTDjAxVlW+Gz5Ckiqji7Ui04vvZi8jMj1+hRaAEqNH+5ALM YuBldcNOIO/jyBSilAMlkL/bgp9f8zYgtfw55n4JSt4kdYWTiXsAoy4T38iDFgyWrtDJ dPFSlhqX8Nfi9/S7lLCNWA0ArHchoqViC0k4V1l8eOCliW0qQpPCVM7KHzVRt3Oa10rr e8RQ== 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=6lxlzp3IlPActhEyj4Nxu8uqxhWQDk/wL/7CgsYIL7w=; fh=n0lTV0dotq1tfPYpBFNqSbS7LCFaWpIW+UGdhuc8B/k=; b=0kDscdtXR5LfsEj66fdIlos0Ie3WxKNBYbjutPYcdvPx2amIgu+9pLE7kQ3DdhyjQj xeOWyhgytstI9blrmCbUlzzt/Te4JiqGVkMkQb+KSsAsVcdcsHv+wv+g6yDCaZqDVi39 I5mNK6OuuwW6Sw4yuz5nENGrh3JJwpTENdof68ahVnSgas0zDMrefdpUFJwEyPJyL8dW PqbUYeM9S3DqYYF6gKzFi5VKXHBAuy5NWb8Tw4P4puBmDQPWwc3NyD+SOoTKARwPIBZH NdTkYbwY+khjw1ph7kzv/Ft6wRZ3j6QnE7mJlUasspFgGiSdlwVboXYUHDTi8qwPjup5 TwZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PiM4tKI7; 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 n11-20020a0cec4b000000b006993002626bsi7549263qvq.173.2024.04.08.01.37.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 01:37:45 -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=PiM4tKI7; 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 1rtkUL-0005m0-CE; Mon, 08 Apr 2024 04:36:25 -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 1rtkUJ-0005lg-UZ for qemu-devel@nongnu.org; Mon, 08 Apr 2024 04:36:23 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtkUH-0002lB-Tb for qemu-devel@nongnu.org; Mon, 08 Apr 2024 04:36:23 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-56e48d0a632so2309919a12.2 for ; Mon, 08 Apr 2024 01:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712565380; x=1713170180; 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=6lxlzp3IlPActhEyj4Nxu8uqxhWQDk/wL/7CgsYIL7w=; b=PiM4tKI7wJalGJ3b6ykWrrhCOyOHGphuvgyDhM9aDitp9eA5WlZgVE2QCfcTXQIGN7 Klc1Zytv9o7LFIpFwgg4tZVbVcfHY4YeJ3dOWGO71t5FAb4yJyc+nDqe0fHdCPU4lUvQ GSlNriDPu3VRveI4+kgjQ9xtg9mBWUj86vxw45ES8lOvNWm/caRi+PpBJuj84vuLKL8o VN/9RPmGGAC7J8IPDnAZfpGmaz/GM3oLdv/rqwprJVLitt8TNlm4AcqPNaXDy+2xA6PG NwyIas0rt9FVaPSTEacXLvUVye0ivQmChDy7kG28dp9LabJ5UDJlSeyRoQcbJQWAmF3C olFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712565380; x=1713170180; 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=6lxlzp3IlPActhEyj4Nxu8uqxhWQDk/wL/7CgsYIL7w=; b=p1WnDbub0sZtXTlyFsydLiupv0Mg0C06nBq5N8HDViTPBqNRxjuANMHf/Gmq6ZzunS SU8Xk1gBefQw3259GxzwGFdFK6+8sZ4gTZ+w3fv6kF1n0OfezQnKXPSiszZTmh8IzZLY NfUsUKuhBMZ6ZyCbZK2+VTml/fKvwBiS0ZZ86tRGedBNG5Q9oxaqqHK+Rt2Ydk8y+zvC nSiDZE4fYjFV+/goUtfStW8mgElXx8FLu4NIooY/y7v2wRqGykHGcgvKEW1Q3S4J3ISz QBvBn1bBOXKBKmFloR3v1Wj8EtO5dyVI+xfNjsd5VwGg/uP9tXi2wY+O/Fl3Gb3d5scY fxkw== X-Gm-Message-State: AOJu0YxYO+hUpdpNf10D6q1GtDsUiDbH/sKFDzJj0eHfKcwRyGSDb/yL L0TFDJacj4MVeXBN2EYN49F6wFjYmjnmY+5WIxns0TajaqaAGzysvAed+g46aAgKC3OEdQ9x4ox 0 X-Received: by 2002:a17:907:94c7:b0:a51:d3da:99a9 with SMTP id dn7-20020a17090794c700b00a51d3da99a9mr2004574ejc.51.1712565380294; Mon, 08 Apr 2024 01:36:20 -0700 (PDT) Received: from m1x-phil.lan ([176.176.144.67]) by smtp.gmail.com with ESMTPSA id js23-20020a170906ca9700b00a51c6d98777sm2125981ejb.58.2024.04.08.01.36.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 08 Apr 2024 01:36:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Qiang Liu , Mauro Matteo Cascella , Kevin Wolf , Alexander Bulekov , Hanna Reitz , qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0? 2/3] hw/block/nand: Have blk_load() return boolean indicating success Date: Mon, 8 Apr 2024 10:36:04 +0200 Message-ID: <20240408083605.55238-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240408083605.55238-1-philmd@linaro.org> References: <20240408083605.55238-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/block/nand.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/block/nand.c b/hw/block/nand.c index 6fa9038bb5..3627c799b5 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -84,7 +84,11 @@ struct NANDFlashState { void (*blk_write)(NANDFlashState *s); void (*blk_erase)(NANDFlashState *s); - void (*blk_load)(NANDFlashState *s, uint64_t addr, int offset); + /* + * Returns %true when block containing (@addr + @offset) is + * successfully loaded, otherwise %false. + */ + bool (*blk_load)(NANDFlashState *s, uint64_t addr, int offset); uint32_t ioaddr_vmstate; }; @@ -769,11 +773,11 @@ static void glue(nand_blk_erase_, NAND_PAGE_SIZE)(NANDFlashState *s) } } -static void glue(nand_blk_load_, NAND_PAGE_SIZE)(NANDFlashState *s, +static bool glue(nand_blk_load_, NAND_PAGE_SIZE)(NANDFlashState *s, uint64_t addr, int offset) { if (PAGE(addr) >= s->pages) { - return; + return false; } if (s->blk) { @@ -801,6 +805,8 @@ static void glue(nand_blk_load_, NAND_PAGE_SIZE)(NANDFlashState *s, offset, NAND_PAGE_SIZE + OOB_SIZE - offset); s->ioaddr = s->io; } + + return true; } static void glue(nand_init_, NAND_PAGE_SIZE)(NANDFlashState *s)