linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kuppuswamy, Sathyanarayanan"  <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, ashok.raj@intel.com,
	knsathya@kernel.org
Subject: Re: [PATCH v11 2/5] ACPI/PCI: Ignore _OSC negotiation result if pcie_ports_native is set.
Date: Wed, 25 Nov 2020 16:58:28 -0800	[thread overview]
Message-ID: <59eaec1e-d857-9122-8658-29ec3b62294e@linux.intel.com> (raw)
In-Reply-To: <20201125202810.GA674732@bjorn-Precision-5520>



On 11/25/20 12:28 PM, Bjorn Helgaas wrote:
> On Mon, Oct 26, 2020 at 07:57:05PM -0700, Kuppuswamy Sathyanarayanan wrote:
>> pcie_ports_native is set only if user requests native handling
>> of PCIe capabilities via pcie_port_setup command line option.
>> User input takes precedence over _OSC based control negotiation
>> result. So consider the _OSC negotiated result only if
>> pcie_ports_native is unset.
>>
>> Also, since struct pci_host_bridge ->native_* members caches the
>> ownership status of various PCIe capabilities, use them instead
>> of distributed checks for pcie_ports_native.
> 
>> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
>> index 50a9522ab07d..ccd5e0ce5605 100644
>> --- a/drivers/pci/pcie/portdrv_core.c
>> +++ b/drivers/pci/pcie/portdrv_core.c
>> @@ -208,8 +208,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>>   	struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
>>   	int services = 0;
>>   
>> -	if (dev->is_hotplug_bridge &&
>> -	    (pcie_ports_native || host->native_pcie_hotplug)) {
>> +	if (dev->is_hotplug_bridge && host->native_pcie_hotplug) {
> 
> This is a nit, but I think this and similar checks should be reordered
> so we do the most generic test first, i.e.,
> 
>    if (host->native_pcie_hotplug && dev->is_hotplug_bridge)
ok. I can add this fix on top of your update.
> 
> Logically there's no point in looking at the device things if we
> don't have native control.
> 
>>   		services |= PCIE_PORT_SERVICE_HP;
>>   
>>   		/*
>> @@ -221,8 +220,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>>   	}
>>   
>>   #ifdef CONFIG_PCIEAER
>> -	if (dev->aer_cap && pci_aer_available() &&
>> -	    (pcie_ports_native || host->native_aer)) {
>> +	if (dev->aer_cap && pci_aer_available() && host->native_aer) {
> 
> Can't we clear host->native_aer when pci_aer_available() returns
> false?  I'd like to have all the checks about whether we have native
> control to be in one place instead of being scattered.  Something like
> this above:
> 
>    OSC_OWNER(ctrl, OSC_PCI_EXPRESS_AER_CONTROL, host_bridge->native_aer);
>    if (!pci_aer_available())
>      host_bridge->native_aer = 0;
> 
> So this test would become:
> 
>    if (host->native_aer && dev->aer_cap)
We already use it in pci_root.c to confirm AER availability before
we request control over it via _OSC. So if pci_aer_available() is false
OSC_*AER_CONTROL bit in ctrl_set will be left zero (which means
->native_aer will also be zero).

490         if (pci_aer_available())
491                 control |= OSC_PCI_EXPRESS_AER_CONTROL;

So, may we don't need pci_aer_available() check here.

> 
>>   		services |= PCIE_PORT_SERVICE_AER;
>>   
>>   		/*
>> @@ -238,8 +236,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>>   	 * Event Collectors can also generate PMEs, but we don't handle
>>   	 * those yet.
>>   	 */
>> -	if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT &&
>> -	    (pcie_ports_native || host->native_pme)) {
>> +	if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT && host->native_pme) {
>>   		services |= PCIE_PORT_SERVICE_PME;
> 
> Also here:
> 
>    if (host->native_pme && pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
> 

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

  reply	other threads:[~2020-11-26  0:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  2:57 [PATCH v11 0/5] Simplify PCIe native ownership detection logic Kuppuswamy Sathyanarayanan
2020-10-27  2:57 ` [PATCH v11 1/5] PCI: Conditionally initialize host bridge native_* members Kuppuswamy Sathyanarayanan
2020-10-28  6:09   ` Ethan Zhao
2020-10-28 17:14     ` Kuppuswamy, Sathyanarayanan
2020-10-27  2:57 ` [PATCH v11 2/5] ACPI/PCI: Ignore _OSC negotiation result if pcie_ports_native is set Kuppuswamy Sathyanarayanan
2020-11-25 20:12   ` Bjorn Helgaas
2020-11-25 22:21     ` Kuppuswamy, Sathyanarayanan
2020-11-25 22:25       ` Bjorn Helgaas
2020-11-25 22:38         ` Kuppuswamy, Sathyanarayanan
2020-11-25 20:28   ` Bjorn Helgaas
2020-11-26  0:58     ` Kuppuswamy, Sathyanarayanan [this message]
2020-10-27  2:57 ` [PATCH v11 3/5] ACPI/PCI: Ignore _OSC DPC negotiation result if pcie_ports_dpc_native " Kuppuswamy Sathyanarayanan
2020-11-25 20:50   ` Bjorn Helgaas
2020-10-27  2:57 ` [PATCH v11 4/5] PCI/portdrv: Remove redundant pci_aer_available() check in DPC enable logic Kuppuswamy Sathyanarayanan
2020-10-28  6:00   ` Ethan Zhao
2020-10-28 17:13     ` Kuppuswamy, Sathyanarayanan
2020-11-02  9:59       ` Ethan Zhao
2020-10-27  2:57 ` [PATCH v11 5/5] PCI/DPC: Move AER/DPC dependency checks out of DPC driver Kuppuswamy Sathyanarayanan
2020-11-13 21:59 ` [PATCH v11 0/5] Simplify PCIe native ownership detection logic Kuppuswamy, Sathyanarayanan

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=59eaec1e-d857-9122-8658-29ec3b62294e@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=knsathya@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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).