Linux EDAC development
 help / color / mirror / Atom feed
* [2/3] EDAC, pnd2: Conditionally unhide/hide the P2SB PCI device to read BAR.
@ 2017-08-14 15:48 Qiuxu Zhuo
  0 siblings, 0 replies; 3+ messages in thread
From: Qiuxu Zhuo @ 2017-08-14 15:48 UTC (permalink / raw)
  To: bp, mchehab; +Cc: tony.luck, arozansk, patrickg, linux-edac, Qiuxu Zhuo

On Deverton server, the P2SB PCI device(DEV:1F, FUN:1) is used by multiple
device drivers, if it's hidden by some device driver(e.g. i801 I2C driver,
the commit <942469303> unconditionally hides the P2SB PCI device wrongly)
it will make the pnd2_edac driver read out an invalid BAR value 0xffffffff
and then fail on 'ioremap()'.

Therefor, store the presence state of P2SB PCI device before unhiding
it for reading BAR and restore the presence state after reading BAR.

Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 drivers/edac/pnd2_edac.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 2b16b95..89cdd9a 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -236,12 +236,23 @@ static u64 get_sideband_reg_base_addr(void)
 {
 	struct pci_dev *pdev;
 	u32 hi, lo;
+	u8 hidden;
 
 	pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x19dd, NULL);
 	if (pdev) {
+		/* Unhide the P2SB device, if it's hidden */
+		pci_read_config_byte(pdev, 0xe1, &hidden);
+		if (hidden)
+			pci_write_config_byte(pdev, 0xe1, 0);
+
 		pci_read_config_dword(pdev, 0x10, &lo);
 		pci_read_config_dword(pdev, 0x14, &hi);
 		lo &= 0xfffffff0;
+
+		/* Hide the P2SB device, if it was hidden before */
+		if (hidden)
+			pci_write_config_byte(pdev, 0xe1, hidden);
+
 		pci_dev_put(pdev);
 		return (U64_LSHIFT(hi, 32) | U64_LSHIFT(lo, 0));
 	} else {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [2/3] EDAC, pnd2: Conditionally unhide/hide the P2SB PCI device to read BAR.
@ 2017-08-19  8:53 Borislav Petkov
  0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2017-08-19  8:53 UTC (permalink / raw)
  To: Qiuxu Zhuo; +Cc: mchehab, tony.luck, arozansk, patrickg, linux-edac

On Mon, Aug 14, 2017 at 11:48:45PM +0800, Qiuxu Zhuo wrote:
> On Deverton server, the P2SB PCI device(DEV:1F, FUN:1) is used by multiple
> device drivers, if it's hidden by some device driver(e.g. i801 I2C driver,
> the commit <942469303> unconditionally hides the P2SB PCI device wrongly)

This is not how we quote commits in commit messages. Rather like this:

  9424693035a5 ("i2c: i801: Create iTCO device on newer Intel PCHs")

You can add

[alias]
        one = show -s --pretty='format:%h (\"%s\")'

to your .gitconfig so that when you do:

$ git one 9424693035a5

you get the proper format. You'll also need

[core]
        abbrev = 12

so that the commit hash is abbreviated to 12 chars.

I fixed it up now but pls do it properly next time.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [2/3] EDAC, pnd2: Conditionally unhide/hide the P2SB PCI device to read BAR.
@ 2017-08-20  2:18 Qiuxu Zhuo
  0 siblings, 0 replies; 3+ messages in thread
From: Qiuxu Zhuo @ 2017-08-20  2:18 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: mchehab@osg.samsung.com, Luck, Tony, arozansk@redhat.com,
	patrickg@supermicro.com, linux-edac@vger.kernel.org

PiBGcm9tOiBsaW51eC1lZGFjLW93bmVyQHZnZXIua2VybmVsLm9yZyBbbWFpbHRvOmxpbnV4LWVk
YWMtDQouLi4NCj4gVGhpcyBpcyBub3QgaG93IHdlIHF1b3RlIGNvbW1pdHMgaW4gY29tbWl0IG1l
c3NhZ2VzLiBSYXRoZXIgbGlrZSB0aGlzOg0KPiANCj4gICA5NDI0NjkzMDM1YTUgKCJpMmM6IGk4
MDE6IENyZWF0ZSBpVENPIGRldmljZSBvbiBuZXdlciBJbnRlbCBQQ0hzIikNCj4gDQo+IFlvdSBj
YW4gYWRkDQo+IA0KPiBbYWxpYXNdDQo+ICAgICAgICAgb25lID0gc2hvdyAtcyAtLXByZXR0eT0n
Zm9ybWF0OiVoIChcIiVzXCIpJw0KPiANCj4gdG8geW91ciAuZ2l0Y29uZmlnIHNvIHRoYXQgd2hl
biB5b3UgZG86DQo+IA0KPiAkIGdpdCBvbmUgOTQyNDY5MzAzNWE1DQo+IA0KPiB5b3UgZ2V0IHRo
ZSBwcm9wZXIgZm9ybWF0LiBZb3UnbGwgYWxzbyBuZWVkDQo+IA0KPiBbY29yZV0NCj4gICAgICAg
ICBhYmJyZXYgPSAxMg0KPiANCj4gc28gdGhhdCB0aGUgY29tbWl0IGhhc2ggaXMgYWJicmV2aWF0
ZWQgdG8gMTIgY2hhcnMuDQo+IA0KPiBJIGZpeGVkIGl0IHVwIG5vdyBidXQgcGxzIGRvIGl0IHBy
b3Blcmx5IG5leHQgdGltZS4NCg0KT0ssIHRoYW5rcyBCb3JpcyBmb3IgY29ycmVjdGluZyBteSBt
aXN0YWtlcy4gDQpXaWxsIGZvbGxvdyBpdCBuZXh0IHRpbWUuDQoNCi0gUWl1eHUNCg0K
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-20  2:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-19  8:53 [2/3] EDAC, pnd2: Conditionally unhide/hide the P2SB PCI device to read BAR Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2017-08-20  2:18 Qiuxu Zhuo
2017-08-14 15:48 Qiuxu Zhuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox