From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkJNY-0001aZ-PP for qemu-devel@nongnu.org; Tue, 13 May 2014 16:32:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkJNR-0007Fh-7I for qemu-devel@nongnu.org; Tue, 13 May 2014 16:32:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkJNQ-0007F8-Ta for qemu-devel@nongnu.org; Tue, 13 May 2014 16:32:41 -0400 Message-ID: <53728164.8090007@redhat.com> Date: Tue, 13 May 2014 22:32:36 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1400005030-20729-1-git-send-email-somlo@cmu.edu> <1400005030-20729-2-git-send-email-somlo@cmu.edu> <53727C09.1010208@redhat.com> <20140513202115.GO30030@ERROL.INI.CMU.EDU> In-Reply-To: <20140513202115.GO30030@ERROL.INI.CMU.EDU> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/2] SMBIOS: Fix endian-ness when populating fields wider than 8-bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gabriel L. Somlo" , Paolo Bonzini Cc: qemu-devel@nongnu.org, kraxel@redhat.com On 05/13/14 22:21, Gabriel L. Somlo wrote: > On Tue, May 13, 2014 at 10:09:45PM +0200, Paolo Bonzini wrote: >> Il 13/05/2014 20:17, Gabriel L. Somlo ha scritto: >>> - t->processor_id[0] =3D smbios_cpuid_version; >>> - t->processor_id[1] =3D smbios_cpuid_features; >>> + t->processor_id[0] =3D smbios_cpuid_version; /* opaque, no cpu_t= o_le16 */ >>> + t->processor_id[1] =3D smbios_cpuid_features; /* opaque, no cpu_= to_le16 */ >> >> Actually I think these should be subject to cpu_to_le32. They >> correspond to CPUID values, so they are little-endian 32-bit. >=20 > Right, my comment is wrong, should be "no need for cpu_to_le32()" inste= ad > of what I said ("no need for cpu_to_le16()")... :) >=20 > Re. why I said "opaque, no need for endianness fix" is because they're > a straight-through assignment from cpu->env.cpuid_version and=20 > cpu->env.features[FEAT_1_EDX], respectively. So they're not really > "numbers" which need endianness adjustment. >=20 > Did I get that wrong ? (I mean, besides the 16 vs. 32 in the comment) ? See 7.5.3.1 "x86-Class CPUs" in the spec. > For x86 class CPUs, the field=92s format depends on the processor=92s > support of the CPUID instruction. If the instruction is supported, > the Processor ID field contains two DWORD-formatted values. The first > (offsets 08h-0Bh) is the EAX value returned by a CPUID instruction > with input EAX set to 1; the second (offsets 0Ch-0Fh) is the EDX > value returned by that instruction. I'm inclined to think that Paolo's right. Laszlo