linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@hisilicon.com>
To: <helgaas@kernel.org>, <linux-pci@vger.kernel.org>
Cc: <sathyanarayanan.kuppuswamy@linux.intel.com>, <kbusch@kernel.org>,
	<sean.v.kelley@intel.com>, <qiuxu.zhuo@intel.com>,
	<prime.zeng@huawei.com>, <yangyicong@hisilicon.com>,
	<linuxarm@openeuler.org>
Subject: [PATCH] PCI/DPC: Check host->native_dpc before enable dpc service
Date: Wed, 3 Feb 2021 20:13:29 +0800	[thread overview]
Message-ID: <1612354409-14285-1-git-send-email-yangyicong@hisilicon.com> (raw)

Per PCI Firmware Specification Rev. 3.2 Table 4-6,
Interpretation of _OSC Control Field Returned Value, for
bit 7 of _OSC control return value:

  "Firmware sets this bit to 1 to grant the OS control over PCI Express
  Downstream Port Containment configuration."
  "If control of this feature was requested and denied,
  or was not requested, the firmware returns this bit set to 0."

We store bit 7 of _OSC control return value in host->native_dpc,
check it before enable the dpc service as the firmware may not
grant the control.

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/pci/pcie/portdrv_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index e1fed664..7445d03 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -253,7 +253,8 @@ static int get_port_device_capability(struct pci_dev *dev)
 	 */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
 	    pci_aer_available() &&
-	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
+	    (pcie_ports_dpc_native ||
+	    ((services & PCIE_PORT_SERVICE_AER) && host->native_dpc)))
 		services |= PCIE_PORT_SERVICE_DPC;
 
 	if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
-- 
2.8.1


             reply	other threads:[~2021-02-03 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 12:13 Yicong Yang [this message]
2021-02-03 12:42 ` [PATCH] PCI/DPC: Check host->native_dpc before enable dpc service Yicong Yang

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=1612354409-14285-1-git-send-email-yangyicong@hisilicon.com \
    --to=yangyicong@hisilicon.com \
    --cc=helgaas@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@openeuler.org \
    --cc=prime.zeng@huawei.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sean.v.kelley@intel.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;
as well as URLs for NNTP newsgroup(s).