From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966004AbcBDTIW (ORCPT ); Thu, 4 Feb 2016 14:08:22 -0500 Received: from mga03.intel.com ([134.134.136.65]:1658 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965225AbcBDTIV (ORCPT ); Thu, 4 Feb 2016 14:08:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,396,1449561600"; d="scan'208";a="908678482" Date: Thu, 4 Feb 2016 11:07:57 -0800 From: "Luck, Tony" To: Borislav Petkov Cc: Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Andy Lutomirski , Peter Zijlstra , Steven Rostedt , Brian Gerst , lkml Subject: Re: [PATCH -v2] x86: Add an archinfo dumper module Message-ID: <20160204190757.GA4249@agluck-desk.sc.intel.com> References: <20160201115601.GD6438@pd.tnic> <3908561D78D1C84285E8C5FCA982C28F39FCE0E4@ORSMSX114.amr.corp.intel.com> <20160202094147.GA3778@pd.tnic> <20160203104823.GA21257@gmail.com> <20160203110052.GA20682@pd.tnic> <20160204152235.GB5343@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160204152235.GB5343@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2016 at 04:22:35PM +0100, Borislav Petkov wrote: > Here's v2 with the stuff we talked about, implemented. I've added > 'control_regs' file too so that you can do: > > $ cat /sys/kernel/debug/x86/archinfo/control_regs > CR4: [-|-|SMEP|OSXSAVE|-|-|-|-|OSXMMEXCPT|OSFXSR|-|PGE|MCE|PAE|PSE|-|-|-|-]: 0x1406f0 > > for example. Yeah, only CR4 right now. > > Off the top of my head, we would need "msrs" which dumps EFER and a > bunch of other interesting MSRs along with the names of the set bits. It would be nce to have some helper function that makes it easier for people to add new registers to this that just uses one string to describe the format of a register. E.g. if we have a register like this: 63 63 62 11 10 9 8 5 4 2 1 0 +-----+------+-----+------+-----+-----+ | VAL | rsvd | BAZ | rsvd | BAR | FOO | +-----+------+-----+------+-----+-----+ BAZ bits mean: 00 - nope 01 - low 10 - mid 11 - high we could describe it with: "1fVAL|52r|2[nope,low,mid,high]BAZ|4r|3xBAR|2dFOO" syntax is where width is the number of bits. Format is one of: f - flag - print the name if the field is non-zero, else print nothing (or "-" to match the format you used above for CR4) r - reserved - skip this field d - print name=%d x - print name=0x%x [str0,str1,...str{2^width - 1}] - print NAME=str[val] -Tony