Received: by 10.223.185.111 with SMTP id b44csp652959wrg; Fri, 9 Mar 2018 11:03:38 -0800 (PST) X-Google-Smtp-Source: AG47ELtmfGRa1poKUQ+7FI95frUR5ZA0PpnnCoiYFzIoUGku5fZ1ElkXz/ZQiK/SepPuNyRcI1zy X-Received: by 10.98.62.196 with SMTP id y65mr30831981pfj.24.1520622218331; Fri, 09 Mar 2018 11:03:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520622218; cv=none; d=google.com; s=arc-20160816; b=dpc3XhLLkIdDTV+qGaxk2EWlCQu6crd7yniVazgFPuuCnUHGG1NrcBatOeRE1E/zjI 9mC99aBnq05u1mYjj5Esdv+Qoh/lHkkWrZB99FihlPiTfKDNscNjWpUgXoM22UrBT7i6 JEN3uuUB/fM2TsurxhtOXz0/Hq/IcBkvW2sq4l6R9AtND/VhnkbKPgV4o1zE8x/2U1Wn SZI1HhCbcVWrNvm07ymF3jQtKnbELX9/QItSXkIl+N2d1VuNcr0gUgussRg2L0vVlJ9J Ovo4uUSy7Ys2z9vOeAFgpifN3Rl2GOtyCK8wNio6NGVCoUagZMXKJj5V9M1Oftcxj+5+ R9NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dmarc-filter:arc-authentication-results; bh=0NYMjH4nCGTq317xWrv/pld25H4XMyBCDKK0Cxm0HOY=; b=uzyLGGpH9VawZYXud0nC+F4rB+TZOktbEnnTjXoJxrrCYD94zrfK/EfliN1hIq456s CZ4KhkbNg+RMlJa0L9Hd0z/G3tRZ71zDNXcj6d4m65ajB0fol9DzMW6pM8zT1nmFVI5Q 7zHI1NfJqGM61YrYiXwvrBMdI7rA9wvBpCuuNpBdhF2vM+QBWDZ0pA5RxkcsaTejeAv5 RqrXYd7V1SpCBGRuamDkWOfuIuppqe31eKIC6fmog4shwvSq0ughIGhNjxcUDfzEB9hL SX9bpTjQdWCfZ3DPL3/fPwcuKtRuQGnFCRxj0ViyBI6xsCeM1g6u7j55xGRJ2nRe/OxH RgUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1-v6si1347442plk.597.2018.03.09.11.03.23; Fri, 09 Mar 2018 11:03:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932875AbeCITBH (ORCPT + 99 others); Fri, 9 Mar 2018 14:01:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:41206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932074AbeCITBG (ORCPT ); Fri, 9 Mar 2018 14:01:06 -0500 Received: from localhost (unknown [104.132.51.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 836B82133D; Fri, 9 Mar 2018 19:01:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 836B82133D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Subject: [PATCH v2 13/13] PCI/portdrv: Rename and reverse sense of pcie_ports_auto From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Keith Busch , Sinan Kaya , Lukas Wunner , Frederick Lawler Date: Fri, 09 Mar 2018 13:01:05 -0600 Message-ID: <152062205984.77693.16740685304948811604.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152062141493.77693.9630397416694091342.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152062141493.77693.9630397416694091342.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas The platform may restrict the OS's use of PCIe services, e.g., via the ACPI _OSC method. The user may use "pcie_ports=native" to force the port driver to use PCIe services even if the platform asked us not to. The "pcie_ports=native" parameter determines the setting of pcie_ports_auto. Rename this to pcie_ports_native and reverse the sense to simplify the code. Signed-off-by: Bjorn Helgaas --- drivers/pci/pcie/portdrv.h | 2 +- drivers/pci/pcie/portdrv_core.c | 15 ++++----------- drivers/pci/pcie/portdrv_pci.c | 10 +++++----- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 62e28b5afa51..3e0058a5500f 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h @@ -12,7 +12,7 @@ #include -extern bool pcie_ports_auto; +extern bool pcie_ports_native; /* Service Type */ #define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index ed24a407518a..a1f838f2646a 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -193,17 +193,10 @@ static int pcie_init_service_irqs(struct pci_dev *dev, int *irqs, int mask) static int get_port_device_capability(struct pci_dev *dev) { struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); - bool native; int services = 0; - /* - * If the user specified "pcie_ports=native", use the PCIe services - * regardless of whether the platform has given us permission. On - * ACPI systems, this means we ignore _OSC. - */ - native = !pcie_ports_auto; - - if (dev->is_hotplug_bridge && (native || host->use_hotplug)) { + if (dev->is_hotplug_bridge && + (pcie_ports_native || host->use_hotplug)) { services |= PCIE_PORT_SERVICE_HP; /* @@ -215,7 +208,7 @@ static int get_port_device_capability(struct pci_dev *dev) } if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR) && - pci_aer_available() && (native || host->use_aer)) { + pci_aer_available() && (pcie_ports_native || host->use_aer)) { services |= PCIE_PORT_SERVICE_AER; /* @@ -231,7 +224,7 @@ static int get_port_device_capability(struct pci_dev *dev) * those yet. */ if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT && - (native || host->use_pme)) { + (pcie_ports_native || host->use_pme)) { services |= PCIE_PORT_SERVICE_PME; /* diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 8b62192342ac..569fd636b3c4 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -25,18 +25,18 @@ bool pcie_ports_disabled; /* - * If this switch is set, ACPI _OSC will be used to determine whether or not to - * enable PCIe port native services. + * If the user specified "pcie_ports=native", use the PCIe services regardless + * of whether the platform has given us permission. On ACPI systems, this + * means we ignore _OSC. */ -bool pcie_ports_auto = true; +bool pcie_ports_native; static int __init pcie_port_setup(char *str) { if (!strncmp(str, "compat", 6)) { pcie_ports_disabled = true; } else if (!strncmp(str, "native", 6)) { - pcie_ports_disabled = false; - pcie_ports_auto = false; + pcie_ports_native = true; } return 1;