Noted. Yes, sounds good. I will make this change in v2 patch.

-----Original Message-----
From: Bernhard Beschow <[email protected]>
Sent: 13 November 2025 03:17
To: Gaurav Sharma <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [EXT] Re: [PATCH 13/13] hw/arm/fsl-imx8mm: Adding functional 
testing of iMX8MM emulation

Caution: This is an external email. Please take care when clicking links or 
opening attachments. When in doubt, report the message using the 'Report this 
email' button


Am 12. November 2025 11:02:13 UTC schrieb Gaurav Sharma 
<[email protected]>:
>@'Bernhard Beschow' looks like I was referring to the hex dump of a different 
>Debian disk image. I have got the offset for iMX8MM now. I have tested it as 
>well. The console looks good. Now the only question remains:- shall we 
>continue using offset based method to extract dtb or download it from the 
>cloud instead?

Nice! I'd slightly prefer extracring the DTB from the image for consistency and 
to have only one URL that could break in the future. Does this work for you?

>
>-----Original Message-----
>From: Gaurav Sharma
>Sent: 12 November 2025 12:35
>To: 'Bernhard Beschow' <[email protected]>; '[email protected]'
><[email protected]>
>Cc: '[email protected]' <[email protected]>;
>'[email protected]' <[email protected]>
>Subject: RE: [EXT] Re: [PATCH 13/13] hw/arm/fsl-imx8mm: Adding
>functional testing of iMX8MM emulation
>
>Sorry The correct xxd dump for dtb offset 0x64F51000:- xxd -s 0x64F51000 -l 4 
>disk.raw
>64f51000: e103 16aa                                ....
>
>
>-----Original Message-----
>From: Gaurav Sharma
>Sent: 12 November 2025 12:28
>To: 'Bernhard Beschow' <[email protected]>; [email protected]
>Cc: [email protected]; [email protected]
>Subject: RE: [EXT] Re: [PATCH 13/13] hw/arm/fsl-imx8mm: Adding
>functional testing of iMX8MM emulation
>
>Thank you for reviewing Bernhard. Yes, iMX8MM is very close to iMX8MP that's 
>why I chose to stick to that structure.
>
>" Looks like these lists are sorted alphabetically. Shall we preserve that?"
>
>-- yes "tests_aarch64_system_thorough" should be sorted alphabetically
>preserving the original order - - will modify it in v2 patch
>
>"This DTB offset is the one for the imx8mp-evk, and in fact the console log 
>confirms it. Both machines seem to be so similar that the test passes anyway"
>
>-- yes, I just found out in the console log. The test was giving a
>false positive. Thank you for the heads up!  I have now modified it to
>fetch the dtb from the Debian stable repository. Verified it's working
>correctly via console log
>
>What you need is the offset in the "disk.raw" image that gets extracted from 
>above file. Open "disk.raw" in a hex editor and search for "imx8mm-evk", then 
>determine the offset of the preceeding "d00df00d" DTB magic. That is your 
>offset.
>
>-- do you mean the DTB magic "d00dfeed" instead of "d00df00d"? Also,
>while I was analysing the DTB offset of the mainlined imx8mp functional
>testing 'disk.raw' which has debian-12-generic-arm64-20231210-1590. The
>script mentions the DTB_OFFSET at 0x64F51000. Dumping this offset using
>xxd[also verified it via hex editor]:- # xxd -s 0x51000000 -l 4
>disk.raw
>51000000: 6cff 0060
>It doesn't mention the DTB magic number at this offset. Please let me know if 
>I am missing anything here .
>Can we choose not to rely on the hardcoded offset and instead download the dtb 
>from the Debian stable repository itself? This way the same functional test 
>can be used easily for the future imx board porting as well.
>Looking forward to your guidance.
>
>
>
>-----Original Message-----
>From: Bernhard Beschow <[email protected]>
>Sent: 12 November 2025 04:51
>To: [email protected]; Gaurav Sharma <[email protected]>
>Cc: [email protected]; [email protected]
>Subject: [EXT] Re: [PATCH 13/13] hw/arm/fsl-imx8mm: Adding functional
>testing of iMX8MM emulation
>
>[You don't often get email from [email protected]. Learn why this is
>important at https://aka.ms/LearnAboutSenderIdentification ]
>
>Caution: This is an external email. Please take care when clicking
>links or opening attachments. When in doubt, report the message using
>the 'Report this email' button
>
>
>Am 10. November 2025 11:22:57 UTC schrieb Gaurav Sharma 
><[email protected]>:
>>Added script that would validate the iMX8MM emulation by checking the
>>linux console log. If it succeeds, it will return:-
>>
>>ok 1 test_imx8mm_evk.Imx8mmEvkMachine.test_aarch64_imx8mm_evk_usdhc
>>
>>Signed-off-by: Gaurav Sharma <[email protected]>
>
>>Hi Gaurav!
>
>>Nice to see another imx8 machine being contributed! I'm impressed how close 
>>you stick to the imx8mp, both in terms of structuring this series as well as 
>>the code.
>
>>I've built your series and ran the functional test. Comments below.
>
>
>
>
>--
>
>>---
>> tests/functional/aarch64/meson.build        |  2 +
>> tests/functional/aarch64/test_imx8mm_evk.py | 67
>>+++++++++++++++++++++
>> 2 files changed, 69 insertions(+)
>> create mode 100755 tests/functional/aarch64/test_imx8mm_evk.py
>>
>>diff --git a/tests/functional/aarch64/meson.build
>>b/tests/functional/aarch64/meson.build
>>index 5ad52f93e1..31ecedbf6f 100644
>>--- a/tests/functional/aarch64/meson.build
>>+++ b/tests/functional/aarch64/meson.build
>>@@ -5,6 +5,7 @@ test_aarch64_timeouts = {
>>   'aspeed_ast2700fc' : 600,
>>   'device_passthrough' : 720,
>>   'imx8mp_evk' : 240,
>>+  'imx8mm_evk' : 240,
>>   'raspi4' : 480,
>>   'reverse_debug' : 180,
>>   'rme_virt' : 1200,
>>@@ -28,6 +29,7 @@ tests_aarch64_system_thorough = [
>>   'device_passthrough',
>>   'hotplug_pci',
>>   'imx8mp_evk',
>>+  'imx8mm_evk',
>
>Looks like these lists are sorted alphabetically. Shall we preserve that?
>
>>   'kvm',
>>   'multiprocess',
>>   'raspi3',
>>diff --git a/tests/functional/aarch64/test_imx8mm_evk.py
>>b/tests/functional/aarch64/test_imx8mm_evk.py
>>new file mode 100755
>>index 0000000000..d5eb43afc6
>>--- /dev/null
>>+++ b/tests/functional/aarch64/test_imx8mm_evk.py
>>@@ -0,0 +1,67 @@
>>+#!/usr/bin/env python3
>>+#
>>+# Functional test that boots a Linux kernel and checks the console #
>>+#
>>+SPDX-License-Identifier: GPL-2.0-or-later
>>+
>>+from qemu_test import LinuxKernelTest, Asset
>>+
>>+class Imx8mmEvkMachine(LinuxKernelTest):
>>+
>>+    ASSET_IMAGE = Asset(
>>+        ('https://cloud.debian.org/images/cloud/bookworm/20231210-1590/'
>>+         'debian-12-generic-arm64-20231210-1590.tar.xz'),
>>+
>>+ '7ebf1577b32d5af6204df74b54ca2e4675de9b5a9fa14f3ff70b88eeb7b3b359')
>>+
>>+    KERNEL_OFFSET = 0x51000000
>>+    KERNEL_SIZE = 32622528
>>+    INITRD_OFFSET = 0x76000000
>>+    INITRD_SIZE = 30987766
>>+    DTB_OFFSET = 0x64F51000
>
>This DTB offset is the one for the imx8mp-evk, and in fact the console log 
>confirms it. Both machines seem to be so similar that the test passes anyway.
>
>What you need is the offset in the "disk.raw" image that gets extracted from 
>above file. Open "disk.raw" in a hex editor and search for "imx8mm-evk", then 
>determine the offset of the preceeding "d00df00d" DTB magic. That is your 
>offset.
>
>Best regards,
>Bernhard
>
>>+    DTB_SIZE = 45 * 1024
>>+
>>+    def extract(self, in_path, out_path, offset, size):
>>+        try:
>>+            with open(in_path, "rb") as source:
>>+                source.seek(offset)
>>+                data = source.read(size)
>>+            with open(out_path, "wb") as target:
>>+                target.write(data)
>>+        except (IOError, ValueError) as e:
>>+            self.log.error(f"Failed to extract {out_path}: {e}")
>>+            raise
>>+
>>+    def setUp(self):
>>+        super().setUp()
>>+
>>+        self.image_path = self.scratch_file("disk.raw")
>>+        self.kernel_path = self.scratch_file("linux")
>>+        self.initrd_path = self.scratch_file("initrd.zstd")
>>+        self.dtb_path = self.scratch_file("imx8mm-evk.dtb")
>>+
>>+        self.archive_extract(self.ASSET_IMAGE)
>>+        self.extract(self.image_path, self.kernel_path,
>>+                     self.KERNEL_OFFSET, self.KERNEL_SIZE)
>>+        self.extract(self.image_path, self.initrd_path,
>>+                     self.INITRD_OFFSET, self.INITRD_SIZE)
>>+        self.extract(self.image_path, self.dtb_path,
>>+                     self.DTB_OFFSET, self.DTB_SIZE)
>>+
>>+    def test_aarch64_imx8mm_evk_usdhc(self):
>>+        self.require_accelerator("tcg")
>>+        self.set_machine('imx8mm-evk')
>>+        self.vm.set_console(console_index=1)
>>+        self.vm.add_args('-m', '2G',
>>+                         '-smp', '4',
>>+                         '-kernel', self.kernel_path,
>>+                         '-initrd', self.initrd_path,
>>+                         '-dtb', self.dtb_path,
>>+                         '-append', 'root=/dev/mmcblk2p1',
>>+                         '-drive', f'file={self.image_path},if=sd,bus=2,'
>>+
>>+ 'format=raw,id=mmcblk2,snapshot=on')
>>+
>>+        self.vm.launch()
>>+        self.wait_for_console_pattern('Welcome to ')
>>+
>>+if __name__ == '__main__':
>>+    LinuxKernelTest.main()

Reply via email to