From mboxrd@z Thu Jan 1 00:00:00 1970 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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 660B1C77B73 for ; Mon, 5 Jun 2023 01:01:48 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1q5yan-00048W-1o; Sun, 04 Jun 2023 21:01:05 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.96) (envelope-from ) id 1q5yae-00047V-2N for kernelnewbies@kernelnewbies.org; Sun, 04 Jun 2023 21:01:02 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 5 Jun 2023 10:00:39 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send001-relay.gov-dooray.com with SMTP id 6b5121a2647d33b7; Mon, 05 Jun 2023 10:00:39 +0900 DKIM-Signature: a=rsa-sha256; b=yjkIJmm6Iw7xGv4x8UA9Nv0Ox2kOa4zSxBlaTsJEcFURCPZNqS11ZH86oAqqaFgvQexwaauMLT jrQf9isNe9lVNqNGBsMFrpbHcVFYJUM9Qrc12mkLPqRgPWj/itpH4GrYB6eFPeGCiyUY69YFNvWE 4Zx4cIjjsawxUvJJHtc/nWxgLbYm32iwe5TWiWCaaGusWHSRhv26UZR7M7oVZkl4nFcEKMHOvz48 plvTcuU99f+fkf65rNehOHIWYWWjQr2fdDbVPO5K9pGDo6NEQxjXeGjyaZ+WzITF0wR/DIkPJ/RX DoOc1RecWMI+c+ZEg5YIKV79VZfl71EQhIc/ZHPQ==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=jO+2eUL7aVhg12WzkeX1vcWUEB6R2l8KCSR+s6xk6FY=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id c6e02d82647d33b7; Mon, 05 Jun 2023 10:00:39 +0900 From: "Chan Kim" To: "U-Boot Mailing List" , , Subject: RE: Running u-boot and linux on qemu arm64 virt machine, linux shell does not respond.. ==> solved! Date: Mon, 5 Jun 2023 10:00:37 +0900 Message-ID: <037a01d99749$246c89c0$6d459d40$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdmXSRyxghSYnjxJSICqUC9lrVxI3Q== Content-Language: ko X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6232129970920864381==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============6232129970920864381== Content-Type: multipart/alternative; boundary="----=_NextPart_000_037B_01D99794.94554330" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_037B_01D99794.94554330 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, all, I found what the problem was and fixed it. In u-boot(v2022.07), I modified arch/arm/Kconfig and made CONFIG_GICV3 selected by CONFIG_ARCH_QEMU. And then in qemu_arm64_defconfig, added CONFIG_BOOTCOMMAND="booti 0x40400000 0x44000000 0x40000000" (this automatic boot, with my qemu command) I also had to add in include/configs/qemu-arm.h, #define GICD_BASE 0x8000000 #define GICR_BASE 0x80a0000 I think this is the only things I added to the u-boot code. (I removed GICR power-up code in my previous email, that wasn't necessary) Hope this helps someone later. Thank you! Chan Kim From: Chan Kim Sent: Friday, June 2, 2023 6:28 PM To: U-Boot Mailing List ; 'qemu-discuss@nongnu.org' ; kernelnewbies@kernelnewbies.org Subject: Running u-boot and linux on qemu arm64 virt machine, linux shell does not respond.. Hello all, I'm trying to run u-boot and linux on qemu arm64 virt machine preferably without changing any source code. (u-boot v2022.07, linux 5.15.68, qemu 6.2.0, busybox 1.32.1) I have built u-boot using qemu_arm64_defconfig and I got u-boot(elf) and u-boot.bin. I built linux using defconfig but later I removed many CONFIG_* to reduce compile time and got Image(binary). Also, I built busybox and made ramdisk. Now this is the qemu command I used. (I referenced u-boot's include/configs/qemu-arm.h to determine the load addresses, set CONFIG_BOOTCOMMAND=" booti 0x40400000 0x44000000 0x40000000") ../temp/qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine virt,gic-version=max,secure=on,virtualization=true -cpu max -m 4G -nographic -bios u-boot/u-boot.bin -device loader,file=../temp/linux-5.15.68/arch/arm64/boot/Image,addr=0x40400000 -device loader,file=initrd.img,addr=0x44000000 u-boot runs and automatically boots linunx and it boots OK to the shell prompt. But at the linux shell prompt, it doesn't respond to my keyboard input. It looks like the symptom I saw last year when system counter is not working(for real board only). (I added system counter device in our qemu virtual machine just to not cause panic during the system counter access with the same driver. The qemu machine for our board runs ok using u-boot-spl and linux after booting including shell program and simple driver test. I'm trying to use u-boot proper now). Also last year I had to power-on the GICR(for virtual machine and real board). So I tried adding the code to power up GICR but it is the same. (this part is missing in u-boot, but I saw it is in the arm-tf S/W). For your reference this is the change in u-boot's arch/arm/lib/gic_64.S. /* x9: ReDistributor Base Address of Current CPU */ 2: mov w10, #~0x2 ldr w11, [x9, GICR_WAKER] and w11, w11, w10 /* Clear ProcessorSleep */ str w11, [x9, GICR_WAKER] dsb st isb ==> /* x9: ReDistributor Base Address of Current CPU */ 2: // gicr power on, ckim mov w10, 2 str w10, [x9, GICR_PWRR] 5: ldr w10, [x9, GICR_PWRR] tbnz w10, #1, 5b /* Wait Children be Alive */ mov w10, #~0x2 ldr w11, [x9, GICR_WAKER] and w11, w11, w10 /* Clear ProcessorSleep */ str w11, [x9, GICR_WAKER] dsb st isb Can anyone suggest what I can try to solve this problem? (I mean, the problem of linux shell not responding in qemu virtual machine) I would appreciate it for any comment or help. Thank you. Chan Kim ------=_NextPart_000_037B_01D99794.94554330 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi, all,

 

