From: yhlu <yinghailu@gmail.com>
To: Andi Kleen <ak@suse.de>
Cc: Ronald G Minnich <rminnich@lanl.gov>,
discuss@x86-64.org, linuxbios@openbios.org,
linux-kernel@vger.kernel.org, yhlu <yhlu.kernel@gmail.com>
Subject: Re: [LinuxBIOS] x86_64: apic id lift patch
Date: Wed, 23 Nov 2005 10:01:51 -0800 [thread overview]
Message-ID: <2ea3fae10511231001r47fcfa64r8afa8bd5552479d0@mail.gmail.com> (raw)
In-Reply-To: <20051123175042.GM20775@brahms.suse.de>
NB_CFG bit 54 for E0 stepping later can be set.
When it is set
the initial apic id will be
node0/core0 : 0
node0/core1 : 1
node1/core0 : 2
node1/core1 : 3
So you can shift the initial apic id to the node id, but the problem
is you need to have right cores_vir, because for single you need to
use 2 to shift instead of 1 the core num that you read from msr.
For LinuxBIOS, we go further, that we use NB_CFG bit 54 directly,
instead of check cpu version, because only E0 later can be set.
please check the code in LinuxBIOS that we are using to get node id...
YH
static inline unsigned int read_nb_cfg_54(void)
{
msr_t msr;
msr = rdmsr(NB_CFG_MSR);
return ( ( msr.hi >> (54-32)) & 1);
}
struct node_core_id {
unsigned nodeid;
unsigned coreid;
};
static inline unsigned get_initial_apicid(void)
{
return ((cpuid_ebx(1) >> 24) & 0xf);
}
static inline struct node_core_id get_node_core_id(unsigned nb_cfg_54)
{
struct node_core_id id;
// get the apicid via cpuid(1) ebx[27:24]
if( nb_cfg_54) {
// when NB_CFG[54] is set, nodid = ebx[27:25],
coreid = ebx[24]
id.coreid = (cpuid_ebx(1) >> 24) & 0xf;
id.nodeid = (id.coreid>>1);
id.coreid &= 1;
}
else
{
// when NB_CFG[54] is clear, nodeid = ebx[26:24],
coreid = ebx[27]
id.nodeid = (cpuid_ebx(1) >> 24) & 0xf;
id.coreid = (id.nodeid>>3);
id.nodeid &= 7;
}
return id;
}
static inline unsigned get_core_num(void)
{
return (cpuid_ecx(0x80000008) & 0xff);
}
static inline struct node_core_id get_node_core_id_x(void) {
return get_node_core_id( read_nb_cfg_54() ); // for pre_e0()
nb_cfg_54 always be 0
}
next prev parent reply other threads:[~2005-11-23 18:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 21:49 yhlu
2005-11-21 22:06 ` Andi Kleen
2005-11-21 22:17 ` yhlu
2005-11-21 22:24 ` Andi Kleen
2005-11-21 22:31 ` yhlu
2005-11-22 9:44 ` Andi Kleen
2005-11-23 16:58 ` [LinuxBIOS] " Ronald G Minnich
2005-11-23 17:35 ` Andi Kleen
[not found] ` <2ea3fae10511230943y5f697eb8sdbf891497fa8b88f@mail.gmail.com>
2005-11-23 17:50 ` Andi Kleen
2005-11-23 18:01 ` yhlu [this message]
2005-11-23 20:29 ` [discuss] " Andi Kleen
2005-11-23 20:29 ` Ronald G Minnich
2005-11-23 18:28 ` Stefan Reinauer
2005-11-23 20:26 ` Ronald G Minnich
[not found] ` <2ea3fae10511230919l4d9829d8j3ce5d820b74074d1@mail.gmail.com>
2005-11-23 17:36 ` Andi Kleen
2005-11-23 17:40 ` yhlu
2005-11-23 18:18 ` Stefan Reinauer
2005-11-23 18:22 ` yhlu
2005-11-23 18:35 ` yhlu
2005-11-23 20:28 ` [discuss] " Andi Kleen
2005-11-23 18:17 ` Stefan Reinauer
2005-11-23 20:23 ` Ronald G Minnich
2005-11-23 20:34 ` [discuss] " Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ea3fae10511231001r47fcfa64r8afa8bd5552479d0@mail.gmail.com \
--to=yinghailu@gmail.com \
--cc=ak@suse.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxbios@openbios.org \
--cc=rminnich@lanl.gov \
--cc=yhlu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®