On Tue, 20 Jan 2015 15:05:32 -0800 David Daney <ddaney.cavm@xxxxxxxxx> wrote: > On 01/19/2015 01:02 AM, Joshua Kinard wrote: > > From: Joshua Kinard <kumba@xxxxxxxxxx> > > > > This is a small patch to display the CPU byteorder that the kernel was compiled > > with in /proc/cpuinfo. > > What would use this? Or in other words, why is this needed? If you run some test software (e.g. in particular benchmarking software) on a linux system then you are interisting in a log file with system information. It's very likely that your log file keeps /proc/cpuinfo content. So if your /proc/cpuinfo has byteorder information then your have system byteorder information in your log file for free :) If you write a bugreport and your attach /proc/cpuinfo content to it then a bugreport reader have no question on byteorder. > > Userspace C code doesn't need this as it has its own standard ways of > determining endianness. > > If you need to know as a user you can do: > > readelf -h /bin/sh | grep Data | cut -d, -f2 Does this line really show your current CPU byteorder? IMHO this 'readelf' method is not very reliable :) > > > > > > Signed-off-by: Joshua Kinard <kumba@xxxxxxxxxx> > > --- > > arch/mips/kernel/proc.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > This patch has been submitted several times prior over the years (I think), but > > I don't recall what, if any, objections there were to it. > > > > linux-mips-proc-cpuinfo-byteorder.patch > > diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c > > index 097fc8d..75e6a62 100644 > > --- a/arch/mips/kernel/proc.c > > +++ b/arch/mips/kernel/proc.c > > @@ -65,6 +65,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) > > seq_printf(m, "BogoMIPS\t\t: %u.%02u\n", > > cpu_data[n].udelay_val / (500000/HZ), > > (cpu_data[n].udelay_val / (5000/HZ)) % 100); > > +#ifdef __MIPSEB__ > > + seq_printf(m, "byteorder\t\t: big endian\n"); > > +#else > > + seq_printf(m, "byteorder\t\t: little endian\n"); > > +#endif > > seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no"); > > seq_printf(m, "microsecond timers\t: %s\n", > > cpu_has_counter ? "yes" : "no"); > > > > > > > > -- -- Best regards, Antony Pavlov