All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Kyle Gale <kylewgale@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: PCI Rescan Question
Date: Thu, 27 Apr 2017 10:02:07 +0200	[thread overview]
Message-ID: <20170427080207.GA11141@wunner.de> (raw)
In-Reply-To: <CAEhpy_c96xmviS8fE4rMDeK9dPiSLhTrW_MQNtdkKXkwoU8PEg@mail.gmail.com>

On Wed, Apr 26, 2017 at 03:56:09PM -0700, Kyle Gale wrote:
> Can someone help me understand why I need to remove my stale PCI
> device files from the tree if I want to properly get my device
> re-initialized after unplugging and reinserting?
> 
> For example, I turn on my system with my PCI device plugged in. All is
> fine. I unplug it, plug it back in, and rescan (echo 1 >
> /sys/bus/pci/devices/rescan) and end up in this state where my BAR0 is
> not set, and other things are not entirely correct.
> 
> But if I do a remove (echo 1 > /sys/bus/pci/devices/xxxx/xx.x/remove)
> of the port, it then properly re-initializes my device when I do a
> rescan.
> 
> Why does it not suffice to simply do a rescan? Does the rescan skip
> some step if it finds that the device is already in the PCI tree? It's
> not as if the rescan completely skips the device if I don't do a
> remove, it just doesn't do all of the initialization.

Initiating a rescan via sysfs results in a call to pci_rescan_bus(),
which only adds devices but doesn't remove any.  I guess it can be
argued that this behavior is counter-intuitive and should be changed.

Thanks,

Lukas

  reply	other threads:[~2017-04-27  8:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 22:56 PCI Rescan Question Kyle Gale
2017-04-27  8:02 ` Lukas Wunner [this message]
2017-04-28 14:56 ` Bjorn Helgaas
2017-04-29 22:17   ` Yinghai Lu
2017-05-24 20:34     ` Kyle Gale

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=20170427080207.GA11141@wunner.de \
    --to=lukas@wunner.de \
    --cc=kylewgale@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.