OSDN Git Service

EDAC/amd64: Gather hardware information early
authorYazen Ghannam <yazen.ghannam@amd.com>
Tue, 22 Oct 2019 20:35:10 +0000 (20:35 +0000)
committerBorislav Petkov <bp@suse.de>
Wed, 6 Nov 2019 10:04:49 +0000 (11:04 +0100)
commit80355a3b2db9d0b713af5169e2cdd7f8fbfdad82
tree3951df862903a2406823d28a459e52015ac0c5cc
parent38ddd4d1574530e1447b6ad91d27225d0f7662fb
EDAC/amd64: Gather hardware information early

Split out gathering hardware information from init_one_instance()
into a separate function hw_info_get(). This is necessary so that
the information can be cached earlier and used to check if memory is
populated and if ECC is enabled on a node.

Also, define a function hw_info_put() to back out changes made in
hw_info_get().

Check for an allocated PCI device (Function 0 for Family 17h or Function
1 for pre-Family 17h) before freeing, since hw_info_put() may be called
before PCI siblings are reserved.

Drop the family check when freeing pvt->umc. This will be NULL on
pre-Family 17h systems. However, kfree() is safe and will check for a
NULL pointer before freeing.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20191106012448.243970-3-Yazen.Ghannam@amd.com
drivers/edac/amd64_edac.c