Commit 772c3ff3 authored by Daniel J Blueman's avatar Daniel J Blueman Committed by Borislav Petkov

x86, AMD, NB: Add multi-domain support

Fix get_node_id to match northbridge IDs from the array of detected
ones, allowing multi-server support such as with Numascale's
NumaConnect, renaming to 'amd_get_node_id' for consistency.
Signed-off-by: default avatarDaniel J Blueman <daniel@numascale-asia.com>
Link: http://lkml.kernel.org/r/1353997932-8475-1-git-send-email-daniel@numascale-asia.com
[Boris: shorten lines to fit 80 cols]
Signed-off-by: default avatarBorislav Petkov <bp@alien8.de>
parent 9931faca
...@@ -81,6 +81,23 @@ static inline struct amd_northbridge *node_to_amd_nb(int node) ...@@ -81,6 +81,23 @@ static inline struct amd_northbridge *node_to_amd_nb(int node)
return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL; return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
} }
static inline u16 amd_get_node_id(struct pci_dev *pdev)
{
struct pci_dev *misc;
int i;
for (i = 0; i != amd_nb_num(); i++) {
misc = node_to_amd_nb(i)->misc;
if (pci_domain_nr(misc->bus) == pci_domain_nr(pdev->bus) &&
PCI_SLOT(misc->devfn) == PCI_SLOT(pdev->devfn))
return i;
}
WARN(1, "Unable to find AMD Northbridge id for %s\n", pci_name(pdev));
return 0;
}
#else #else
#define amd_nb_num(x) 0 #define amd_nb_num(x) 0
......
...@@ -2474,7 +2474,7 @@ static int amd64_init_one_instance(struct pci_dev *F2) ...@@ -2474,7 +2474,7 @@ static int amd64_init_one_instance(struct pci_dev *F2)
struct mem_ctl_info *mci = NULL; struct mem_ctl_info *mci = NULL;
struct edac_mc_layer layers[2]; struct edac_mc_layer layers[2];
int err = 0, ret; int err = 0, ret;
u8 nid = get_node_id(F2); u16 nid = amd_get_node_id(F2);
ret = -ENOMEM; ret = -ENOMEM;
pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL); pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL);
...@@ -2566,7 +2566,7 @@ static int amd64_init_one_instance(struct pci_dev *F2) ...@@ -2566,7 +2566,7 @@ static int amd64_init_one_instance(struct pci_dev *F2)
static int amd64_probe_one_instance(struct pci_dev *pdev, static int amd64_probe_one_instance(struct pci_dev *pdev,
const struct pci_device_id *mc_type) const struct pci_device_id *mc_type)
{ {
u8 nid = get_node_id(pdev); u16 nid = amd_get_node_id(pdev);
struct pci_dev *F3 = node_to_amd_nb(nid)->misc; struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
struct ecc_settings *s; struct ecc_settings *s;
int ret = 0; int ret = 0;
...@@ -2616,7 +2616,7 @@ static void amd64_remove_one_instance(struct pci_dev *pdev) ...@@ -2616,7 +2616,7 @@ static void amd64_remove_one_instance(struct pci_dev *pdev)
{ {
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
struct amd64_pvt *pvt; struct amd64_pvt *pvt;
u8 nid = get_node_id(pdev); u16 nid = amd_get_node_id(pdev);
struct pci_dev *F3 = node_to_amd_nb(nid)->misc; struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
struct ecc_settings *s = ecc_stngs[nid]; struct ecc_settings *s = ecc_stngs[nid];
......
...@@ -292,12 +292,6 @@ ...@@ -292,12 +292,6 @@
/* MSRs */ /* MSRs */
#define MSR_MCGCTL_NBE BIT(4) #define MSR_MCGCTL_NBE BIT(4)
/* AMD sets the first MC device at device ID 0x18. */
static inline u8 get_node_id(struct pci_dev *pdev)
{
return PCI_SLOT(pdev->devfn) - 0x18;
}
enum amd_families { enum amd_families {
K8_CPUS = 0, K8_CPUS = 0,
F10_CPUS, F10_CPUS,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment