Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88ae80aa authored by Tony Luck's avatar Tony Luck Committed by Borislav Petkov
Browse files

EDAC, skx_edac: Handle systems with segmented PCI busses



Large systems separate their PCI busses into segments since
the limit of only 256 PCI busses can be too restrictive.

Extend this driver to check whether <segment, bus-number> matches
when deciding how to group memory controller PCI devices to
CPU sockets.

Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
Cc: Aristeu Rozanski <arozansk@redhat.com>
Cc: Charles Rose <charles.rose@dell.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/f58abfd10bf73c8bc5adc1fe4de7408128b00625.1506358467.git.tony.luck@intel.com


[ Make skx_dev.seg an int. ]
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
parent f821fe8c
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -67,6 +67,7 @@ static u64 skx_tolm, skx_tohm;
struct skx_dev {
struct skx_dev {
	struct list_head	list;
	struct list_head	list;
	u8			bus[4];
	u8			bus[4];
	int			seg;
	struct pci_dev	*sad_all;
	struct pci_dev	*sad_all;
	struct pci_dev	*util_all;
	struct pci_dev	*util_all;
	u32	mcroute;
	u32	mcroute;
@@ -112,12 +113,12 @@ struct decoded_addr {
	int	bank_group;
	int	bank_group;
};
};


static struct skx_dev *get_skx_dev(u8 bus, u8 idx)
static struct skx_dev *get_skx_dev(struct pci_bus *bus, u8 idx)
{
{
	struct skx_dev *d;
	struct skx_dev *d;


	list_for_each_entry(d, &skx_edac_list, list) {
	list_for_each_entry(d, &skx_edac_list, list) {
		if (d->bus[idx] == bus)
		if (d->seg == pci_domain_nr(bus) && d->bus[idx] == bus->number)
			return d;
			return d;
	}
	}


@@ -174,6 +175,7 @@ static int get_all_bus_mappings(void)
			pci_dev_put(pdev);
			pci_dev_put(pdev);
			return -ENOMEM;
			return -ENOMEM;
		}
		}
		d->seg = pci_domain_nr(pdev->bus);
		pci_read_config_dword(pdev, 0xCC, &reg);
		pci_read_config_dword(pdev, 0xCC, &reg);
		d->bus[0] =  GET_BITFIELD(reg, 0, 7);
		d->bus[0] =  GET_BITFIELD(reg, 0, 7);
		d->bus[1] =  GET_BITFIELD(reg, 8, 15);
		d->bus[1] =  GET_BITFIELD(reg, 8, 15);
@@ -209,7 +211,7 @@ static int get_all_munits(const struct munit *m)
			if (i == NUM_IMC)
			if (i == NUM_IMC)
				goto fail;
				goto fail;
		}
		}
		d = get_skx_dev(pdev->bus->number, m->busidx);
		d = get_skx_dev(pdev->bus, m->busidx);
		if (!d)
		if (!d)
			goto fail;
			goto fail;