From patchwork Fri Jun 28 07:02:13 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: 808216 Delivered-To: patch@linaro.org Received: by 2002:adf:fe0a:0:b0:362:4979:7f74 with SMTP id n10csp225397wrr; Fri, 28 Jun 2024 00:15:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVHxby5DPa0nq5rhsvizlACQt2SQec34ISLqzntQtsWzf6ZX2zrT9/Min/E2eHF2xNMVgCNmncAuWkPFZu7lju1 X-Google-Smtp-Source: AGHT+IEUg1Q7z6t0acfMASSID30PErOPHKrbisggbcdi+XBMkwD2CERztqhdKYo2ZdG5JcAj2zPR X-Received: by 2002:ac8:7f89:0:b0:441:545c:bdb6 with SMTP id d75a77b69052e-444d92036aemr170548121cf.24.1719558933024; Fri, 28 Jun 2024 00:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719558933; cv=none; d=google.com; s=arc-20160816; b=ITBKvnU5OJi2a1scOUXuaAxcV3qX1N+nbYMrBcHZTjVTU9VDACoMuhBG3buoY1FLtE 4crttV8ExtBIyaqxlbKLx91Zw4iyGQhunZxxStYshNl8C8G8vjota8FMzKrqjoFhRgWM HtLGCfDHws/I3P+Qva+yOZ2WRpN1zVTKlnlrOTz+AnUyTXvvkhFnduiFPhbG5uvrC3gy cf1gihrqMYldb0gVRzxcyO63ossrJsDtM/osrKhpTFLTL2arWoZXGGRaC+Rr3+dLYtJs x2UJZikkgn+7J0gNtthZ5eqdYtVJKtbKauVM49K0/dQHBEcHuetSA5LacN6bmwIKtKaq 40yg== 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:to:from :dkim-signature; bh=avuRrMAF6rH/sTJFTAsB7oMGZ0jZuIMfuK+mEn/O+u4=; fh=Vqz0ILX7NeXJwCG5xiS+Wtk94IhOmAmLtOfN3kRbil4=; b=t2++yf+KJkKKkbudaxOF6QURNsW08Fm/cBlwN1eQizHKop1dY9oL8n5GOrpIwUXn6T UATH4rIM7nB2K96NF+O9KygSuEnRUHwyUVlZ25kt6ZE2Hx8UZqwiw/fba8Ba+ZWk6JHY UrRvUVC2SKFWgmxC9/zlMCGtpC0xYLEGGOYtb7RByts3KxtLrKVgVu9TAsuxOZsT6Gym J2p6eVajz1q1g275vtA5xlIYqVMFTjpBv+PPCK4fcwxjhP6zH3xeJRXYLeUeO1OvLMSi gqw2yMt2eB5HAr9N9uTOhm4+k3MZEqksq0TLOHWeqQ2HP3hVnbHbu7svzjXzG0P07m4R 4yBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AIfHn9jR; 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 d75a77b69052e-446513e01c3si13316311cf.172.2024.06.28.00.15.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Jun 2024 00:15:33 -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=AIfHn9jR; 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 1sN5lo-000497-4N; Fri, 28 Jun 2024 03:11:44 -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 1sN5lm-00043m-FD for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:11:42 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sN5lk-0005G9-Dw for qemu-devel@nongnu.org; Fri, 28 Jun 2024 03:11:42 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5295e488248so365188e87.2 for ; Fri, 28 Jun 2024 00:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719558698; x=1720163498; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=avuRrMAF6rH/sTJFTAsB7oMGZ0jZuIMfuK+mEn/O+u4=; b=AIfHn9jRFNfKwFJ4vlAIjTd7dsJ5WGVk+aiFDw3pILmWHjHF3g0R4+hxL3sQigUldZ cy7DLBTUCeTf6eeMBotvrTGnZWkxNaz/tn5blFn5LVe2Qmrzo7zGPkBB1pPhwUlGWf6L 4mPgAv4TDmYl8Cln3iuGHS/j//XtbM85CIJYuvFMfkJmHaN4GnQ2XVhIObg76nPxNOhM GaOtIKJWRsW67kQt+fsKCCBq+3J6D2uXNOh9N4BwTaFJxruIG5ha/qjfi5UJv+YpSAot OGPiY8BXCl4smZBlrZUFINHUW+BIwKG+Mg5uYbWXrEMBJ9RiahQIHY/xPJe3UkrdmvyM 3Ddg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719558698; x=1720163498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=avuRrMAF6rH/sTJFTAsB7oMGZ0jZuIMfuK+mEn/O+u4=; b=cZ0ggTlBOJuRvts0l7FVY0eVy198KaI4WcRtAgkEjwXZ8TN/uBiOgM90TEDq/uurfG 49qyIFH/WWuWi2HeBAzn2RvdpmSdzfOWCPj+t2CU8sEzCWMI/AIUlAvi2R8UJpZ8JIdg UW06LBfmvQ5R1sgz617MUQr3i1hRMv3ULWDRNIrcMbYlWxYptEWTMMeP3Ls5/9v5HItl My/to06oFtEn/dnW+1G748rq0opYbVp5B+8RZa1DewwpcuXRXcsAHU+Ik4Pubzn5VB2I /l1tqrcjuXmdyBb1DKXvMSlz2B3etBWnablRYSmSSHTRtAshrfqqMKVW1mQDJwNxMXK0 ItXA== X-Gm-Message-State: AOJu0YzhML6v3h6iVfyTtTz0VJANvWzXLLHQmRyAwtzMp4lB1rjaC0OP shZliwYFMw1bJf4Bf8fl7iyRBlSLmbXXtioAgpN+Z2umR3Ya/CV/fmGplwLTXrScHhAiZDa6OZ7 p+g8= X-Received: by 2002:a05:6512:2394:b0:52c:d84c:1182 with SMTP id 2adb3069b0e04-52ce1862c12mr11635231e87.64.1719558697985; Fri, 28 Jun 2024 00:11:37 -0700 (PDT) Received: from m1x-phil.lan (cho94-h02-176-184-4-239.dsl.sta.abo.bbox.fr. [176.184.4.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b0c17e6sm21525025e9.42.2024.06.28.00.11.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 00:11:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [RFC PATCH v42 97/98] hw/sd/sdcard: Subtract bootarea size from blk Date: Fri, 28 Jun 2024 09:02:13 +0200 Message-ID: <20240628070216.92609-98-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240628070216.92609-1-philmd@linaro.org> References: <20240628070216.92609-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.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=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: 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é --- hw/sd/sd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 2d49be61f6..bbf054ea1e 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -804,6 +804,10 @@ static void sd_reset(DeviceState *dev) } size = sect << HWBLOCK_SHIFT; + if (sc->bootpart_offset) { + size -= sd_boot_capacity_bytes(sd) * 2; + } + sect = sd_addr_to_wpnum(size) + 1; sd->state = sd_idle_state;