Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4734575rwb; Tue, 8 Aug 2023 13:00:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDEV/2uO8oKPhlpbe7R8BE6J2rBdU6D1+wBtQs4hR959POXk+LD57us978nwhv0SymLqiw X-Received: by 2002:a05:6a20:3d94:b0:133:71e4:c172 with SMTP id s20-20020a056a203d9400b0013371e4c172mr696000pzi.15.1691524844996; Tue, 08 Aug 2023 13:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524844; cv=none; d=google.com; s=arc-20160816; b=UcpSmt4ptyveabqzTTBTkOgKzcXQnS1vUKZRZERhZV3PtYHMDOzp1mL35obeHIJU/1 r971BlYtD0OVxOX4u6j7Dj3rsmSuoj3K54x/ovCqK18Kr306+/6/jwQYDhRV+5W1UcsD zkE6l23sx3Wh7IHmZbrIie7L1ZEkqTJOq0uxomWrtA1EGMdGoGmorNpgiUrCZTJUlsQ2 ol5YZ2HJ+UVhdoCf2LXi+YHoO9ROyJPWyV2MDwe+P/jPOGnk1BE0tXJaVVp2LvNzlO2n Dh+pM5EH4gtrMxoZylozJp/yUWRdMLs6ARQQHMfKRTILK/kWzdWR7HC13YzECuN5df+W MRNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=RkJI8Y6HRghWhNwNZajIKQu9T/BJ8hk9lW6mSkzl3n8=; fh=INZTcYyG821X388rCKVRzVWOG3tLtT5qv9bpHaFTHXg=; b=QkLGasB34C5NACgd3ZPmB+updYnpk40FGugrEY9Sp/lai6pqkXyqJJQ/ecf6VCCmqB 3NdUxJxPplyToTUXABaSHyj1Stb8VzKNMTS2rlVYsFRuhH0itnd06oa9TjUVdNAJDkhK 2UDKlA98PZcRb48fmU3fsrsDip+OQyZ8slDBCObtDB7GE0Vb/+zNeodfmo9sVSscHtj5 i/32Vs6Y3oi4YYg1XJEzJ6xiMrWq/leaKxOEC2l5hdnyWCrn4BOFSw4ujndBhAfBAr8v jJDgWyPfAFo0yYSGQgkMzUmeBMd2n6DR5G5HHY/hlUUpnp7L4OU2sH/0+IpYnAiPAsCQ ZCUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YSq3jPRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63f20a000000b0056514d0595fsi1722548pgh.296.2023.08.08.13.00.17; Tue, 08 Aug 2023 13:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YSq3jPRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbjHHSqR (ORCPT + 99 others); Tue, 8 Aug 2023 14:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233345AbjHHSpv (ORCPT ); Tue, 8 Aug 2023 14:45:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DC5C114C80; Tue, 8 Aug 2023 09:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691513262; x=1723049262; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ZGQhFZrF5RIdE2djNSnL4b7aQ9MR+Cp9ivABVtqJuY4=; b=YSq3jPRWQzJqTajAFSNohNGdpaHmHf+fl8G90GJq4VKrEK9gMn87aP0P SDJaaC6JX2YfGaTVlXKtYEHgrD1AyuIUpqN9sg5S+NzAtyUUAZktM1gRc l2HIim+P2EU8x9EZguYA5HElD+zOaeQ3etv0pEIt2ysZPd5BDyylafGtX iLEwYTlPWqlZkx4Berh+wO6Ow9/hRB7ZyKOZZ9KvfYkZlqAeDOsLUJjIL xQGAU2V1eF+AMEm59oZgoIAvertq9s3lQoHp4kuTvqcxOXiYsnfe0roLQ zmgccg/YhJHYGcBNosUaoGEDYCLDMCkgWy5V/LVrQJxdnqJ0HjsSEqOI/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="369780472" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="369780472" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:47:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="734628378" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="734628378" Received: from mtofeni-mobl.ger.corp.intel.com ([10.252.48.21]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:47:10 -0700 Date: Tue, 8 Aug 2023 19:47:08 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: "Maciej W. Rozycki" cc: Bjorn Helgaas , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] PCI: Export pci_parent_bus_reset() for drivers to use In-Reply-To: Message-ID: <6ddfb7a-2a83-cb84-ad73-9bd985652858@linux.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Jun 2023, Maciej W. Rozycki wrote: > Export pci_parent_bus_reset() so that drivers do not duplicate it. > Document the interface. > > Signed-off-by: Maciej W. Rozycki > --- > drivers/pci/pci.c | 15 ++++++++++++++- > include/linux/pci.h | 1 + > 2 files changed, 15 insertions(+), 1 deletion(-) > > linux-pci-parent-bus-reset-export.diff > Index: linux-macro/drivers/pci/pci.c > =================================================================== > --- linux-macro.orig/drivers/pci/pci.c > +++ linux-macro/drivers/pci/pci.c > @@ -5149,7 +5149,19 @@ int pci_bridge_secondary_bus_reset(struc > } > EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset); > > -static int pci_parent_bus_reset(struct pci_dev *dev, bool probe) > +/** > + * pci_parent_bus_reset - Reset a device via its upstream PCI bridge > + * @dev: Device to reset. > + * @probe: Only check if reset is possible if TRUE, actually reset if FALSE. > + * > + * Perform a device reset by requesting a secondary bus reset via the > + * device's immediate upstream PCI bridge. > Return 0 if successful or Kernel doc has Return: section for return values. > + * -ENOTTY if the reset failed or it could not have been issued in the > + * first place because the device is not on a secondary bus of any PCI > + * bridge or it wouldn't be the only device reset. If probing, then > + * only verify whether it would be possible to issue a reset. I guess most of the in-depth explanation about reasons why reset might not me issuable could go into the longer description block. -- i. > + */ > +int pci_parent_bus_reset(struct pci_dev *dev, bool probe) > { > struct pci_dev *pdev; > > @@ -5166,6 +5178,7 @@ static int pci_parent_bus_reset(struct p > > return pci_bridge_secondary_bus_reset(dev->bus->self); > } > +EXPORT_SYMBOL_GPL(pci_parent_bus_reset); > > static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, bool probe) > { > Index: linux-macro/include/linux/pci.h > =================================================================== > --- linux-macro.orig/include/linux/pci.h > +++ linux-macro/include/linux/pci.h > @@ -1447,6 +1447,7 @@ int devm_request_pci_bus_resources(struc > > /* Temporary until new and working PCI SBR API in place */ > int pci_bridge_secondary_bus_reset(struct pci_dev *dev); > +int pci_parent_bus_reset(struct pci_dev *dev, bool probe); > > #define __pci_bus_for_each_res0(bus, res, ...) \ > for (unsigned int __b = 0; \ >