From patchwork Fri May 17 15:02:24 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: 797476 Delivered-To: patch@linaro.org Received: by 2002:adf:e68e:0:b0:351:d90a:5487 with SMTP id r14csp815450wrm; Fri, 17 May 2024 08:04:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVwsQfEt4cH+Es0+A/RfjFxlCrOy6tGRZlZVXhw/u5rlDQ7F+VdvBgVu4bgKttYbWGbKQYCAYFoAm0opUYSN7Lr X-Google-Smtp-Source: AGHT+IEYqJ0nLRCQMDmJw79lHmyitJQP0Yo/Fj3412LYlhZs5fIKan67E82br1y/ZeThk6/LhP+y X-Received: by 2002:a05:690c:3387:b0:627:7c28:32f3 with SMTP id 00721157ae682-6277c2836d9mr55474257b3.2.1715958267602; Fri, 17 May 2024 08:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715958267; cv=none; d=google.com; s=arc-20160816; b=FlyTYI1tgKMfhc453SkiV4YgYX/I6htM5wtwHYc8+8Xr2Zpw/xkQf9AN9vvek3jYMi iDGhi0afrsqoss8rsPwvyqa8AFjdvXOapJvF9c/yD2kWyEd/Lx/YP1usvANXDcITEiak gbYNKmpupHREBs8SxeoF79Aj2mLIl7FDYbTyzh1w0gWhnQ0J3Om+AOI6UvDuLP50TalV //kXQamRMJqWTNw6hllzA5HPcZzxl12JPtRztAj959dzsqzM5JJcg8tLWXu6yYhQQVa3 iNdjD3MV6sHXyiuAgPoJb5HPxjSc6PlMjEjnNDO4K8CiCpNM1xdHbnDXDW76wwyPOOsg +kvg== 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=prOBORLrKnIubByGiemAya5YeM7dN+tEWn5fMLTmbm4=; fh=KRI6VCZHMeg0ZgzbPSvWJNPxvSjTRUiYCNLt90+GnHs=; b=LMZe7vHausW9pMZBIrbZ65vKKJDjCXEohcV72BFjeFFQY7R2gRrWsCAZmzZ10nx1St 4zRkX5w+7tItu3MZhgnZYmdYOs7zVfrawqnDihwfHR9ne+qIHCqB0tv7AhzbCNLv7sEB 5BN7yKKeyvXTh4BAqqScxB8A98TU1CiplXXp0ejw01rkbOT94M5Mwg/aKjWislqhUl80 8jdztHEJZJvmWGkdJ+/GXw79xl0lD3sWxaY+ZOhnMd91UI0O/0cVMGBP3Rht2BRMbNDm JlZOB5nlRfEYOu7mu7jjhApu8sjDfU+Z0uZrVu4fwfQ134hSTGGh6sfObGWTV4vAnf4i 1NZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTAOo7MV; 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 00721157ae682-6209e312c58si86617387b3.152.2024.05.17.08.04.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 May 2024 08:04:27 -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=BTAOo7MV; 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 1s7z6q-00051u-E6; Fri, 17 May 2024 11:03:00 -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 1s7z6o-0004zo-H3 for qemu-devel@nongnu.org; Fri, 17 May 2024 11:02:58 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7z6b-0005OP-FC for qemu-devel@nongnu.org; Fri, 17 May 2024 11:02:58 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-56e1f3462caso5177698a12.3 for ; Fri, 17 May 2024 08:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715958160; x=1716562960; 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=prOBORLrKnIubByGiemAya5YeM7dN+tEWn5fMLTmbm4=; b=BTAOo7MVw8FmgeeffQ5hpmckUijnZeFsyXxMTUxz6jIZ8+zys4Su+GL5AfLV7hWKRD MUrmybui38oMHeug1kb5PawjUPoNOghaZuvCxK1zG1wissDNrwydBIONp8VJg/AxElfG 3NWtypXutXR5oFzwGiXfntrBdTE/9pAff6/BhtLNz+zbD/sRRVmXh6UIClCDDFV4rfP8 Diup4kiMbGIw0Gvxv7hUeVWBGOUlOW8psl4JHWLLenB0IjhLzmj+HAVCfcDbNnP8q/aD YhJ2MeGlEY/lCe6jnQiN/auZyOghXEh3WEjo5AHilkT0Zzx1Lea6xH9T87QKVOvcRK/N CPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715958160; x=1716562960; 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=prOBORLrKnIubByGiemAya5YeM7dN+tEWn5fMLTmbm4=; b=n9d0uCzGDqJsvsglGSpWfVa0mVfgkvbhvcQplGyZ/XNCBEqtRezR/1u8LXETyKq1/C ssY+jGxzFYNaR4ABmZGab+6CRln/nt+QkZ2mWtDQxIEinW5sUftOFojwKejMaHw4eKEI TJBsZWEuI2K87HGHZXmcWTRhXxRl4rbuYti2UpXZCVsU02bQ+HPqrIU9vH7k1iZgbUJx bfZgyk7zbHchbUU2A6SJaajsKqXNixM7wkCZzb7h10eYVVRFj7w+1h44zWV2mhkn13n4 TL/n3PfU6VCm37KJetz25/TdvpbRbuQHK4CVY8OTAxrZB9yC45Bb+p6mAlrLcHVygyrF ynqA== X-Gm-Message-State: AOJu0YyZKSOSCH2YMjMcA2Gm3hG4h4voRuuSLJrwjrCxnRjiYas2HDqv lWOCqQi0ULclXjHb62lNcFRbTb1ak1S85fQiTWv1i0CPvBHAmimrJqf0kMzf1qBf7WxMR4e6uLu t X-Received: by 2002:a50:d745:0:b0:572:4702:2227 with SMTP id 4fb4d7f45d1cf-5734d6de22dmr17150495a12.35.1715958160001; Fri, 17 May 2024 08:02:40 -0700 (PDT) Received: from localhost.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733c322c61sm12370190a12.86.2024.05.17.08.02.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 17 May 2024 08:02:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , qemu-stable@nongnu.org, =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Subject: [PULL 2/5] hw/pflash: fix block write start Date: Fri, 17 May 2024 17:02:24 +0200 Message-ID: <20240517150227.32205-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240517150227.32205-1-philmd@linaro.org> References: <20240517150227.32205-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-ed1-x531.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, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=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 From: Gerd Hoffmann Move the pflash_blk_write_start() call. We need the offset of the first data write, not the offset for the setup (number-of-bytes) write. Without this fix u-boot can do block writes to the first flash block only. While being at it drop a leftover FIXME. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2343 Fixes: 284a7ee2e290 ("hw/pflash: implement update buffer for block writes") Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240516121237.534875-1-kraxel@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi01.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 1bda8424b9..c8f1cf5a87 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -518,10 +518,6 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset, break; case 0xe8: /* Write to buffer */ trace_pflash_write(pfl->name, "write to buffer"); - /* FIXME should save @offset, @width for case 1+ */ - qemu_log_mask(LOG_UNIMP, - "%s: Write to buffer emulation is flawed\n", - __func__); pfl->status |= 0x80; /* Ready! */ break; case 0xf0: /* Probe for AMD flash */ @@ -574,7 +570,6 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset, } pfl->counter = value; pfl->wcycle++; - pflash_blk_write_start(pfl, offset); break; case 0x60: if (cmd == 0xd0) { @@ -605,6 +600,9 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset, switch (pfl->cmd) { case 0xe8: /* Block write */ /* FIXME check @offset, @width */ + if (pfl->blk_offset == -1 && pfl->counter) { + pflash_blk_write_start(pfl, offset); + } if (!pfl->ro && (pfl->blk_offset != -1)) { pflash_data_write(pfl, offset, value, width, be); } else {