From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) client-ip=209.85.221.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471231; cv=none; d=zohomail.com; s=zohoarc; b=frfZVu5Kqxv9ZfxS0nFT5HBOuDXOLcrgLOvlEyoJ6SD3Y35beM0xb+2wgu1SQATRwAxU5BN7byMJp6UKURGvXZHDCBYcjqSdiZbtAe9/B3dkTF6TXy9gEBWZl3CkZhtE64Ca7IS8k+dpyOrxZNT403fuWa/wM6tjxHyz6IYYNj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471231; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lMmhRwq9QVb+vgT29BBDohmtThFIC9uWaH3/0GE7Ov0=; b=gGUXWcx8pfJB6xjCpjQT4zsDhyElm0vqVsPvCoiqM767Tjup5b8OPPgfkAobfyvuUjU1cmmXWF5CYeGbVxkFfgkWnYV4s9hfRJBMUEObY+tfY1wjnD0nnGSUgqMmEMsExSChEY/IrjZAkWGVYyG4Xc+iMS7kgX+/E6MXU3YLGXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.zohomail.com with SMTPS id 1624471231091737.4043443378995; Wed, 23 Jun 2021 11:00:31 -0700 (PDT) Received: by mail-wr1-f49.google.com with SMTP id j1so3607483wrn.9 for ; Wed, 23 Jun 2021 11:00:30 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id c7sm696213wrs.23.2021.06.23.11.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lMmhRwq9QVb+vgT29BBDohmtThFIC9uWaH3/0GE7Ov0=; b=bh+ClY8VUhaPLuvBFEgVFlRahJrlwaAHhl3CfRlHqsoiLyrEQsEDIbmKYE+HwKDrgt 9zWbeMt1jCOHfPWUUhUmlkE5EnT9E7nrdtFfRJ0453XvwuOuu7VxjQTJDEbQdqAdy/s3 a47Vs17r9ONSjhIVteeQ0FDS3A5rvdjdtO+CfUbOgmfDbqM2xQJmFcgurz5yOEnLkEvp A8UBj2JRy8wavuiQiuVak1ztm5fo7U10VVk43o93yVlRvA+8gVtzx1eGaPIZtru5gQGw Thv6yf5CpJxiBY9i3ic4Q6246UcDaCBwhlnWrFmXifx9RCjHjN7DV42iAkC0ksGMC5Qa eo8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lMmhRwq9QVb+vgT29BBDohmtThFIC9uWaH3/0GE7Ov0=; b=M11CnkgvItj765IxG6xDiX7JhovdCiHCJdCG2kdBAz2TXpM4bUvseRBin2jcpy5IXQ mtqkWDxA9qxy4mZEfoto9rowdhULYrahYnKFD2Tp0oX6M12U/8LrPHmppsezIvWTHu6I GieVK0mUSPb1652XCPKeJAjiIf+65tSSe3bzA2i4oXl3bovv9Oe8btZGwhWXTKdTZCrw 8DpltFFPIuPGo5bCeQ/Egzzru7XrZsPSE2vhA1iHDQpnZAZry3pCPXtn0w6mXYVrse5e vwsNxyneyzckUqBNh3bpQedjd/c1Ho73l6aCtjAmg7eCLXpuZe+4v3lmLI8r/zkTZHDG 4ajw== X-Gm-Message-State: AOAM533/t7ozbDh0gdaRJZYU9NTAcAv5dwtkxRXPkIE/Zz5mY9tX9SnE fHcbMsT8B+wiWio15qAr8tI= X-Google-Smtp-Source: ABdhPJzNzML8bMPJuTWtDxWPdvHYWG3KtTl6zdLsJC0DtYFzgEnMtFSAtlhZ7q71NWw40C0HxC6HXA== X-Received: by 2002:adf:d1c9:: with SMTP id b9mr1526373wrd.101.1624471229358; Wed, 23 Jun 2021 11:00:29 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 1/9] hw/sd: When card is in wrong state, log which state it is Date: Wed, 23 Jun 2021 20:00:13 +0200 Message-Id: <20210623180021.898286-2-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) We report the card is in an inconsistent state, but don't precise in which state it is. Add this information, as it is useful when debugging problems. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake --- hw/sd/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 282d39a7042..d8fdf84f4db 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1504,7 +1504,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) return sd_illegal; } =20 - qemu_log_mask(LOG_GUEST_ERROR, "SD: CMD%i in a wrong state\n", req.cmd= ); + qemu_log_mask(LOG_GUEST_ERROR, "SD: CMD%i in a wrong state: %s\n", + req.cmd, sd_state_name(sd->state)); return sd_illegal; } =20 --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) client-ip=209.85.221.50; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f50.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471236; cv=none; d=zohomail.com; s=zohoarc; b=ga3EulMRbbPsCd1rS/Z0D8JhvXTGYAL0Q7zm1LytxdVTLdAyKyKfyWfGlIOqxo+VO79qLeS+4VwSHDaDE4HhD5/7ULeiB7Yst5pvxYG5JSHWGrzHPNx5SmY+U5hziMFFaPgvkysTqiwpigo4JaqwRHp07qHTxLfEwm4M7D3jqpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471236; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wuPZLEVYUrQdXTkPJv2jf1ea0rvX6sfWext/yABBJds=; b=HBHexfAAgy8mL6cSbxLoYNCgTnWz6Gyal/GJM65vkYogzk5B/ROgB9Ofigubvps+0AFdK3gccKo0MlD0KpDu7c2EGC2W1HZzTUxz2MiNRx10hZeBqchL7AMctValV6SkWlm4kZzjDgk1hJC9IGLbpGwbHTlh0V1py30Q8DXU0+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.zohomail.com with SMTPS id 1624471236709455.2130801844785; Wed, 23 Jun 2021 11:00:36 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id j1so3607780wrn.9 for ; Wed, 23 Jun 2021 11:00:36 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id l16sm6821283wmj.47.2021.06.23.11.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wuPZLEVYUrQdXTkPJv2jf1ea0rvX6sfWext/yABBJds=; b=MPoE+BWr5y2ja5lmBeA3MKMcx0IyHNTPYMcSn9W40i8FP/uND7IAC1pewfMbFtV+Zz nPd3BPCim6q1liFJHmzjDf4gDa5tXqBggj7mvjbds/MAS6SuXh9IeC6FP5dLK00k6R57 zXOZr2xXtT1NzJcZ9CIBSJUggvgteyK5R93djY7ZmR+Z0ESCZfHeCbTkLuW6RZ2sCCt2 467b4ioL75pqniUW/0oqdsQg6vSzERMjgdamXuUwo8EE1KEcAa6W+bDrxWTsuHTI8xsp UXG6qZ70BJVShcAvgC80xaZ153cpQUJERiNF4ejizP1tEPSiGPRFZuKH+rKeynGrgZ2d 8grA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wuPZLEVYUrQdXTkPJv2jf1ea0rvX6sfWext/yABBJds=; b=QhqQjUeqHn1PXOYLkixuZB6iQxjogZHBd9eWy5Di9mCNdV2EFoiXpeUK2dmQuJatk6 Wabl3U/ToQNDR7Q5HZ9dr9xnWx56ohNq1N0VtvwExC1R26tA9QAE0oeStic0xazVAyrz qEJU4/PH1jSz2vAA9waLJaBVr/KqH04ZT/7309u8EffCC/xjvgp7W7y3sc0qnJwTBJJj P3netOJ+na+MNAfzAA6XsXC/l84Hb3Hib7BMZadzyFgWDKQAsH7J5CRCOD1q8UM9EXOL LYkl/keybXA79FKYA5s/ZBDXH8gmVm56HbomEa7JUId3F/EFofAW1VIY2b/875lwSKZA fqGw== X-Gm-Message-State: AOAM530uYu/j5zU5zocgId/sP2/lgllzk7XRQxKctwInm5AwUqMe4XUa Dcnmcadd7258cVOr5DXFtyI= X-Google-Smtp-Source: ABdhPJytKYE/ndk82eb538DHXDtsimtqeVvRgEQWWj62ddHRP9AGU9hZ2tnYI3h0Ub0Zx5vQ+YYdQA== X-Received: by 2002:a05:6000:1281:: with SMTP id f1mr1496755wrx.137.1624471234904; Wed, 23 Jun 2021 11:00:34 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 2/9] hw/sd: Extract address_in_range() helper, log invalid accesses Date: Wed, 23 Jun 2021 20:00:14 +0200 Message-Id: <20210623180021.898286-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Multiple commands have to check the address requested is valid. Extract this code pattern as a new address_in_range() helper, and log invalid accesses as guest errors. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index d8fdf84f4db..9c8dd11bad1 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -937,6 +937,18 @@ static void sd_lock_command(SDState *sd) sd->card_status &=3D ~CARD_IS_LOCKED; } =20 +static bool address_in_range(SDState *sd, const char *desc, + uint64_t addr, uint32_t length) +{ + if (addr + length > sd->size) { + qemu_log_mask(LOG_GUEST_ERROR, "%s offset %lu > card %lu [%%%u]\n", + desc, addr, sd->size, length); + sd->card_status |=3D ADDRESS_ERROR; + return false; + } + return true; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca =3D 0x0000; @@ -1218,8 +1230,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) switch (sd->state) { case sd_transfer_state: =20 - if (addr + sd->blk_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "READ_BLOCK", addr, sd->blk_len)) { return sd_r1; } =20 @@ -1264,8 +1275,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) switch (sd->state) { case sd_transfer_state: =20 - if (addr + sd->blk_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "WRITE_BLOCK", addr, sd->blk_len)) { return sd_r1; } =20 @@ -1325,8 +1335,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) =20 switch (sd->state) { case sd_transfer_state: - if (addr >=3D sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "SET_WRITE_PROT", addr, 1)) { return sd_r1b; } =20 @@ -1348,8 +1357,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, S= DRequest req) =20 switch (sd->state) { case sd_transfer_state: - if (addr >=3D sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "CLR_WRITE_PROT", addr, 1)) { return sd_r1b; } =20 @@ -1826,8 +1834,8 @@ void sd_write_byte(SDState *sd, uint8_t value) case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ if (sd->data_offset =3D=3D 0) { /* Start of the block - let's check the address is valid */ - if (sd->data_start + sd->blk_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "WRITE_MULTIPLE_BLOCK", + sd->data_start, sd->blk_len)) { break; } if (sd->size <=3D SDSC_MAX_CAPACITY) { @@ -1999,8 +2007,8 @@ uint8_t sd_read_byte(SDState *sd) =20 case 18: /* CMD18: READ_MULTIPLE_BLOCK */ if (sd->data_offset =3D=3D 0) { - if (sd->data_start + io_len > sd->size) { - sd->card_status |=3D ADDRESS_ERROR; + if (!address_in_range(sd, "READ_MULTIPLE_BLOCK", + sd->data_start, io_len)) { return 0x00; } BLK_READ_BLOCK(sd->data_start, io_len); --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) client-ip=209.85.128.52; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f52.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471241; cv=none; d=zohomail.com; s=zohoarc; b=ho4Wat3rw9wEuOUkx4mfYeka9Up4R9vqj35p1NVSnxnR2ATzOuuf6qdluUCfl/lRO6IUHqzXdjpiyA+pX6MDdDjYg/c6uX49jngFX/+6o3AJvjQmVa73xYqh1Ol2Trdd84gaavgtq89lByWzx4SeDYsyaOd6+YX5Yk4XNRQUiDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471241; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jpfEeYicWk3WcHYujzH4ZYs5R2DyejTVybejhWkZu7c=; b=UB8eiJ+OOrbkW1URk4a1ALz0MFNbPE9yAsIxODcCp0l78pngDaaVaJ7VqgnSbet9z67JOUTEnBQ9VcxXdYantw8cISXfz6SgzvLV7sFXfJkP4nRF9iN4zp3IYb5LVWqrU7gGZyw0LgDomdN2mAEsC/2fj4JXYa14Wzzz+qOwWHA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.zohomail.com with SMTPS id 1624471241686348.3022962476581; Wed, 23 Jun 2021 11:00:41 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id m3so2213503wms.4 for ; Wed, 23 Jun 2021 11:00:41 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id l23sm7660720wmc.5.2021.06.23.11.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jpfEeYicWk3WcHYujzH4ZYs5R2DyejTVybejhWkZu7c=; b=GDo6Wsq33MoBa8m4nDO0NBM76C8tBygSmbtPDzVbNujY2NIj2/c3QncpLpBNh79F56 gGiafNeovpUy9d8Dwq8BEfRlZTL8zrujhNunXNREfv0KBAPm3qbvnP2ptWCxICdmaZrw RowHo+9WRonRbiBoL+Q+qRrJ8FffkA2zj3q3IdqqVTDEh8KcSihCJRP0sRbdLyvALMja 4zsxk1wSRtoIAg7dLba4e0uCjWXV34TG9Zsl9KmvILpu/OeFmzSvJQUCNHj+0XWgwF5B hRBv1a8bsWpEHAeun9R/N+24nW/SL6JusF0AuTpQ+a/+Kd/pr+XhaSORhd89CCVLGwod 3v6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jpfEeYicWk3WcHYujzH4ZYs5R2DyejTVybejhWkZu7c=; b=b/IVJx+qJ2S34QuErsb1pHiXJwJeKay8CH6YvQQ1jBAnxbx3/OC3SBvETfjGzELe7H YuqqmJJfUGXGDaSJKHuBnQAO7Rjx6X3tNt9vtksm1vzAvVS3F2JwTJuUVaPHM9RukhsO lOndCYVMfj011NpbZm8HDRGrlD+RGZTzbaC/cJj/vuauzxcdwtHWlDR0Qz8ixmmc3GA5 EdAcdYrREPXDAtfcsjF5Ni9tyabYILjxx2jrCOjEYrwDepXwzRIIV8s4HTM9eTutyCnC +rczgN1Y1ImhsS70fBpLHDJVXme/LG6ezVjFqQFK4DLnXg5PRhK4Fj0QN0yNiB3Xkzxp /jYg== X-Gm-Message-State: AOAM533Sj2Q/wwQ0V1AtBzK4d628vVVNU2SzcQq2CDc6vX383/JmLRjC zWnNT9pyVTZcEdnOxoUzKK8= X-Google-Smtp-Source: ABdhPJyM+/mAaoIFo5rA5NFnrUDbvXtKxWajw/+EQxD15G0NR+ILFupNsmxVKadvlvIzY4M+XCq35A== X-Received: by 2002:a05:600c:a4c:: with SMTP id c12mr12236702wmq.38.1624471239854; Wed, 23 Jun 2021 11:00:39 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 3/9] tests/acceptance: Tag NetBSD tests as 'os:netbsd' Date: Wed, 23 Jun 2021 20:00:15 +0200 Message-Id: <20210623180021.898286-4-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Avocado allows us to select set of tests using tags. When wanting to run all tests using a NetBSD guest OS, it is convenient to have them tagged, add the 'os:netbsd' tag. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Cleber Rosa Reviewed-by: Niek Linnenbank Reviewed-by: Willian Rampazzo --- tests/acceptance/boot_linux_console.py | 1 + tests/acceptance/ppc_prep_40p.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index cded547d1d4..20d57c1a8c6 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -862,6 +862,7 @@ def test_arm_orangepi_uboot_netbsd9(self): :avocado: tags=3Darch:arm :avocado: tags=3Dmachine:orangepi-pc :avocado: tags=3Ddevice:sd + :avocado: tags=3Dos:netbsd """ # This test download a 304MB compressed image and expand it to 2GB deb_url =3D ('http://snapshot.debian.org/archive/debian/' diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_4= 0p.py index 96ba13b8943..2993ee3b078 100644 --- a/tests/acceptance/ppc_prep_40p.py +++ b/tests/acceptance/ppc_prep_40p.py @@ -27,6 +27,7 @@ def test_factory_firmware_and_netbsd(self): """ :avocado: tags=3Darch:ppc :avocado: tags=3Dmachine:40p + :avocado: tags=3Dos:netbsd :avocado: tags=3Dslowness:high """ bios_url =3D ('http://ftpmirror.your.org/pub/misc/' @@ -64,6 +65,7 @@ def test_openbios_and_netbsd(self): """ :avocado: tags=3Darch:ppc :avocado: tags=3Dmachine:40p + :avocado: tags=3Dos:netbsd """ drive_url =3D ('https://cdn.netbsd.org/pub/NetBSD/iso/7.1.2/' 'NetBSD-7.1.2-prep.iso') --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) client-ip=209.85.128.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471246; cv=none; d=zohomail.com; s=zohoarc; b=AKlCoB9Rx1UIClrSdRYjaEdIe4YOusXZ/WPaJwVbrEnZP/u1jkcJOxofV1uiDb1C9i3NyqQKFriJjqUZIQeMAr9+hqqRV9cx2UY6c3kXKhsgaLNzBFIf7LoOMRaY5dPDLAllTKzNZqdjZSK+pLz1LCrOs2r8ZUnAk7GEdyNeB0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471246; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2XYaMzq79oJ14Mdhp8DY6/ioX+j6FXQDMcscp3/hpSM=; b=aKeceQKZu/2y9kiGUzwZaWN32IWGEO9pNmvRzkaARRJ4b//r1GoJWBQIrnUoWPay3XyvNeoBc4HaOvH+Cxj0l4csay3kacyKA6ZjvADnhHC+4fuMlabgoC0xayMQcyV9vCuFui0QXGcDBDrezo/FAfU7HFW9i1R/iJS3mXwIknE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.zohomail.com with SMTPS id 162447124655382.74480793426892; Wed, 23 Jun 2021 11:00:46 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id v20-20020a05600c2154b02901dcefb16af0so1921686wml.5 for ; Wed, 23 Jun 2021 11:00:46 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id g83sm662070wma.10.2021.06.23.11.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2XYaMzq79oJ14Mdhp8DY6/ioX+j6FXQDMcscp3/hpSM=; b=pq3bP9YV30SMxXr0g199HWQ2mwWrCaWuXViMQzax80LXWgezYHSfDhWxzg6EM6c7hS EOiNW+ydFQbkVXrLfW5ZpyrC8S84DQS78IUCoMvjs8o/TYFY+L5md+OL4xL2E03Fk7TG X2LgoPt40Tv+ui4U1v+9OJco0sLxBcXDM0EoshfqrdOMBANpaNbZiGsKkjbiO+c9/zWL 4e3i7soZa7Qi41irTD0qGjbLrAJyDhccFRyTLpH9uADiY6qH0q+LnTRgGm9GX8upq+eB PBo8uX2unB9VAnNrFH/iZnbjDxlwyEnL7Klo3tVOrMSA0D3cfRcVdRSnK7XSYzlZCIXH nAcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2XYaMzq79oJ14Mdhp8DY6/ioX+j6FXQDMcscp3/hpSM=; b=IHN3yeP0iGIi62rtJWZfuRk5RtctVYYdCHW6/LPq4pi/CXwEhuYitBDXzodUD8oF1f 2T4TREFedOF3d+FsCNbUituDeZiNsZVjKNMgnhJA0MykEkfYUd/d3heGdWioT17RviI6 H4sLhWVe9M6KaFf7PxbvCMpQk+Qknd/y4QS85y1986+0PXotQGErRbC7Kctd9O0NPwMA KPVIyGfjZFxQOSk3RIKg6J59vdygP+6W9S07F2BZRKzRspsar9CrKx8eR6Co+G5DoZ69 54T8GiJyiiZZ0kWGv7qwGF8JvwFVVX7Yyxjk4mthJeB5S8gZmZgOGTkuj+KKCoU9bCeh qkYw== X-Gm-Message-State: AOAM532B0O6xuY5fMt8DLPDepqaLeBJlgG39lG09NIZh7iXcWrDmuyhY tZVF3E3+NL/k85/k7Wuw2Lo= X-Google-Smtp-Source: ABdhPJwWA6U52E/h61LwJHok19ZJNSQbLwQOZDQGnqdwTlTdKEe3WQWCVBe58eGKN5N1QO3egwcXRg== X-Received: by 2002:a05:600c:3791:: with SMTP id o17mr12503338wmr.187.1624471244908; Wed, 23 Jun 2021 11:00:44 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 4/9] tests/acceptance: Extract image_expand() helper Date: Wed, 23 Jun 2021 20:00:16 +0200 Message-Id: <20210623180021.898286-5-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) To be able to expand an image to a non-power-of-2 value, extract image_expand() from image_pow2ceil_expand(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo --- tests/acceptance/boot_linux_console.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 20d57c1a8c6..61069f0064f 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -35,15 +35,19 @@ def pow2ceil(x): return 1 if x =3D=3D 0 else 2**(x - 1).bit_length() =20 +""" +Expand file size +""" +def image_expand(path, size): + if size !=3D os.path.getsize(path): + with open(path, 'ab+') as fd: + fd.truncate(size) + """ Expand file size to next power of 2 """ def image_pow2ceil_expand(path): - size =3D os.path.getsize(path) - size_aligned =3D pow2ceil(size) - if size !=3D size_aligned: - with open(path, 'ab+') as fd: - fd.truncate(size_aligned) + image_expand(path, pow2ceil(os.path.getsize(path))) =20 class LinuxKernelTest(Test): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) client-ip=209.85.221.50; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f50.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471251; cv=none; d=zohomail.com; s=zohoarc; b=EOsBiIuoXlRoaj1Ln1wxjD3fHuztER+MnyVluWEENtMnLSqSjRZtLDF2JNX5wXGqq4MISWnpkn1cVlVBUW8lQhArdxeNSKBh6FK18K7NGdZBOYdynMSIZEWVL7NtECIIIhhsitI/jngsoZejkqmbNvB1nirr5M/mq9keruMCmc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2T3MRe80pK9VipLCU8CHFoaCxHfrkK4bYUI1dyRLTTU=; b=Vev0YxDMllSEcCN3dA8GomEi87TmSk22qhnJk2P5qhfLhrSzbrSo4XntR4yy4CUBu44ADDulYQ0U0k+rI83qX7/Vy27iXj9HOiDpb7aNnWiRsm8C0I1XVIcdfbsiMDlI0kdNuvcyNG9S2Ahx333tsNgFPMpGD0HMTns7Sa+AAp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.zohomail.com with SMTPS id 1624471251526910.7492609545096; Wed, 23 Jun 2021 11:00:51 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id e22so3641949wrc.1 for ; Wed, 23 Jun 2021 11:00:50 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id s16sm820956wrm.36.2021.06.23.11.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2T3MRe80pK9VipLCU8CHFoaCxHfrkK4bYUI1dyRLTTU=; b=Xck+VA6i84WM+hkfWrM6apyO901HJYkRdZ8CP1BWld1+yNC9/0+oM+5A+/6woI9cv7 vBrPW5/iISrl5k2Is8FJOYkS/Uze6Bpwu2yjrMxf3hsMk7VZsEoM4VZf8aaMYvzvnvZ5 YdbYzx6DySBCX3XfLT/M7VBROn0tPA5unFKgVSoBAd0ed3brfHA6NV08GdgAzDx1PGP/ 0rj5QxtzGuqzgnVnt/m3PxIybd/Eh4Ax/RTo+U1tQgDUw3mHYnVj1CgWb+d02X5xrRbi Efr1RJPeycXsyCwhT8+C633xfBWnGMMT6b6BakK3IyeS0/PR6iEnJxWG2lBihheJSCkh p5Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2T3MRe80pK9VipLCU8CHFoaCxHfrkK4bYUI1dyRLTTU=; b=r/FC49kkqMANddB451FfbGzNXl5sD0D3zcPiDCX2bhU/2neJZasD0PlTDD3W+UYQTG A375T9zXycqLgh7+ciQCNoTUPTyYmkJH2f0mXvZsa43FNFmO6Ec9X/Vk9LyOAytbUZ6G xBt9rdO3ops+LBZpjQVc3xu4a/T4QAqKezzX5z7+Fuczw3j/LAFfr+7euDrXR+TbRUlI 98mxEtidndfTdAEiVAywPyqyVhLrcZwSpmhOYQYwwUh2f7l6PbYtqX5GDnkDaacFYLe7 268YXIvPCoTP5FELnFEyiGU0Vv/q2X2VGzu4CRaRsUWw4I8sh3dxLsEMVz3dGbh6DJeO sydg== X-Gm-Message-State: AOAM533W5FtxHH9ocyrC6lm3dSJf+wYnn5OANVr7LZGMAUUVBlYNvH4O G/kpOegbxb6HUsbrjAnx1Ik= X-Google-Smtp-Source: ABdhPJxAMDjHQVhATCD4g7Se7pvyTq7vaaOZnPwyM/iZVxX/mK2SNKMAy3tVF+kNL+32EScGQus2IA== X-Received: by 2002:adf:c843:: with SMTP id e3mr1522238wrh.25.1624471249830; Wed, 23 Jun 2021 11:00:49 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 5/9] tests/acceptance: Use image_expand() in test_arm_orangepi_uboot_netbsd9 Date: Wed, 23 Jun 2021 20:00:17 +0200 Message-Id: <20210623180021.898286-6-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The NetBSD OrangePi image must be at least 2GiB, not less. Expand the SD card image to this size before using it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Niek Linnenbank Reviewed-by: Willian Rampazzo --- tests/acceptance/boot_linux_console.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 61069f0064f..b10f7257503 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -868,7 +868,12 @@ def test_arm_orangepi_uboot_netbsd9(self): :avocado: tags=3Ddevice:sd :avocado: tags=3Dos:netbsd """ - # This test download a 304MB compressed image and expand it to 2GB + # This test download a 304MB compressed image and expand it to 2GB, + # which is the minimum card size required by the NetBSD installer: + # https://wiki.netbsd.org/ports/evbarm/raspberry_pi/#index7h2 + # "A 2 GB card is the smallest workable size that the installation + # image will fit on." + NETBSD_SDCARD_MINSIZE =3D 2 * 1024 * 1024 * 1024 deb_url =3D ('http://snapshot.debian.org/archive/debian/' '20200108T145233Z/pool/main/u/u-boot/' 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb') @@ -886,7 +891,7 @@ def test_arm_orangepi_uboot_netbsd9(self): image_path_gz =3D self.fetch_asset(image_url, asset_hash=3Dimage_h= ash) image_path =3D os.path.join(self.workdir, 'armv7.img') archive.gzip_uncompress(image_path_gz, image_path) - image_pow2ceil_expand(image_path) + image_expand(image_path, NETBSD_SDCARD_MINSIZE) image_drive_args =3D 'if=3Dsd,format=3Draw,snapshot=3Don,file=3D' = + image_path =20 # dd if=3Du-boot-sunxi-with-spl.bin of=3Darmv7.img bs=3D1K seek=3D= 8 conv=3Dnotrunc --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.41 as permitted sender) client-ip=209.85.128.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471258; cv=none; d=zohomail.com; s=zohoarc; b=TW2vcoppfdau//hBqFVeyLCq23CDQzNZD0dKzb7WOdr/JA4axhLwPcvJ5tTr0FgT+RCfsILES3JW01i3KT6GCrPhuggDWBuAT0U9Kl9Q/pkZlqUl2xhoLq3zC75wl8j4Kl3BKUlbtJ1wCS9AsHKHYIXl8gb/h0mQ7NXOTbYWzqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471258; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N6nQT9ZXaE8QBzwa83S4fSNZTOmVm2N+l1RBokgU5+w=; b=b+rFB5JOzHZuk7sSAjPssF4iX/gu3Mnm8X2QlHyAUNe8Kb+7/KuNI4lNoEhkAwIYvOK+vNnzqI3xsvYltPvaq3wJBd4c3vQuLuDqF12GxEONaDmIM0GBEStcFd2Bmak9q9uGXFwllHKh9SaU5jlacXxaMfP5gHCeyuijSTYSRLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mx.zohomail.com with SMTPS id 1624471258518748.5831002356153; Wed, 23 Jun 2021 11:00:58 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id f16-20020a05600c1550b02901b00c1be4abso4551718wmg.2 for ; Wed, 23 Jun 2021 11:00:55 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id e2sm746113wrt.29.2021.06.23.11.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N6nQT9ZXaE8QBzwa83S4fSNZTOmVm2N+l1RBokgU5+w=; b=URMnbtlPkCXdiTkKMxT9XRK9Z4706ukP/a8SkegekhaOaYuvNiu5atR2tJwqOZpAWm NT6P7dDSBe4T+4WJk3/Gqj8IclTxQhcJkpr55IbxRJc4cEE3hvzm0Q5rUt7FlpiRkeQ4 WPjQDDJfRLx/O2Dv9EToqLBmYsCM9+gV8kA3CKrviazqafelLhSisrbDpo0s6Tf3R7fI +KRBzcjQcarlwcSIqgTVRkgxpGiUuNZX8iPiappWdGFgHhRn9u9ky3lXqLAkpyQ66kXO hI9xU9vDZG3HTOZ0uoUeIp27a0c2anrumda/3c+1B0sJU73C91qYn5PFltJYZL+Jmuts egFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=N6nQT9ZXaE8QBzwa83S4fSNZTOmVm2N+l1RBokgU5+w=; b=myAdVIrGoHLZVy8CSnqoCLQgk3PNyngqb1vpC7uNkXvpD4Ye/gWr4AL6H63Q3Psy4i RwWzxkCkwMqTsNeXV/uupfE3nIzVeHgI97l8UqDJnUiwgY6Tj8V0P5Gizekb5shVnWa1 Kj15XgyIhn6zJemIFQ7P+neaZT9e20pONO4byZr4xpy5Ll8lmqz9nKPZdNVmIEWqh5Ss OMPfKdTqf0jx2r+MLYk1JDBfCW14sLg/Kzhx8vwxv/6eqojWYhKPQp2kRjcZ5sOmCnpO +/VvXGtbllrA5ZGnZygKow19KpD1W+9Spr5Fgs5AMsyWHtjzMAVIlybi3apMvOLZhEMr coeQ== X-Gm-Message-State: AOAM533eqwZslfYYbFclkp6xVjkzIIlQd3xvk6R10XdKrL3CUd8NB2u3 /g/jWp8C+Nxp5U9SiaeW+rU= X-Google-Smtp-Source: ABdhPJyWpQpUQXXUDv9/pxyH2vzJsSz9AFFrJv1SGS2Y0e7EhHNzRyijlwm3uVVvKaXYCAYgLwwtsQ== X-Received: by 2002:a1c:7d8e:: with SMTP id y136mr12390826wmc.23.1624471254789; Wed, 23 Jun 2021 11:00:54 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [RFC PATCH 6/9] tests/acceptance: Use image_expand() in test_arm_orangepi_bionic_20_08 Date: Wed, 23 Jun 2021 20:00:18 +0200 Message-Id: <20210623180021.898286-7-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) U-Boot expects the SD card size to be at least 2GiB, so expand the SD card image to this size before using it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Niek Linnenbank Reviewed-by: Willian Rampazzo --- TODO: U-Boot reference? --- tests/acceptance/boot_linux_console.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index b10f7257503..c4c0f0b393d 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -820,11 +820,13 @@ def test_arm_orangepi_bionic_20_08(self): :avocado: tags=3Darch:arm :avocado: tags=3Dmachine:orangepi-pc :avocado: tags=3Ddevice:sd + :avocado: tags=3Du-boot """ =20 - # This test download a 275 MiB compressed image and expand it - # to 1036 MiB, but the underlying filesystem is 1552 MiB... - # As we expand it to 2 GiB we are safe. + # This test download a 275 MiB compressed image and inflate it + # to 1036 MiB, but 1/ the underlying filesystem is 1552 MiB, + # 2/ U-Boot loads TFTP filenames from the last sector below + # 2 GiB, so we need to expand the image further more to 2 GiB. =20 image_url =3D ('https://archive.armbian.com/orangepipc/archive/' 'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.= xz') @@ -833,7 +835,7 @@ def test_arm_orangepi_bionic_20_08(self): image_path_xz =3D self.fetch_asset(image_url, asset_hash=3Dimage_h= ash, algorithm=3D'sha256') image_path =3D archive.extract(image_path_xz, self.workdir) - image_pow2ceil_expand(image_path) + image_expand(image_path, 2 * 1024 * 1024 * 1024) =20 self.vm.set_console() self.vm.add_args('-drive', 'file=3D' + image_path + ',if=3Dsd,form= at=3Draw', --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) client-ip=209.85.128.52; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f52.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471262; cv=none; d=zohomail.com; s=zohoarc; b=Oxr7NDqndQRvHh26INhjWOB+jQxxzCxROBD9bQM8WaZ1ZPVF0XaLeZYFCCrHpdtjDQowSTdW3/8EE4MBocgdJAlbuJQ9b3ad9LXefLzqc9VNExPWyjxyb4VzKP6GGEHhVQBKnh57YtUrg8bz/v7ANnQC+tIzeZS3/RhwEDZA+A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471262; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=38tjkOtpDj7Jt+1SzgW66IDc7xTuH2HVLPQ4omiT2BM=; b=KXB+zCgxSozHH0d4yC+PtWBggMajJnORKFgL7OPnh1RH8jXWCsFx0yKilnrogCUsUEwB8IBkPTfmzNEilmv48sStcfnKWCWjjEkodY8R80ThX8pMSIEhuG5sX45Pjh+WzDJsYHpSa84y6rISTbYRKkIgXEqdSJN+sf7RcrQonbA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.zohomail.com with SMTPS id 1624471262473403.85376362797433; Wed, 23 Jun 2021 11:01:02 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso4536275wmh.4 for ; Wed, 23 Jun 2021 11:01:00 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id y13sm625799wmj.18.2021.06.23.11.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=38tjkOtpDj7Jt+1SzgW66IDc7xTuH2HVLPQ4omiT2BM=; b=HrsUhm5mySjSRzOLuc5DZV89rEq3nWfDdB8P+wP95W0zOaO1XLojGrtWkIJWyjztOg Jb4I+tCf1ZCMLmkthklTJs18A/lehQUnANStF8b8YJqcSBbY0qetmLvBTJX6xLgewHYx fX1VJ40mZoE01ZxY7dBlyqOl+GjPvMhXtpRKuN5qqH41jOXWzPmF4df0I5miFW3OL6J3 smYkouHkvOHrELpByFkEQOb6NPOhQVcJ7mh+zOG6mwnPQPqh07YIp5eC+sjkq9WNbJs4 Gb2H3B2u7lKvJkHmBytgw143fAlZWexbRQ3lr7E84INUZaXVCcYCFN0BNm8Gc707pi// zaUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=38tjkOtpDj7Jt+1SzgW66IDc7xTuH2HVLPQ4omiT2BM=; b=OmTR4zQJ5hnwp+0cXvLmPht9QnhCc4SV/Z8xmS9V9IRhE+sb9TYXndkZFfB8sMm/Gu 2UbW4z9RpbYKeDh/vDtYEojv5yk0NO06yHzXm5Owa9+2UjF2bjOdnhWx9f2Ti5Fv94Gu HGz8lgk3O9KVSoVHeqepydKQWVxPpp1nP3Rf53D0ahnQtpVv8S1nHASdudJZlQklqnSb eAebF+SRDJz5ejeB/yOJWJJYWioPbkMMotfnWypN+snG13ac/DuQGa9ckbV+ZwXn83bZ rCNQ9EkD62JNDH3SOdzKOsIHJGTRD0hbFxJxY0oIapXbNKWljQYOLhEmNeTtvaP+rAve cB1A== X-Gm-Message-State: AOAM5303yU+YogPG7RFenez3erpxFbw38ITiTwX6icFDsw320ftFXJ8M 2B8nWKz8rNPpkz9JyXZZbtc= X-Google-Smtp-Source: ABdhPJyir63VglhgSkJ/SWM38Soz/fCKo2XbTNHw+888qwTskB3AQeittkwWbB85Vo+H5XTa+GvXRA== X-Received: by 2002:a05:600c:2d45:: with SMTP id a5mr1042451wmg.161.1624471259654; Wed, 23 Jun 2021 11:00:59 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [RFC PATCH 7/9] tests/acceptance: Do not expand SD card image in test_arm_orangepi_sd Date: Wed, 23 Jun 2021 20:00:19 +0200 Message-Id: <20210623180021.898286-8-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) XXX it seems to work... Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/boot_linux_console.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index c4c0f0b393d..48c0ba09117 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -783,7 +783,6 @@ def test_arm_orangepi_sd(self): rootfs_path_xz =3D self.fetch_asset(rootfs_url, asset_hash=3Drootf= s_hash) rootfs_path =3D os.path.join(self.workdir, 'rootfs.cpio') archive.lzma_uncompress(rootfs_path_xz, rootfs_path) - image_pow2ceil_expand(rootfs_path) =20 self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) client-ip=209.85.221.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471267; cv=none; d=zohomail.com; s=zohoarc; b=T6iArOQqWHHR2HzUoNF8f3lMfMY2CroAO1pizq0ZWXDjZZyi+6GBPw0Kom0TWHVqyk/Ylt315YC+RgVpAqDnQje85fjPjDD6lzvVfmNuhWgbxDrAj7rD8WIkyXL2OKfPs1xMul7cbKHkCw1cZPXwr/5vZ4d1ifzlt3vgMDLmRFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471267; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FLbphoqmwiUyiyCMD4ROz97Sbo7JeHpruBGsZnhByOI=; b=g+CTcSMdLvvAJQDRRMHmsBaEOYVSJCuEAggUC9W3tnLJa9hbmpEycjKO1pb2PAmCK+X3NCxJolHgnfBb/AcFiQfmNJ3ldkWSmsBUVJu0npzQ8QNxj1KOCKfImz1cOeOgxOou/rA0dtvQl8W56c25qWiSXmGfqtxR7i//Rr3T7Ng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.zohomail.com with SMTPS id 1624471267670146.92447809751627; Wed, 23 Jun 2021 11:01:07 -0700 (PDT) Received: by mail-wr1-f49.google.com with SMTP id e22so3642822wrc.1 for ; Wed, 23 Jun 2021 11:01:06 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id y189sm6660678wmg.6.2021.06.23.11.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FLbphoqmwiUyiyCMD4ROz97Sbo7JeHpruBGsZnhByOI=; b=fcoQrJ8x8/1mPNpptxbB4XtkjeFOs6vqQ/BNz39Km7riPQ7ylX3nNiLa/lV16JY6YQ jnOGY7uFy/gcHrPAPmJhTYis+k6bQcxBqbRteZUTKP/l4XRg+4hjYnBwLIc6T/JFNkcL rrAcUsT5qYJn4j7ZlOt824VKM5ybFgiafQzD6HtXmDVW8wPua+XXRRnEd1ozgty3yIwB bC5Ql1qLTLsOZd9e/NAsEEyXgkRt4ad41Xp6pYGtx/mxaUGT+6dUFHbiOlUNKHANOUzH nwWlLcsRVozJlD5QRsbcer11UK7cEF1YZ4d0w8/pnG9JptrAKV1WWKoXJ1okQSZGzblE bJjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FLbphoqmwiUyiyCMD4ROz97Sbo7JeHpruBGsZnhByOI=; b=pvESD4FSUp0+zbE23mtTSfXYLUXpfJ0Rzer3bTnZC4YUY9see6gTOjn1caAsMepevw YdcQTl6LMZ+KkJffBiwDENXgE8DigceHTWhY2Q/zhdQO4j3Tt0uoQ/V6QnilRPjN8Wg+ 2y1jK50GUVpa9RelveYG707efu9EYAK71Pg+PwYse1qvfx8S+f177etFA4GLJYAglrlI mlxbfQyW3FyWk76YGcamO5RH9YfX8ikkuLOFAmzPAL4ZizrE83q61lRfIGCy6HvUmHtE viUyusVjTqLXvd1Fxhx2HTIUPzyEyKKtEFxEWVMTRX+lxBZ95QIoJ5vxCBmGUYc22k35 y77A== X-Gm-Message-State: AOAM530w9PYXNCHTzvxF5kbCGPQ3r2FYAYx5GX1SrEGSzAvInEa7fh55 adi2RW0OCztbphUAQJQVAgo= X-Google-Smtp-Source: ABdhPJxzse7zV9GRa66MWQpHURrTNuVK6ZqzcVzzftBOxkO+nUJXY5Yrn8js0mmSM5U1YQbHB04l5g== X-Received: by 2002:a5d:6502:: with SMTP id x2mr1429346wru.327.1624471264954; Wed, 23 Jun 2021 11:01:04 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [PATCH 8/9] tests/acceptance: Remove now unused pow2ceil() Date: Wed, 23 Jun 2021 20:00:20 +0200 Message-Id: <20210623180021.898286-9-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) We don't use pow2ceil() anymore, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo --- tests/acceptance/boot_linux_console.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 48c0ba09117..77bc80c505d 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -29,12 +29,6 @@ except CmdNotFoundError: P7ZIP_AVAILABLE =3D False =20 -""" -Round up to next power of 2 -""" -def pow2ceil(x): - return 1 if x =3D=3D 0 else 2**(x - 1).bit_length() - """ Expand file size """ @@ -43,12 +37,6 @@ def image_expand(path, size): with open(path, 'ab+') as fd: fd.truncate(size) =20 -""" -Expand file size to next power of 2 -""" -def image_pow2ceil_expand(path): - image_expand(path, pow2ceil(os.path.getsize(path))) - class LinuxKernelTest(Test): KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' =20 --=20 2.31.1 From nobody Sun May 19 05:22:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) client-ip=209.85.128.43; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f43.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1624471271; cv=none; d=zohomail.com; s=zohoarc; b=BtptEJIH0DfmgIWDO+vsnMqSBHopZ1RhEdyBi/RR2kZGOcoW2mZcvZB9qNirsWXZGWsDpz16/y9bKKlDVip1oLJMthiXeXC3t5O4LwosipGub0CgpLCIl0jU04LdqVMuk2nB0IcI/WEzah4CYmx16ushM4Qzh4z8sH+vY5afbhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624471271; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bvvltpFHHIakja7A6e7DrMPQs+uPi37tyIhnL/FQ1GQ=; b=NCe3/II4oe1nhDJ0fF8qJuZn67+G6whVq9+7CrrRCPuIQJc3kloK+BmBXY7DVFD+l94KCOumthDBUsvZIWrZA6lX5pyKfUn3db0X0/4yQMhNsmPzDFvlabCpP3cnuqb2LlEXlyVbTJxQY0mUeqkCWWnmNP1UMvXilg/SCxWj+pM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.zohomail.com with SMTPS id 1624471271819680.9422890859869; Wed, 23 Jun 2021 11:01:11 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id w13so2228644wmc.3 for ; Wed, 23 Jun 2021 11:01:11 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id 62sm768793wrm.1.2021.06.23.11.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 11:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bvvltpFHHIakja7A6e7DrMPQs+uPi37tyIhnL/FQ1GQ=; b=OzFhtNg3GoJw2qJF+nyo7M2yJWFxnRGsHxQ8HMxpkuwaCzgr2N7FlbCbqlRp5gr9VG 4r2C6KKa+JQqabCBwQHTRRVFE2gVDtAjAWIcsZHSw3wZtrzBESAToLOA40LbkunA5Z26 5K1HGzQfQa3WBlIo5oFsErcQWTmIRbX1Tj1Frtuh8a/OQC4T+HfDPjI+TtnzWrlug7WM HFRP1+g9dhoJeSfSVueX/sP3rCZnZpCPnCGKrVM2MPvNh1W3mlcMdoTZmpQgU9kkpqwK zWQkzyoSWpdjfxKZRbny8x0KeDWzDe1KS3SXlStPBnlhRy7NZvMF2L62HqWp546yiDBD WPUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=bvvltpFHHIakja7A6e7DrMPQs+uPi37tyIhnL/FQ1GQ=; b=JZ5vF0+I54uv+VziQbVVjUCSUaDapnt0SlWfGzQYYjwWDdS+uKjcNTuV8d4u04mEpW 6XXXPEKhNG+mEK1UYV9zAEh1bky9ybL6O4M71l+xwpKLXXzL/Vl6i6hREdeqTLVqcczp C/3VsyQbaDhMCKShtJLqakMhmSf63pGkZo9s1/BBfFSDmkAdRd5fnURn6ZlT5WpBbA5F Vo1FUVKhmD5T/oO4tyyz9M77uUCTVElhMoit4u01neGYJrjEIw+yd4WyDEqUSYTdL4aH Iid6OGF5VJgYN45tLlh3QYMycR/oE6z4bAUPQp/lnLXCMqy48kU+PVany9tZTev/PusR Qq+w== X-Gm-Message-State: AOAM5336q+WniVLhWgC0vjPcmSslzdyhAnC8tVyV5nfNisBG0YMs2xzE d6DQwCu1dFkKTAwvD7LOEYi/xTQe1CIxdg== X-Google-Smtp-Source: ABdhPJxLy3noP+8UkajLYRmMta6hCURhrdFG+JhgTr/lkX0NrsJLhaeBuOvbBVBDrwCOjZK3RQagjQ== X-Received: by 2002:a1c:98d5:: with SMTP id a204mr1054668wme.43.1624471269873; Wed, 23 Jun 2021 11:01:09 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Tom Yan , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Niek Linnenbank , =?UTF-8?q?Michal=20Such=C3=A1nek?= , Bin Meng Subject: [RFC PATCH 9/9] hw/sd: Allow card size not power of 2 again Date: Wed, 23 Jun 2021 20:00:21 +0200 Message-Id: <20210623180021.898286-10-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623180021.898286-1-f4bug@amsat.org> References: <20210623180021.898286-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) In commit a9bcedd15a5 ("hw/sd/sdcard: Do not allow invalid SD card sizes") we tried to protect us from CVE-2020-13253 by only allowing card with power-of-2 sizes. However doing so we disrupted valid user cases. As a compromise, allow any card size, but warn only power of 2 sizes are supported, still suggesting the user how to increase a card with 'qemu-img resize'. Cc: Tom Yan Cc: Warner Losh Buglink: https://bugs.launchpad.net/qemu/+bug/1910586 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sd.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 9c8dd11bad1..cab4aab1475 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2131,23 +2131,16 @@ static void sd_realize(DeviceState *dev, Error **er= rp) blk_size =3D blk_getlength(sd->blk); if (blk_size > 0 && !is_power_of_2(blk_size)) { int64_t blk_size_aligned =3D pow2ceil(blk_size); - char *blk_size_str; + g_autofree char *blk_size_s =3D size_to_str(blk_size); + g_autofree char *blk_size_aligned_s =3D size_to_str(blk_size_a= ligned); =20 - blk_size_str =3D size_to_str(blk_size); - error_setg(errp, "Invalid SD card size: %s", blk_size_str); - g_free(blk_size_str); - - blk_size_str =3D size_to_str(blk_size_aligned); - error_append_hint(errp, - "SD card size has to be a power of 2, e.g. %= s.\n" - "You can resize disk images with" - " 'qemu-img resize '\n" - "(note that this will lose data if you make = the" - " image smaller than it currently is).\n", - blk_size_str); - g_free(blk_size_str); - - return; + warn_report("SD card size is not a power of 2 (%s). It might w= ork" + " but is not supported by QEMU. If possible, resiz= e" + " your disk image to %s with:", + blk_size_s, blk_size_aligned_s); + warn_report(" 'qemu-img resize '"); + warn_report("(note that this will lose data if you make the" + " image smaller than it currently is)."); } =20 ret =3D blk_set_perm(sd->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_= WRITE, --=20 2.31.1