* [PATCH 0/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB @ 2023-01-20 12:28 Philippe Mathieu-Daudé 2023-01-20 12:28 ` [PATCH 1/2] tests/avocado: Factor file_truncate() helper out Philippe Mathieu-Daudé 2023-01-20 12:28 ` [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé 0 siblings, 2 replies; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2023-01-20 12:28 UTC (permalink / raw) To: qemu-devel Cc: Philippe Mathieu-Daudé, Peter Maydell, qemu-arm, Cleber Rosa, Beraldo Leal, Subbaraya Sundeep, Cédric Le Goater, Wainer dos Santos Moschetta The M2S-FG484 SOM SPI flash is 16MiB. Truncate the file provided with the Avocado test to avoid: qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes before merging the "m25p80: Improve error when the backend file size does not match the device" patch: https://lore.kernel.org/qemu-devel/20230119123449.531826-2-clg@kaod.org/ Philippe Mathieu-Daudé (2): tests/avocado: Factor file_truncate() helper out tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB hw/arm/msf2-som.c | 5 ++++- tests/avocado/boot_linux_console.py | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) -- 2.38.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] tests/avocado: Factor file_truncate() helper out 2023-01-20 12:28 [PATCH 0/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé @ 2023-01-20 12:28 ` Philippe Mathieu-Daudé 2023-01-20 12:53 ` Cédric Le Goater 2023-01-20 12:28 ` [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé 1 sibling, 1 reply; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2023-01-20 12:28 UTC (permalink / raw) To: qemu-devel Cc: Philippe Mathieu-Daudé, Peter Maydell, qemu-arm, Cleber Rosa, Beraldo Leal, Subbaraya Sundeep, Cédric Le Goater, Wainer dos Santos Moschetta Factor file_truncate() helper out of image_pow2ceil_expand() for reuse. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- tests/avocado/boot_linux_console.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index 8c1d981586..49a4b22fe1 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -30,15 +30,19 @@ def pow2ceil(x): return 1 if x == 0 else 2**(x - 1).bit_length() +""" +Truncate file +""" +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) + file_truncate(path, pow2ceil(size)) class LinuxKernelTest(QemuSystemTest): KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' -- 2.38.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] tests/avocado: Factor file_truncate() helper out 2023-01-20 12:28 ` [PATCH 1/2] tests/avocado: Factor file_truncate() helper out Philippe Mathieu-Daudé @ 2023-01-20 12:53 ` Cédric Le Goater 0 siblings, 0 replies; 5+ messages in thread From: Cédric Le Goater @ 2023-01-20 12:53 UTC (permalink / raw) To: Philippe Mathieu-Daudé, qemu-devel Cc: Peter Maydell, qemu-arm, Cleber Rosa, Beraldo Leal, Subbaraya Sundeep, Wainer dos Santos Moschetta On 1/20/23 13:28, Philippe Mathieu-Daudé wrote: > Factor file_truncate() helper out of image_pow2ceil_expand() > for reuse. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>> > --- > tests/avocado/boot_linux_console.py | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py > index 8c1d981586..49a4b22fe1 100644 > --- a/tests/avocado/boot_linux_console.py > +++ b/tests/avocado/boot_linux_console.py > @@ -30,15 +30,19 @@ > def pow2ceil(x): > return 1 if x == 0 else 2**(x - 1).bit_length() > > +""" > +Truncate file > +""" > +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) > + file_truncate(path, pow2ceil(size)) size is required ^ C. > > class LinuxKernelTest(QemuSystemTest): > KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB 2023-01-20 12:28 [PATCH 0/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé 2023-01-20 12:28 ` [PATCH 1/2] tests/avocado: Factor file_truncate() helper out Philippe Mathieu-Daudé @ 2023-01-20 12:28 ` Philippe Mathieu-Daudé 2023-01-20 12:51 ` Cédric Le Goater 1 sibling, 1 reply; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2023-01-20 12:28 UTC (permalink / raw) To: qemu-devel Cc: Philippe Mathieu-Daudé, Peter Maydell, qemu-arm, Cleber Rosa, Beraldo Leal, Subbaraya Sundeep, Cédric Le Goater, Wainer dos Santos Moschetta 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 <clg@kaod.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- 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 <sundeep.lkml@gmail.com> * * 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 49a4b22fe1..37600be4a2 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -399,6 +399,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, -- 2.38.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB 2023-01-20 12:28 ` [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé @ 2023-01-20 12:51 ` Cédric Le Goater 0 siblings, 0 replies; 5+ messages in thread From: Cédric Le Goater @ 2023-01-20 12:51 UTC (permalink / raw) To: Philippe Mathieu-Daudé, qemu-devel Cc: Peter Maydell, qemu-arm, Cleber Rosa, Beraldo Leal, Subbaraya Sundeep, Wainer dos Santos Moschetta On 1/20/23 13:28, Philippe Mathieu-Daudé wrote: > 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 <clg@kaod.org> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Tested-by: Cédric Le Goater <clg@kaod.org> Thanks, C. > --- > 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 <sundeep.lkml@gmail.com> > * > * 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 49a4b22fe1..37600be4a2 100644 > --- a/tests/avocado/boot_linux_console.py > +++ b/tests/avocado/boot_linux_console.py > @@ -399,6 +399,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, ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-20 12:54 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-01-20 12:28 [PATCH 0/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé 2023-01-20 12:28 ` [PATCH 1/2] tests/avocado: Factor file_truncate() helper out Philippe Mathieu-Daudé 2023-01-20 12:53 ` Cédric Le Goater 2023-01-20 12:28 ` [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB Philippe Mathieu-Daudé 2023-01-20 12:51 ` Cédric Le Goater
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).