From patchwork Tue Jul 9 15:25:54 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: 811457 Delivered-To: patch@linaro.org Received: by 2002:adf:ee12:0:b0:367:895a:4699 with SMTP id y18csp346899wrn; Tue, 9 Jul 2024 08:30:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGb8eJ/t/IL9TrInhs35Q6C3Rc5QXM6/KmQ6U370A4sQUIQ4oY5jAxXAg+gxXoK6ynTmEvd1T8UbFp0aB6aW63 X-Google-Smtp-Source: AGHT+IH/VxlQ3nwxabyg8guo/LnVFWXJKGed5mv2kOq5sZEIGwloHJnbC8i2iHxnm/T6K0SBwWZi X-Received: by 2002:a05:620a:4723:b0:79f:e7b:dcaa with SMTP id af79cd13be357-79f19bf15camr375636585a.56.1720539027930; Tue, 09 Jul 2024 08:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720539027; cv=none; d=google.com; s=arc-20160816; b=SZaC+QnLS+mRpiUddV1ESQHpnEU4wR7jqOm8aKPRbm+xuzkLErAvrxzZpJxZFsyjJg dq+/6P8NsCKhJqoF1AvzRUecPygBDrQwutm8sKpQ+lqhoP1SUC9UcIrMOgZ9iPQFbk9n P+vkFIpssErlUAmFGJE4vC3lGSzs3GR1IOsE2Hq6+tIt11hrs3ywPlEuVUfEqadcs4m9 rfTcPpwE4EfjCZTVdXB5SfgvV7S5zxf7spBkf+fY4BDLTGlkfkxR2dMR5HuodxfCspWv Vmn886iO325ox3MyYY+JMa44HLh9h7J6YFQGAUqsWRFE9G8YE9yyd18qGsBokoF7qtVO s9VQ== 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=egTnAJY4Ail08o7ydS3nshQ0gmoljQp4B2SNOCZM4Nk=; fh=Txzf7K5YV+qryaChbcvqA4D4sw+KVK3yVi4ERabJCxo=; b=wejPHAuBZAiBfDUUgeNFtt3cf8LzzFvr7ulxMIz8GDae02CVMXtjZF1FK4m/BNh62l m1FjZP+Iaiby8m8NJDR3Jid09ZPsmj3U6jH95bUfTexuf3mVs7OlGXOCnEHGQ7jmmsla 7j9BZEF79sNT8q2T9X92XNBFTJqE/260qTsE6AWyswLbBoYUWl8aYSz2EYaDjL+UF/9a 8nDqcLiPjdJ8m902FVIYeLalNvMX0VbAXErdm0BZGqkcjU+HZenidRDM/ZzDiMQjo5Us PJHFbTzqSZ9eMtDptV5ERVKvOzcnmql5y28t633Aq9XW3Wkdccx3u6zyh/H5vHyQhb6Q 1wnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OCW5Xo4U; 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 6a1803df08f44-6b61baae92esi24082526d6.392.2024.07.09.08.30.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jul 2024 08:30: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=OCW5Xo4U; 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 1sRClG-00046S-HQ; Tue, 09 Jul 2024 11:28:10 -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 1sRCkw-0002WF-S3 for qemu-devel@nongnu.org; Tue, 09 Jul 2024 11:27:52 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRCkt-0006Wd-Kg for qemu-devel@nongnu.org; Tue, 09 Jul 2024 11:27:50 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52eafa1717bso2595699e87.2 for ; Tue, 09 Jul 2024 08:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720538864; x=1721143664; 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=egTnAJY4Ail08o7ydS3nshQ0gmoljQp4B2SNOCZM4Nk=; b=OCW5Xo4UcQ5u/BJ4MZXAT1fDkefnYsAR0UV53gtFdVQOc9bbFskBaqgRBcHaOv/TEz ImwmvYdnLBDs8Yno1SkzmQhetSDiu7uVw8KLBhvXr/XVPKrYKbqY1lSXNoiNe4JnnxWX NNXttNrlVfOlV3yuBdyleXnOzcn9ZzNiy2bECUyFOdMxIZ0O80FzJAOsGh2tubfC6Lcm c7IDGtACVso5Ae2nPDC0zwm1eFzhGzOQtTlAKoyLGEevfsKmwXBwQMKrGykOGFSVrwd9 h8o82ToB3+Wpy4D1oqCcJC6xduNLJQFCY5TgAZwXMQp/Eed8qsnbXD1AIRNG4BEtbsZb 8xcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720538864; x=1721143664; 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=egTnAJY4Ail08o7ydS3nshQ0gmoljQp4B2SNOCZM4Nk=; b=nRVy3cy519DBgvT4rkO4dIRyuHcCLW4DIH+/OvU20lVFcxykmHuWgsQvwAbOLcZyJ0 cu+Rz+a4s7azdtb/ZKPkG/KL0JiUVzl2vA2CoZ1q62PIzK9BrjVSIMYU81wGmjpaM8MB POMR+HnDDAR2zSWn5nBNKV38/hxRzbReAhr35+QOKTRn82RHHvIkIGEfLRMaWaQQzcOt pAtrZp33u7y/qen1IYWjJKbjrgjQ2KbWfbLokpoM5bkwt/hum5M8JJS91hV+In2KrWN8 u6SWvew/yUKHqiHcj0vXkRAYKT7O4VdCZqliYyR7yazxOknKxHS0UIjb7iYU7fwNI7xy CE1A== X-Gm-Message-State: AOJu0Yy8wCbNKxIxZLmYC8h5BHbfihpWo0LNaiRKZEalN/BEy0/JJL/M u0vSxtXmcI3OAkiprlZW+t8+MkvVSNqbCUq+UB7d0TA2/P7+8v8tLElPXkg/AaFSnCssM3J2Eas l X-Received: by 2002:a05:6512:2309:b0:52c:8024:1db with SMTP id 2adb3069b0e04-52eb99d4ebamr1935061e87.63.1720538863738; Tue, 09 Jul 2024 08:27:43 -0700 (PDT) Received: from m1x-phil.lan (vau06-h02-176-184-43-20.dsl.sta.abo.bbox.fr. [176.184.43.20]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367cdfab80asm2863625f8f.109.2024.07.09.08.27.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 09 Jul 2024 08:27:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , Andrew Jeffery , qemu-block@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Bin Meng , Joel Stanley , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Jamin Lin , Steven Lee , Troy Lee Subject: [Aspeed PATCH v47 17/19] hw/sd/sdcard: Subtract bootarea size from blk Date: Tue, 9 Jul 2024 17:25:54 +0200 Message-ID: <20240709152556.52896-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240709152556.52896-1-philmd@linaro.org> References: <20240709152556.52896-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.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 From: Joel Stanley The userdata size is derived from the file the user passes on the command line, but we must take into account the boot areas. Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé --- Squash in previous? --- hw/sd/sd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 5830725629..291497468f 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -814,6 +814,10 @@ static void sd_reset(DeviceState *dev) } size = sect << HWBLOCK_SHIFT; + if (sc->bootpart_offset) { + size -= sd_bootpart_offset(sd); + } + sect = sd_addr_to_wpnum(size) + 1; sd->reset_time_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);