<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Gulim;
panose-1:2 11 6 0 0 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Gulim;
panose-1:2 11 6 0 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-autospace:none;
word-break:break-hangul;
font-size:10.0pt;
font-family:"Malgun Gothic";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"\AE00\C790\B9CC Char";
margin:0cm;
margin-bottom:.0001pt;
text-autospace:none;
word-break:break-hangul;
font-size:10.0pt;
font-family:"Courier New";}
span.Char
{mso-style-name:"\AE00\C790\B9CC Char";
mso-style-priority:99;
mso-style-link:\AE00\C790\B9CC;
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Malgun Gothic";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=KO link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText><span lang=EN-US>Hello all,<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>I'm trying to run u-boot and linux on qemu arm64 virt machine preferably without changing any source code.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>(u-boot v2022.07, linux 5.15.68, qemu 6.2.0, busybox 1.32.1)<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>I have built u-boot using qemu_arm64_defconfig and I got u-boot(elf) and u-boot.bin.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>I built linux using defconfig but later I removed many CONFIG_* to reduce compile time and got Image(binary).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>Also, I built busybox and made ramdisk.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>Now this is the qemu command I used. <o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>(I referenced u-boot's include/configs/qemu-arm.h to determine the load addresses, set CONFIG_BOOTCOMMAND=" booti 0x40400000 0x44000000 0x40000000")<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>../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<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>u-boot runs and automatically boots linunx and it boots OK to the shell prompt.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>But at the linux shell prompt, it doesn't respond to my keyboard input.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>It looks like the symptom I saw last year when system counter is not working(for real board only).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>(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).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>Also last year I had to power-on the GICR(for virtual machine and real board).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>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).<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>For your reference this is the change in u-boot’s arch/arm/lib/gic_64.S.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>/* x9: ReDistributor Base Address of Current CPU */<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>2: mov w10, #~0x2<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> ldr w11, [x9, GICR_WAKER]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> and w11, w11, w10 /* Clear ProcessorSleep */<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> str w11, [x9, GICR_WAKER]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> dsb st<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> isb<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>==><o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>/* x9: ReDistributor Base Address of Current CPU */<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>2: // gicr power on, ckim<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> mov w10, 2<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> str w10, [x9, GICR_PWRR]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US>5: ldr w10, [x9, GICR_PWRR]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> tbnz w10, #1, 5b /* Wait Children be Alive */<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> mov w10, #~0x2<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> ldr w11, [x9, GICR_WAKER]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> and w11, w11, w10 /* Clear ProcessorSleep */<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> str w11, [x9, GICR_WAKER]<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> dsb st<o:p></o:p></span></p><p class=MsoPlainText style='margin-left:20.0pt;mso-para-margin-left:2.0gd'><span lang=EN-US> isb<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>Can anyone suggest what I can try to solve this problem? (I mean, the problem of linux shell not responding in qemu virtual machine)<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>I would appreciate it for any comment or help.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US>Thank you.<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US>Chan Kim<o:p></o:p></span></p><p class=MsoPlainText><span lang=EN-US><o:p> </o:p></span></p></div></body></html>