[prev in list] [next in list] [prev in thread] [next in thread]
List: qemu-discuss
Subject: RE: read_sysreg(TTBR_EL2) not work in linux, but read_sysreg(CurrentEL) works. (arm64)
From: "Chan Kim" <ckim () etri ! re ! kr>
Date: 2022-02-23 10:00:32
Message-ID: 000f01d8289c$32153710$963fa530$ () etri ! re ! kr
[Download RAW message or body]
This is a multipart message in MIME format.
I'm using qemu-6.2.0. using gdb, after I executed 'msr ttbr1_el1, x1' (when
x1 = 0x80737000), when I examine TTBR1_EL1 register by 'info reg
TTBR1_EL1', the value is 0. Is it gdb problem? Or qemu problem?
Chan Kim
From: Chan Kim <ckim@etri.re.kr>
Sent: Wednesday, February 23, 2022 6:45 PM
To: 'qemu-discuss@nongnu.org' <qemu-discuss@nongnu.org>
Subject: RE: read_sysreg(TTBR_EL2) not work in linux, but
read_sysreg(CurrentEL) works. (arm64)
I used an old kernel (5.4.21) and I missed during the kernel build, the
compiler complained that
"selected processor does not support system register name 'ttbr1_el2'".
So this reading of ttbr1_el2 seemed to have been ignored.
Switching to kernel 5.10.0rc, this error is not coming.
Thank you.
Chan Kim
From: Chan Kim <ckim@etri.re.kr <mailto:ckim@etri.re.kr> >
Sent: Tuesday, February 22, 2022 3:15 PM
To: 'qemu-discuss@nongnu.org' <qemu-discuss@nongnu.org
<mailto:qemu-discuss@nongnu.org> >
Subject: read_sysreg(TTBR_EL2) not work in linux, but read_sysreg(CurrentEL)
works. (arm64)
When running u-boot starting linux on qemu and using gdb to debug the
program, (on a modified arm64 virt machine),
I see this strange things.
Right after I enter linux start_kernel( ), I added these two lines,
datax = read_sysreg(CurrentEL); -- line 1
datax = read_sysreg(TTBR1_EL2); -- line 2
after line 1 and before line 2, the value of datax is seen as 8. (bit [3:2]
is current EL, so it's EL2).
after line 2, the value of datax is still 8, but the result of `info reg
TTBR1_EL2` is 0x8065a000.
The disassembled assembly code shows no reading of TTBR1_EL2 register.
How can this happen? Should I set something in the kernel configuration?
Any help will be really appreciated.
Thank you!
Chan Kim
[Attachment #3 (text/html)]
<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:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Malgun Gothic";
panose-1:2 11 5 3 2 0 0 2 0 4;}
@font-face
{font-family:"Malgun Gothic";}
/* 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.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Malgun Gothic";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Malgun Gothic";
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Malgun Gothic";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@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=MsoNormal><span \
lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I’m \
using qemu-6.2.0. using gdb, after I executed ‘msr ttbr1_el1, x1’ (when \
x1 = 0x80737000), when I examine TTBR1_EL1 register by ‘info reg \
TTBR1_EL1’, the value is 0. Is it gdb problem? Or qemu \
problem?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Chan \
Kim<o:p></o:p></span></p><p class=MsoNormal><span \
lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid \
#E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal align=left \
style='text-align:left;text-autospace:ideograph-numeric \
ideograph-other;word-break:keep-all'><b><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span \
lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Chan Kim \
<ckim@etri.re.kr> <br><b>Sent:</b> Wednesday, February 23, 2022 6:45 \
PM<br><b>To:</b> 'qemu-discuss@nongnu.org' \
<qemu-discuss@nongnu.org><br><b>Subject:</b> RE: read_sysreg(TTBR_EL2) not work \
in linux, but read_sysreg(CurrentEL) works. \
(arm64)<o:p></o:p></span></p></div></div><p class=MsoNormal align=left \
style='text-align:left'><span lang=EN-US><o:p> </o:p></span></p><p \
class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span \
lang=EN-US>I used an old kernel (5.4.21) and I missed during the kernel build, the \
compiler complained that<o:p></o:p></span></p><p class=MsoNormal>“<span \
lang=EN-US>selected processor does not support system register name \
</span>‘<span lang=EN-US>ttbr1_el2</span>’”<span lang=EN-US>. \
<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>So this reading of \
ttbr1_el2 seemed to have been ignored.<o:p></o:p></span></p><p class=MsoNormal><span \
lang=EN-US>Switching to kernel 5.10.0rc, this error is not \
coming.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Thank \
you.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Chan \
Kim<o:p></o:p></span></p><p class=MsoNormal><span \
lang=EN-US><o:p> </o:p></span></p><div><div style='border:none;border-top:solid \
#E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal align=left \
style='text-align:left;text-autospace:ideograph-other;word-break:keep-all'><b><span \
lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span \
lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Chan Kim <<a \
href="mailto:ckim@etri.re.kr">ckim@etri.re.kr</a>> <br><b>Sent:</b> Tuesday, \
February 22, 2022 3:15 PM<br><b>To:</b> 'qemu-discuss@nongnu.org' <<a \
href="mailto:qemu-discuss@nongnu.org">qemu-discuss@nongnu.org</a>><br><b>Subject:</b> \
read_sysreg(TTBR_EL2) not work in linux, but read_sysreg(CurrentEL) works. \
(arm64)<o:p></o:p></span></p></div></div><p class=MsoNormal align=left \
style='text-align:left'><span lang=EN-US><o:p> </o:p></span></p><p \
class=MsoNormal><span lang=EN-US>When running u-boot starting linux on qemu and using \
gdb to debug the program, (on a modified arm64 virt machine),<o:p></o:p></span></p><p \
class=MsoNormal><span lang=EN-US>I see this strange things.<o:p></o:p></span></p><p \
class=MsoNormal><span lang=EN-US>Right after I enter linux start_kernel( ), I added \
these two lines,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>datax = \
read_sysreg(CurrentEL); -- line 1<o:p></o:p></span></p><p \
class=MsoNormal><span lang=EN-US>datax = read_sysreg(TTBR1_EL2); -- \
line 2<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>after line 1 and \
before line 2, the value of datax is seen as 8. (bit [3:2] is current EL, so it's \
EL2). <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>after line 2, \
the value of datax is still 8, but the result of `info reg TTBR1_EL2` is \
0x8065a000.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>The disassembled \
assembly code shows no reading of TTBR1_EL2 register.<o:p></o:p></span></p><p \
class=MsoNormal><span lang=EN-US>How can this happen? Should I set something in the \
kernel configuration?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Any \
help will be really appreciated.<o:p></o:p></span></p><p class=MsoNormal><span \
lang=EN-US>Thank you!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Chan \
Kim<o:p></o:p></span></p></div></body></html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic