Date: Tue, 21 Feb 2023 22:22:41 -0700 From: Warner Losh <imp@bsdimp.com> To: freebsd-arch@freebsd.org Subject: Re: making identify_hypervisor arch independent Message-ID: <CANCZdfox_xLs9c%2BmxPriWQ7qymiF%2BNHqNHk_TEtvswswav2oYg@mail.gmail.com> In-Reply-To: <20230222040556.GP95670@funkthat.com> References: <20230222040556.GP95670@funkthat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000075ba5005f5431660 Content-Type: text/plain; charset="UTF-8" On Tue, Feb 21, 2023 at 9:06 PM John-Mark Gurney <jmg@funkthat.com> wrote: > Hello, > > I have a pending diff (https://reviews.freebsd.org/D38721) that will make > SMBIOS work on arm64 systems (specifically under qemu, but likely it may > add support for other EFI arm64 systems that have SMBIOS as well). > > The goal is to support identifying that we are running as a guest under > QEMU so that we automatically switch to hz=100 on arm64. > > Currently there is code in x86/x86/identcpu.c that has code to identify > hypervisers via SMBIOS, so I'd like to move most of identify_hypervisor > to a new location so that arm64 code can call it as well. > > Where should I put it? kern/subr_identsmbios.c? And make it optional > on EFIRT for arm64 and standard on x86? > I'd do kern/subr_smbios.c. I'd be tempted to make it standard, since EFI is basically required for arm64. It's not dependent at all on efi run time support. > I briefly thought of dev/smbios, BUT, that brings up another issue, > I think we should deorbit dev/smbios, and move smbios.h to dev/ipmi, > because as far as I can tell, the device does nothing useful. It > allocates the resource, but nothing that I can find in the tree attempts > to use/access the device, and it doesn't expose any interface. The > header is only used by dev/ipmi for the structure, but not the device, > as ipmi does it's own parsing of the table. > > All of the uses of smbios data is getting it via kenv which is populated > via loader (libsa). > I'd be tempted to move all the smbios walking into subr_smbios.c. All the other smbios stuff does depend on the boot loader walking and parsing the table and setting that in the kenv... I'd almost be tempted to make those into wrappers to make it harder to misspell the string they all pass in... Even if it's just a wrapper around kenv_getenv with the right string... They are mostly used for 'quirks'. Either way, I think sys/dev/smbios likely has limited value... It would be different if it provided some way to get the raw smbios table... But as it is, I think all programs that parse it get it via /dev/mem... Warner Warner > Thanks. > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." > > --00000000000075ba5005f5431660 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Tue, Feb 21, 2023 at 9:06 PM John-= Mark Gurney <<a href=3D"mailto:jmg@funkthat.com">jmg@funkthat.com</a>>= ; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px= 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<= br> <br> I have a pending diff (<a href=3D"https://reviews.freebsd.org/D38721" rel= =3D"noreferrer" target=3D"_blank">https://reviews.freebsd.org/D38721</a>) t= hat will make<br> SMBIOS work on arm64 systems (specifically under qemu, but likely it may<br= > add support for other EFI arm64 systems that have SMBIOS as well).<br> <br> The goal is to support identifying that we are running as a guest under<br> QEMU so that we automatically switch to hz=3D100 on arm64.<br> <br> Currently there is code in x86/x86/identcpu.c that has code to identify<br> hypervisers via SMBIOS, so I'd like to move most of identify_hypervisor= <br> to a new location so that arm64 code can call it as well.<br> <br> Where should I put it?=C2=A0 kern/subr_identsmbios.c?=C2=A0 And make it opt= ional<br> on EFIRT for arm64 and standard on x86?<br></blockquote><div><br></div><div= >I'd do kern/subr_smbios.c.</div><div><br></div><div>I'd be tempted= to make it standard, since EFI is basically required for</div><div>arm64. = It's not dependent at all on efi run time support. <br></div><div>=C2= =A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e= x;border-left:1px solid rgb(204,204,204);padding-left:1ex"> I briefly thought of dev/smbios, BUT, that brings up another issue,<br> I think we should deorbit dev/smbios, and move smbios.h to dev/ipmi,<br> because as far as I can tell, the device does nothing useful.=C2=A0 It<br> allocates the resource, but nothing that I can find in the tree attempts<br= > to use/access the device, and it doesn't expose any interface.=C2=A0 Th= e<br> header is only used by dev/ipmi for the structure, but not the device,<br> as ipmi does it's own parsing of the table.<br> <br> All of the uses of smbios data is getting it via kenv which is populated<br= > via loader (libsa).<br></blockquote><div><br></div><div>I'd be tempted = to move all the smbios walking into subr_smbios.c.</div><div><br></div><div= >All the other smbios stuff does depend on the boot loader walking</div><di= v>and parsing the table and setting that in the kenv... I'd almost be t= empted</div><div>to make those into wrappers to make it harder to misspell = the string they</div><div>all pass in...=C2=A0 Even if it's just a wrap= per around kenv_getenv with the</div><div>right string... They are mostly u= sed for 'quirks'.</div><div><br></div><div>Either way, I think sys/= dev/smbios likely has limited value...=C2=A0 It would be</div><div>differen= t if it provided some way to get the raw smbios table... But as</div><div>i= t is, I think all programs that parse it get it via /dev/mem...<br></div><d= iv><br></div><div>Warner <br></div><div><br></div><div>Warner<br></div><div= >=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px = 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Thanks.<br> <br> -- <br> =C2=A0 John-Mark Gurney=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Voice: +1 415 225 5579= <br> <br> =C2=A0 =C2=A0 =C2=A0"All that I will do, has been done, All that I hav= e, has not."<br> <br> </blockquote></div></div> --00000000000075ba5005f5431660--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfox_xLs9c%2BmxPriWQ7qymiF%2BNHqNHk_TEtvswswav2oYg>