From patchwork Wed Jun 23 18:00:13 2021 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: 12340281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6048C4743C for ; Wed, 23 Jun 2021 18:02:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 683E061026 for ; Wed, 23 Jun 2021 18:02:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 683E061026 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7DD-0008SS-Fb for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:02:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7Ay-0005U7-V2; Wed, 23 Jun 2021 14:00:36 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:43955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7At-0002vl-AI; Wed, 23 Jun 2021 14:00:32 -0400 Received: by mail-wr1-x42c.google.com with SMTP id a13so3602579wrf.10; Wed, 23 Jun 2021 11:00:30 -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=dwBdN23h5E67Mf3xxAHPrnVweTTEcG+pX04kVg1eFVbIH7ttvDcBsZP8b4k9gqSCcy BDi8MiI6oUU4ze9H58gkecSToh6ZaN5f7YYRRt+oYCGXIHhLQE98vN+LKwpNr55pI+RD //ngQjpnUy+fwlT3WRiuVmrbu4KHQPU//XO6DZWc2J4sm33ctdAlVwXCbPfKl+tUN0GX JJE47sFVmZKK3K0K3sc16Ds9Iw5RRlYjRqMRdC+Z8H3zy1qzcwSs3FZbCGjW7Go/hMo5 Ty2bSFK30feh3iALbCaWDxxNUVm/zwN/K/QEMtTZkH4+Ee4CfJYooS1jkUGwXS3EZCWx nyBw== X-Gm-Message-State: AOAM532+gTCt+eG/SnZJ6EC+nYsgdcwSKGkPtu0eWXkRQdgC5yLdt1Si l69C7mIaKmU9jACfC9YsxlrVcBzKW7ImDw== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é 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, SDRequest req) return sd_illegal; } - 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; } From patchwork Wed Jun 23 18:00:14 2021 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: 12340287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF45AC4743C for ; Wed, 23 Jun 2021 18:05:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55B16610C7 for ; Wed, 23 Jun 2021 18:05:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55B16610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7Fw-0005De-3H for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:05:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7B0-0005Y3-QR; Wed, 23 Jun 2021 14:00:38 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:33677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7Az-0002xs-32; Wed, 23 Jun 2021 14:00:38 -0400 Received: by mail-wr1-x434.google.com with SMTP id d11so3675054wrm.0; Wed, 23 Jun 2021 11:00:36 -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=HwLWWXq8RH/g4RHd+vqhWIP5B2g9j67tyXlLC1D7mju5DKuv/bGZXuO0eCu9ZSnfFn 5nov0+qBTbXstWSJ6errX8j4dB+RF4YDToaryq6M7p9Ei0+fMSYEeV+tMRfrbohFMxm4 OIX60xfRCgdpAqpirBTr2RZSRP2pB+87qXNojpRyR+KvNyNxTZrcWNy2ZZ4JgrwqV5lu en2nQfS4veAY775ahNilNYc0YX5jDMMGyeVc0Vv8ob2cz1V3W8ZI3JKTG8GJNA1MuZ6+ 6koC98S2oVoHR0/na6nz/RQjY+OyeNH1YTd15+XqzvAFwPK5yRzEG5sz5ZX1axMQu4Em /Mbg== X-Gm-Message-State: AOAM531tagNCDjIPeavAdI/OJoJWZQqlGwiuIvd0gLjUy9PH9AhnaYSp TCksB78gICa5IXM+Ca/+ACKRjea3u3LxXw== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 &= ~CARD_IS_LOCKED; } +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 |= ADDRESS_ERROR; + return false; + } + return true; +} + static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; @@ -1218,8 +1230,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (sd->state) { case sd_transfer_state: - if (addr + sd->blk_len > sd->size) { - sd->card_status |= ADDRESS_ERROR; + if (!address_in_range(sd, "READ_BLOCK", addr, sd->blk_len)) { return sd_r1; } @@ -1264,8 +1275,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (sd->state) { case sd_transfer_state: - if (addr + sd->blk_len > sd->size) { - sd->card_status |= ADDRESS_ERROR; + if (!address_in_range(sd, "WRITE_BLOCK", addr, sd->blk_len)) { return sd_r1; } @@ -1325,8 +1335,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (sd->state) { case sd_transfer_state: - if (addr >= sd->size) { - sd->card_status |= ADDRESS_ERROR; + if (!address_in_range(sd, "SET_WRITE_PROT", addr, 1)) { return sd_r1b; } @@ -1348,8 +1357,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) switch (sd->state) { case sd_transfer_state: - if (addr >= sd->size) { - sd->card_status |= ADDRESS_ERROR; + if (!address_in_range(sd, "CLR_WRITE_PROT", addr, 1)) { return sd_r1b; } @@ -1826,8 +1834,8 @@ void sd_write_byte(SDState *sd, uint8_t value) case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { /* Start of the block - let's check the address is valid */ - if (sd->data_start + sd->blk_len > sd->size) { - sd->card_status |= ADDRESS_ERROR; + if (!address_in_range(sd, "WRITE_MULTIPLE_BLOCK", + sd->data_start, sd->blk_len)) { break; } if (sd->size <= SDSC_MAX_CAPACITY) { @@ -1999,8 +2007,8 @@ uint8_t sd_read_byte(SDState *sd) case 18: /* CMD18: READ_MULTIPLE_BLOCK */ if (sd->data_offset == 0) { - if (sd->data_start + io_len > sd->size) { - sd->card_status |= 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); From patchwork Wed Jun 23 18:00:15 2021 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: 12340283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ADF6C4743C for ; Wed, 23 Jun 2021 18:03:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B428C60E0C for ; Wed, 23 Jun 2021 18:03:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B428C60E0C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7DI-0008Vn-Qi for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:03:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7B5-0005ie-VS; Wed, 23 Jun 2021 14:00:44 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:39471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7B3-00033A-Pw; Wed, 23 Jun 2021 14:00:43 -0400 Received: by mail-wm1-x335.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso4535645wmh.4; Wed, 23 Jun 2021 11:00:40 -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=ekY1Y62A00vqrltmJVmY3I+nTxzguE4brB+wWUyZUBWf4Lbkzc/4OIaA94me4DieKK msuwpgSHTQOu8CvYcD4CoAo35hTBLC74FLCuG0H+6ZM2EegX68lNVDXd5kihpLaU5rRg lWzq9eMTAOWrvZ0Xi1pUNv1zvDmL/qiaEK4bt5qcCk0yLqIR/LkbwRxFETQvzSrCeS3e RTWfo8wiTdociAAlvIvE2Wr7AQCg0mCMYf0FAr+WcIwmf8TxWgntBXmXYUUZZOLDt318 k+SyI/6GCyKIK/yDIdidfOFTHlZlKBrHnQPIoh9388mMIIMF2Xze+A1P/7etFX1K1w86 3lLA== X-Gm-Message-State: AOAM531n5pIr5WKAT3XHArmBS+k0gsHUiuSpA/FhNQr8xTvElMVoDCqt 2yj11B9alY36OsdLU5daFjK/ef73LgVC0g== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Reviewed-by: Niek Linnenbank Reviewed-by: Willian Rampazzo Reviewed-by: Cleber Rosa --- 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=arch:arm :avocado: tags=machine:orangepi-pc :avocado: tags=device:sd + :avocado: tags=os:netbsd """ # This test download a 304MB compressed image and expand it to 2GB deb_url = ('http://snapshot.debian.org/archive/debian/' diff --git a/tests/acceptance/ppc_prep_40p.py b/tests/acceptance/ppc_prep_40p.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=arch:ppc :avocado: tags=machine:40p + :avocado: tags=os:netbsd :avocado: tags=slowness:high """ bios_url = ('http://ftpmirror.your.org/pub/misc/' @@ -64,6 +65,7 @@ def test_openbios_and_netbsd(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:40p + :avocado: tags=os:netbsd """ drive_url = ('https://cdn.netbsd.org/pub/NetBSD/iso/7.1.2/' 'NetBSD-7.1.2-prep.iso') From patchwork Wed Jun 23 18:00:16 2021 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: 12340289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7561FC4743C for ; Wed, 23 Jun 2021 18:05:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25B2E61075 for ; Wed, 23 Jun 2021 18:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25B2E61075 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7GA-0005yH-67 for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:05:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BB-0005zQ-PV; Wed, 23 Jun 2021 14:00:49 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:46698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7B8-000393-Ut; Wed, 23 Jun 2021 14:00:49 -0400 Received: by mail-wm1-x333.google.com with SMTP id v20-20020a05600c2154b02901dcefb16af0so1921701wml.5; Wed, 23 Jun 2021 11:00:46 -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=l2LQFI3vpw+cyKA83+eMmF2AIHRC1zjQlES+dlmXS6Ez9TU8Du0r9YoHZ3ymAbKAHR ELltpsxOaVQUeXRcB4AVp1aM2gsPFUs7a3vLYhNMRlLhqsakKdlQr+WaahGvBLcdkUKc IhxtbJ0MeZ3AqylHNVAzsFEw2eEqkuSNMDAAA+7OcUvjMGHM4fLv7Jw3RbUqVzmB20EO 0CrLsPNECoZxOsMBqvYPCLomDSKxw78CQlCm53mcbJTxl6A9CN3Bb3WdOOa2ks4R4sm6 97F2z/qupvCVoj3AW2GX+gCH1XDFE25uEctdbko1LNmsHq512680lDXckvO6Kz4UXbg1 JhhQ== X-Gm-Message-State: AOAM530LNpnp7dt8bdobmE81xQrtXilQjqAyJ8JdgC/xVlMggivYYMPu mYtv8stxnNQrJfo4dOYQpSlQ95IRR2Ycrw== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é 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 == 0 else 2**(x - 1).bit_length() +""" +Expand file size +""" +def image_expand(path, size): + if size != 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 = os.path.getsize(path) - size_aligned = pow2ceil(size) - if size != size_aligned: - with open(path, 'ab+') as fd: - fd.truncate(size_aligned) + image_expand(path, pow2ceil(os.path.getsize(path))) class LinuxKernelTest(Test): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' From patchwork Wed Jun 23 18:00:17 2021 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: 12340293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D94E3C4743C for ; Wed, 23 Jun 2021 18:08:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A65E610C7 for ; Wed, 23 Jun 2021 18:08:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A65E610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7IV-0000uG-C9 for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:08:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BF-00064c-Gq; Wed, 23 Jun 2021 14:00:55 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:44958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7BD-0003CC-OR; Wed, 23 Jun 2021 14:00:53 -0400 Received: by mail-wr1-x435.google.com with SMTP id u11so3585154wrw.11; Wed, 23 Jun 2021 11:00:51 -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=BpOAR1c6sEQ1zaUF9mxe6X71U9QTpkp2MgNlzYA0+QZezSmsbSjmzwX9zdc8gPSALs TmI3AH4DwBRRVpIUDLmrM21EzruU1JuYg0OI4MQGO0npQPMTZNNio51wH4sBa1iF1gpY iYccbRj8zscQr2De0Yqe63Nn3RvGoJTmJ/7eqbdIWi7/FJfhZzHpi+eSsnraanhZne4U kZpTyFpFGTK4M1d0d1EeXHsQNiI+0T0mV+snwR6ToI+sZ3y7JeFtVdtktjLe3RrTMynZ 5UrbxXqAHPWE4D2wLJj6ntwyJFBPMONUcTGkxXV2A3sJz7erPWV/SAPP1j4XCqkV+2qb g9/w== X-Gm-Message-State: AOAM530VwEW5a00Zb//KUbJqJ516QJnnNzaKDNyviyuk8fmQMadv4E9S Z9plkzn6Ca4O8p58v+cqnA6N9xlFZ2LpSw== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Reviewed-by: Willian Rampazzo Reviewed-by: Niek Linnenbank --- 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=device:sd :avocado: tags=os: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 = 2 * 1024 * 1024 * 1024 deb_url = ('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 = self.fetch_asset(image_url, asset_hash=image_hash) image_path = 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 = 'if=sd,format=raw,snapshot=on,file=' + image_path # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc From patchwork Wed Jun 23 18:00:18 2021 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: 12340295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98460C4743C for ; Wed, 23 Jun 2021 18:09:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EFF8610C7 for ; Wed, 23 Jun 2021 18:09:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EFF8610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7Jk-0002qs-K3 for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:09:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BM-00068q-Cs; Wed, 23 Jun 2021 14:01:00 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:42719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7BJ-0003EH-E9; Wed, 23 Jun 2021 14:01:00 -0400 Received: by mail-wm1-x32c.google.com with SMTP id l7-20020a05600c1d07b02901b0e2ebd6deso1936102wms.1; Wed, 23 Jun 2021 11:00:55 -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=l3gbIPGiuSff7vib4s5nfwDTs/PJF4nrwUhOoyzmC04pu4wBE1Sd0K6boWQgHnDV1V KSJpaIDV9ftNY2WOqaUM/2ww/OEhAPx8gXaAakbyhnqeJLymJ9gGARiSTyVB7sWlq6Zn A8eDet48CDh5xI9B9jHokS6nUdkxr7fgFzHOKr/wzv6wcEd0HyTOg1FNmgSpslOK41NQ h8KTBFUC5+GEtK4nasObttzVEpMdSMTw5z0iTMj92skkTEzKnr47MYKb1iJF5DW8uO+E u3qoIOJXYeCXVosV8tiZicjEC0+aUSp5A08WhfQ+2Dwrz96UEUgP6/65zJ+8UTf0Prm7 PPXw== X-Gm-Message-State: AOAM530sSC7LJIKgrs7PHmI+fxGFCuj+Pj/PY2NojLHkYEFF4dv7sGmZ oCmLeJdJXEjVyItfBOu160gKTwvJJI7coA== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Reviewed-by: Willian Rampazzo Reviewed-by: Niek Linnenbank --- 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=arch:arm :avocado: tags=machine:orangepi-pc :avocado: tags=device:sd + :avocado: tags=u-boot """ - # 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. image_url = ('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 = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256') image_path = archive.extract(image_path_xz, self.workdir) - image_pow2ceil_expand(image_path) + image_expand(image_path, 2 * 1024 * 1024 * 1024) self.vm.set_console() self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', From patchwork Wed Jun 23 18:00:19 2021 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: 12340285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE1EEC4743C for ; Wed, 23 Jun 2021 18:03:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79D7C61075 for ; Wed, 23 Jun 2021 18:03:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79D7C61075 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7DZ-0000t4-K2 for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BQ-0006Be-KR; Wed, 23 Jun 2021 14:01:04 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:37587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7BO-0003GG-3v; Wed, 23 Jun 2021 14:01:03 -0400 Received: by mail-wm1-x32f.google.com with SMTP id f16-20020a05600c1550b02901b00c1be4abso4551874wmg.2; Wed, 23 Jun 2021 11:01:00 -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=p8O2FQ48QB7m8zeUVhoEYizgU4D45215aDA0rpr4SHR6bOoT9WHpzJpTsm86OLwYI1 tfVYbQj7OGnjEC1iWD1dLF02FbKx57VCaeMCh74fXZAQsb3FqaDeyRRxksGQ5UVcnMp9 EqsLOtA/cfzdlqoU4fRfDG2JLhOhn6RuX4157yFYufZ1uSN7w1Pzus8tIQAdibWofLpA sXp1JjfoWjNU0MvGuz3J8GrhNCONEajyQWoBlr/P1SOF3n3K0J59OpHSv37xBkA+Abqw 4Fdwb8ssrTrIryTlMdn2b+Q9PgTvrLDfVjyzyNK7iuMX6qImrwGqXEFZvMmuIuLfg4wS rFiw== X-Gm-Message-State: AOAM532P75whPHtKZThRpeBLCH+uCpNIZzIfXmlw5LS+liF9US4WSzrJ VwqAgltd74d272d5/IAq2pHrq0qBl+JHtA== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" XXX it seems to work... Signed-off-by: Philippe Mathieu-Daudé --- 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 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') archive.lzma_uncompress(rootfs_path_xz, rootfs_path) - image_pow2ceil_expand(rootfs_path) self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + From patchwork Wed Jun 23 18:00:20 2021 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: 12340297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63CB5C4743C for ; Wed, 23 Jun 2021 18:10:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3D4861075 for ; Wed, 23 Jun 2021 18:10:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3D4861075 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7Ki-0004Kh-5y for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:10:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BU-0006Qf-Jv; Wed, 23 Jun 2021 14:01:08 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:36818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7BT-0003J8-0f; Wed, 23 Jun 2021 14:01:08 -0400 Received: by mail-wr1-x432.google.com with SMTP id l12so2894407wrt.3; Wed, 23 Jun 2021 11:01:06 -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=kD1WMVVfy0oqPDLq1xDu2cYg7H46/PjzZ7q1xFLLY46+lQsxY9prnPMhnXFsyjap3U +ER7+mtgsgGBTXtUW+w8ZhBcW5I4kqdSPAqz2hBxmHPO1pcur2vjPzEJzFjLDYtsr4DW co555OXiC++rE3JG45TV0Amb7I4JhAhVC56txx//E53X2M8oBOqNpZu8Wnjt93q7oLuy 1GLifnP0IVRZTgWGtQWpB4wdqnpB82O8JB+FMbAhpC2ZDiWufc+jzdwouswDpf+zdhfW e7z5qrJv88aS/sB3u/78nkld+7t/dfywUOXIAV3m1cWs9wI6611KmVl/F2IDnncey8X/ 3v/A== X-Gm-Message-State: AOAM531VpwfgoNTnA0s+uRN+VoAkcgtsraPKE1ggFHcmppM0HF/9rcZa NCbaqr1hcj7IaYxV7pOYQEawB2I+fYWPow== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We don't use pow2ceil() anymore, remove it. Signed-off-by: Philippe Mathieu-Daudé 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 = False -""" -Round up to next power of 2 -""" -def pow2ceil(x): - return 1 if x == 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) -""" -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 = 'printk.time=0 ' From patchwork Wed Jun 23 18:00:21 2021 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: 12340291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10FEEC4743C for ; Wed, 23 Jun 2021 18:06:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4E5D61075 for ; Wed, 23 Jun 2021 18:06:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4E5D61075 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw7GT-0006aO-UB for qemu-devel@archiver.kernel.org; Wed, 23 Jun 2021 14:06:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw7BZ-0006fE-DX; Wed, 23 Jun 2021 14:01:13 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:33336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw7BX-0003MY-Mv; Wed, 23 Jun 2021 14:01:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id t11-20020a1cc30b0000b02901cec841b6a0so3653678wmf.0; Wed, 23 Jun 2021 11:01:10 -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=HWPF4fkeZ2yQ7ubsvpdJOBcAW9ZlYTQjEL4U89ggIcTwmkNvrbsCkXmL/2DL2ealh0 H10E7wjNznEMzKWzQsegRB+vVeCtUkRVOBtDhRGH/u3jvjsLifETbog5Z6d8tEOE9leZ CuebdQ6csNVVgKLyzfNQDtQvrxMbIiDla7YD9d/BYwddZtbc1bupdgoXwZhtCzcBtvrB HItedq2mejJxLUivxcgqmUdJlRTA6L7o9Z4G024roHb4uZD604Tt80an3hta9mzYB5vq D++P8E2W+Go30uoVFj3B5U/TJ1jt0Hl5wHmOH+TKoTO+Tb2KAOSWw5LXcjCZI7d+R2KL 2OfQ== X-Gm-Message-State: AOAM533DSrZvkAaeXmsYVRVXPUMebDm0Kab79pUkuVO45xOnqk+CoTzS kz+5xDv3o8BywBY5I+gjaGc+EoAJ8+VTNA== 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , qemu-block@nongnu.org, Bin Meng , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Tom Yan , Alexander Bulekov , Niek Linnenbank , =?utf-8?q?Michal_Such=C3=A1nek?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 **errp) blk_size = blk_getlength(sd->blk); if (blk_size > 0 && !is_power_of_2(blk_size)) { int64_t blk_size_aligned = pow2ceil(blk_size); - char *blk_size_str; + g_autofree char *blk_size_s = size_to_str(blk_size); + g_autofree char *blk_size_aligned_s = size_to_str(blk_size_aligned); - blk_size_str = size_to_str(blk_size); - error_setg(errp, "Invalid SD card size: %s", blk_size_str); - g_free(blk_size_str); - - blk_size_str = 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 work" + " but is not supported by QEMU. If possible, resize" + " 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)."); } ret = blk_set_perm(sd->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,