From patchwork Fri Jan 20 13:43:13 2023 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: 13109888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 17BA0C25B4E for ; Fri, 20 Jan 2023 13:44:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIrfy-00013a-3Y; Fri, 20 Jan 2023 08:43:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIrfw-000138-Bo for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:43:24 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIrfu-0007Wx-SL for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:43:24 -0500 Received: by mail-wm1-x32a.google.com with SMTP id g10so4114050wmo.1 for ; Fri, 20 Jan 2023 05:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UNHd8/T89f0TRHea37adZgQvQ+f5+hWer7661K7hDXI=; b=qHk0TYqXYGW8iALXaE11M3MlMIxhkCjmG4yJZismQtXQG97rzmhRqZ5r0GoMLNgsZ7 CN1qJ8bGYYWss5i1LGDomJnR+6JsKMZkqPzHOSqeAtLFWcLmHZA7akjkYXE4sqWhCqwt IdQ5sCwaQgWNmhy4XkOLQlXbU2mMvKczMjhJasZfEjXQhivjGnnALEgMqZZPrQD84rLD QBao2M9nkpE5JhiLb/vFWzUddlmrJ2/gN5Blhn9fMGz4SbOUh+NKA2hAVXREQujAiH3m bJx4SII0RkieQnjQAFpZHUOWB3zdMJ8lU78T78YQMUpCj82hSpkjIGrBIKVP6X6bWp7y Bs7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UNHd8/T89f0TRHea37adZgQvQ+f5+hWer7661K7hDXI=; b=6MRDE6uWpaNNkUdxXYOvf4oJrCcziAh32/Da135BtyYi7LkhkXO7HaQxbY8ltn1t8s VVXFrZThZn6nPaC7FM9cTylNkSTeyjaktXLb/mUx6xV9mpgi0bQ4gLIHC2w0WGAkoRdK +FXFrnCfPK9rslVbIhPFbJclprH46FPmFpCX8rj9ouy2Qf8QLWEi+Y7qvZE4ahq3Lgcm hsc353ZPo6gK+9j1Lw5mQF+Ll4/qhDs01Gq8LB1gwJBhCUMHpSupQvZvdc17g4BkIc06 s2W/miVyhJ6g/VAmaIy7L/LWaqElIocuGUNL7gjFD7WE8pI9t9yyRQwsGYhvWehdA4jJ x1gQ== X-Gm-Message-State: AFqh2kriXkRtT207ld8l6pr1XLtcPo5Y3VWTRTgH8WfD8f3ldXbynbDy w1A0oT/XeWxs8w4CEd4p9ysiZQg1wd4O7MzK X-Google-Smtp-Source: AMrXdXu/p6afDDUBeaVXrcoNM/x+G1HbqU3AR1tfoBWY/bRoZof5jt6q5TBPWU849DQugXwle7lOyQ== X-Received: by 2002:a05:600c:1712:b0:3d9:a145:91a with SMTP id c18-20020a05600c171200b003d9a145091amr14158241wmn.28.1674222201108; Fri, 20 Jan 2023 05:43:21 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h13-20020a05600c2cad00b003cfa622a18asm2691725wmc.3.2023.01.20.05.43.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jan 2023 05:43:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Cleber Rosa , Peter Maydell , Subbaraya Sundeep Subject: [PATCH v2 1/2] tests/avocado: Factor file_truncate() helper out Date: Fri, 20 Jan 2023 14:43:13 +0100 Message-Id: <20230120134314.81956-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230120134314.81956-1-philmd@linaro.org> References: <20230120134314.81956-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Factor file_truncate() helper out of image_pow2ceil_expand() for reuse. Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/boot_linux_console.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index 8c1d981586..8a598be966 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -30,15 +30,16 @@ def pow2ceil(x): return 1 if x == 0 else 2**(x - 1).bit_length() +def file_truncate(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) +def image_pow2ceil_expand(path, size): + file_truncate(path, pow2ceil(size)) class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' From patchwork Fri Jan 20 13:43:14 2023 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: 13109889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C9720C05027 for ; Fri, 20 Jan 2023 13:44:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIrg3-00018h-Pj; Fri, 20 Jan 2023 08:43:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIrg2-00018C-5X for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:43:30 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIrfz-0007Xi-M1 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 08:43:29 -0500 Received: by mail-wm1-x32d.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so3723055wms.2 for ; Fri, 20 Jan 2023 05:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s8GtNAPgyhpBwG+7nq0uxfOe9enuDqptYaOVvOfM+co=; b=lEIwHB3ugGTDTf+OxmLQetvIr4Mxakn7v4LQiSj/5uSRIZwt70Vk15vF7j5NAyfRJv M213FplsS8AHESMJhfkbsRAxkEeJhVPrVC9JhmcSx+dpDUnb2CiIj8YitCRIZbZuFM27 HJqQP3KbkO86q5iT2N6QPRwCM5DQSqCBqoqVfOKhxH+k99IqIii3WfPNFBkegQgR634V 0iJF1ba16Lkpf7yuxW9WgAT4MZOXgclsTZ44w1jqsGtHebVZ6W7KxBa4cx/VaKw1y5iV EN75CKJceupP/YAHE5jzyzBEPS2HVqpZmmFBOBmArJK09/gatJPfPZRPbE3gZK3SDCso fKZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s8GtNAPgyhpBwG+7nq0uxfOe9enuDqptYaOVvOfM+co=; b=VBf3+0t6TOcc0v8DhIuPSjRN3t+Tep/MOZWAuCJVKETzKY73vebHXTP/78Jh8UxIif FPNthlq019L53CjTIpa38USy655VM2mw0LF2D17M52MVMgFWZEvtoQvq/q4PHncGRRuY t58tZP5OM1iACqYEZELy/XuFXvYK8s27XWZmoiS0ZC+WGgjyTwuogWbocfOtw1Le5j0N p0hqQ636DvCmVAqLhx2uod5zfW/KInX9EMOp03g69ReZ2bA/RH345dXZtjJfXSiKj4kp 1MfmshROVOpjSumbifV41IURsfHOXKgxUPEjFkstubqBhYJ2ubNZlp0BP26eATiDnVG7 N7bQ== X-Gm-Message-State: AFqh2kq7DJ9BF9VbCp66vOBbI0P5d+TUrHQi/w5NeZdzZTHck9oaHCZq 5TRScSv9jqq5Bea5gg99zJjFDvry47bGIy6H X-Google-Smtp-Source: AMrXdXu41bWO1PlX+66C1dzSABYSd5FbajgqhIqUhiJOW4UYegbdEj86B8mbvJHu/CFZb/bUbYilrw== X-Received: by 2002:a05:600c:540d:b0:3d9:fb59:c16b with SMTP id he13-20020a05600c540d00b003d9fb59c16bmr10559299wmb.36.1674222206112; Fri, 20 Jan 2023 05:43:26 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f22-20020a1cc916000000b003d35acb0fd7sm2344031wmb.34.2023.01.20.05.43.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jan 2023 05:43:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Cleber Rosa , Peter Maydell , Subbaraya Sundeep Subject: [PATCH v2 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Date: Fri, 20 Jan 2023 14:43:14 +0100 Message-Id: <20230120134314.81956-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230120134314.81956-1-philmd@linaro.org> References: <20230120134314.81956-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The M2S-FG484 SOM uses a 16 MiB SPI flash (Spansion S25FL128SDPBHICO). Since the test asset is bigger, truncate it to the correct size to avoid when running the test_arm_emcraft_sf2 test: qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes Add comment regarding the M2S-FG484 SOM hardware in hw/arm/msf2-som.c. Reported-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Cédric Le Goater --- hw/arm/msf2-som.c | 5 ++++- tests/avocado/boot_linux_console.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c index a6df473ec9..7b3106c790 100644 --- a/hw/arm/msf2-som.c +++ b/hw/arm/msf2-som.c @@ -1,6 +1,9 @@ /* * SmartFusion2 SOM starter kit(from Emcraft) emulation. * + * M2S-FG484 SOM hardware architecture specification: + * https://www.emcraft.com/jdownloads/som/m2s/m2s-som-ha.pdf + * * Copyright (c) 2017 Subbaraya Sundeep * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -87,7 +90,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) /* Attach SPI flash to SPI0 controller */ spi_bus = qdev_get_child_bus(dev, "spi0"); - spi_flash = qdev_new("s25sl12801"); + spi_flash = qdev_new("s25sl12801"); /* Spansion S25FL128SDPBHICO */ qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1); if (dinfo) { qdev_prop_set_drive_err(spi_flash, "drive", diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index 8a598be966..9f5077c791 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -396,6 +396,8 @@ def test_arm_emcraft_sf2(self): spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501' spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash) + file_truncate(spi_path, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB + self.vm.set_console() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE self.vm.add_args('-kernel', uboot_path,