I found what the problem was and = fixed it.

In u-boot(v2022.07), I modified arch/arm/Kconfig and made = CONFIG_GICV3 selected by CONFIG_ARCH_QEMU.

And then in qemu_arm64_defconfig, = added CONFIG_BOOTCOMMAND=3D"booti 0x40400000 0x44000000 = 0x40000000" (this automatic boot, with my qemu = command)

I = also had to add in include/configs/qemu-arm.h,

#define = GICD_BASE       = 0x8000000

#define GICR_BASE       = 0x80a0000

I = think this is the only things I added to the u-boot code. (I removed = GICR power-up code in my previous email, that wasn’t = necessary)

Hope this helps someone later.

Thank you!

 

Chan Kim

 

From:<= /b> Chan Kim = <ckim@etri.re.kr>
Sent: Friday, June 2, 2023 6:28 = PM
To: U-Boot Mailing List <u-boot@lists.denx.de>; = 'qemu-discuss@nongnu.org' <qemu-discuss@nongnu.org>; = kernelnewbies@kernelnewbies.org
Subject: Running u-boot and = linux on qemu arm64 virt machine, linux shell does not = respond..

 

Hello all,

 

I'm trying to run u-boot and = linux on qemu arm64 virt machine preferably without changing any source = code.

(u-boot v2022.07, linux 5.15.68, qemu 6.2.0, busybox = 1.32.1)

I have built u-boot using qemu_arm64_defconfig and I got = u-boot(elf) and u-boot.bin.

I built linux using defconfig = but later I removed many CONFIG_* to reduce compile time and got = Image(binary).

Also, I built busybox and made = ramdisk.

 

Now this is the qemu command I used. =

(I = referenced u-boot's include/configs/qemu-arm.h to determine the load = addresses, set CONFIG_BOOTCOMMAND=3D" booti 0x40400000 0x44000000 = 0x40000000")

 

../temp/qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64= -machine virt,gic-version=3Dmax,secure=3Don,virtualization=3Dtrue -cpu = max -m 4G -nographic -bios u-boot/u-boot.bin -device = loader,file=3D../temp/linux-5.15.68/arch/arm64/boot/Image,addr=3D0x404000= 00 -device = loader,file=3Dinitrd.img,addr=3D0x44000000

 

u-boot runs and automatically = boots linunx and it boots OK to the shell = prompt.

But at the linux shell prompt, it doesn't respond to my = keyboard input.

It looks like the symptom I saw last year when system = counter is not working(for real board only).

(I added system counter device = in our qemu virtual machine just to not cause panic during the system = counter access with the same driver. The qemu machine for our board runs = ok using u-boot-spl and linux after booting including shell program and = simple driver test. I'm trying to use u-boot proper = now).

 

Also last year I had to power-on the GICR(for virtual = machine and real board).

So I tried adding the code to = power up GICR but it is the same. (this part is missing in u-boot, but I = saw it is in the arm-tf S/W).

For your reference this is the = change in u-boot’s arch/arm/lib/gic_64.S.

 

/* x9: ReDistributor Base Address of Current CPU = */

2:  mov w10, #~0x2

    ldr w11, [x9, = GICR_WAKER]

    and w11, w11, = w10       /* Clear ProcessorSleep = */

    str w11, [x9, = GICR_WAKER]

    dsb st

    isb

=3D=3D>

/* x9: ReDistributor Base Address of Current CPU = */

2:  // gicr power on, ckim

    mov w10, 2

    str w10, [x9, = GICR_PWRR]

5:  ldr w10, [x9, GICR_PWRR]

    tbnz    w10, #1, = 5b     /* Wait Children be Alive = */

    mov w10, #~0x2

    ldr w11, [x9, = GICR_WAKER]

    and w11, w11, = w10       /* Clear ProcessorSleep = */

    str w11, [x9, = GICR_WAKER]

    dsb st

    isb

 

Can anyone suggest what I can = try to solve this problem? (I mean, the problem of linux shell not = responding in qemu virtual machine)

I would appreciate it for any = comment or help.

 

Thank you.

Chan Kim

 

------=_NextPart_000_037B_01D99794.94554330-- --===============6232129970920864381== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============6232129970920864381==--