LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] PCI: pci_unignore_hotplug()
@ 2015-02-24 20:12 Alex Williamson
  2015-02-24 20:12 ` [PATCH 1/2] pci: Add reciprocal function for pci_ignore_hotplug() Alex Williamson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alex Williamson @ 2015-02-24 20:12 UTC (permalink / raw)
  To: bhelgaas, linux-pci, airlied, alexander.deucher, dri-devel
  Cc: alex.williamson, linux-kernel

I'd kinda like to use pci_ignore_hotplug() for devices in use by a
user via vfio-pci, but the interface seems only partially implemented
since we can only set ignore_hotplug and not clear it.  This adds the
capability to clear the flag and applies it as seems to be appropriate
to the existing users.  I don't have a system with power control for
a radeon or nouveau device, so I'd certainly appreciate testing.  It
seems though that once the device is in D0, we've passed the critical
point where the device could be accidentally unplugged.  Thanks,

Alex

---

Alex Williamson (2):
      pci: Add reciprocal function for pci_ignore_hotplug()
      nouveau/radeon: Un-ignore hotplug on resume


 drivers/gpu/drm/nouveau/nouveau_drm.c |    1 +
 drivers/gpu/drm/radeon/radeon_drv.c   |    1 +
 include/linux/pci.h                   |    5 +++++
 3 files changed, 7 insertions(+)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] pci: Add reciprocal function for pci_ignore_hotplug()
  2015-02-24 20:12 [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Williamson
@ 2015-02-24 20:12 ` Alex Williamson
  2015-02-24 20:12 ` [PATCH 2/2] nouveau/radeon: Un-ignore hotplug on resume Alex Williamson
  2015-02-24 20:23 ` [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Deucher
  2 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2015-02-24 20:12 UTC (permalink / raw)
  To: bhelgaas, linux-pci, airlied, alexander.deucher, dri-devel
  Cc: alex.williamson, linux-kernel

We have pci_ignore_hotplug(), but there's no way to undo this
without manipulating the device itself.  It seems like the original
intention of the function is to provide the driver with a way to
ignore hotplug over a specific time window, ex. the time while the
device is powered off.  Once the device is powered on again, the
flag should be cleared to avoid leaving driver cruft on the device.
Add a trivial helper function to enable this.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 include/linux/pci.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 211e9da..26f9779 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1044,6 +1044,11 @@ static inline void pci_ignore_hotplug(struct pci_dev *dev)
 	dev->ignore_hotplug = 1;
 }
 
+static inline void pci_unignore_hotplug(struct pci_dev *dev)
+{
+	dev->ignore_hotplug = 0;
+}
+
 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
 				  bool enable)
 {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] nouveau/radeon: Un-ignore hotplug on resume
  2015-02-24 20:12 [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Williamson
  2015-02-24 20:12 ` [PATCH 1/2] pci: Add reciprocal function for pci_ignore_hotplug() Alex Williamson
@ 2015-02-24 20:12 ` Alex Williamson
  2015-02-24 20:23 ` [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Deucher
  2 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2015-02-24 20:12 UTC (permalink / raw)
  To: bhelgaas, linux-pci, airlied, alexander.deucher, dri-devel
  Cc: alex.williamson, linux-kernel

Commit b440bde74f04 enabled drivers to be able to set an ignore
hotplug flag on the device and used it in the suspend routine for
nouveau and radeon to prevent hotplug when the device is powered off.
However, there was no undo function provided, so once set, the ignore
hotplug flag lives on for the life of the pci_dev.  I think the
intention was only to ignore hotplug across the power event for the
device, so we should be able to clear the flag on resume.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_drm.c |    1 +
 drivers/gpu/drm/radeon/radeon_drv.c   |    1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 8763deb..b168c3a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -749,6 +749,7 @@ nouveau_pmops_runtime_resume(struct device *dev)
 		return -EINVAL;
 
 	pci_set_power_state(pdev, PCI_D0);
+	pci_unignore_hotplug(pdev);
 	pci_restore_state(pdev);
 	ret = pci_enable_device(pdev);
 	if (ret)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 5d684be..1c7c79b 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -472,6 +472,7 @@ static int radeon_pmops_runtime_resume(struct device *dev)
 	drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
 	pci_set_power_state(pdev, PCI_D0);
+	pci_unignore_hotplug(pdev);
 	pci_restore_state(pdev);
 	ret = pci_enable_device(pdev);
 	if (ret)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] PCI: pci_unignore_hotplug()
  2015-02-24 20:12 [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Williamson
  2015-02-24 20:12 ` [PATCH 1/2] pci: Add reciprocal function for pci_ignore_hotplug() Alex Williamson
  2015-02-24 20:12 ` [PATCH 2/2] nouveau/radeon: Un-ignore hotplug on resume Alex Williamson
@ 2015-02-24 20:23 ` Alex Deucher
  2015-03-06 18:49   ` Bjorn Helgaas
  2 siblings, 1 reply; 6+ messages in thread
From: Alex Deucher @ 2015-02-24 20:23 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Bjorn Helgaas, Linux PCI, Dave Airlie, Deucher, Alexander,
	Maling list - DRI developers, LKML

On Tue, Feb 24, 2015 at 3:12 PM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> I'd kinda like to use pci_ignore_hotplug() for devices in use by a
> user via vfio-pci, but the interface seems only partially implemented
> since we can only set ignore_hotplug and not clear it.  This adds the
> capability to clear the flag and applies it as seems to be appropriate
> to the existing users.  I don't have a system with power control for
> a radeon or nouveau device, so I'd certainly appreciate testing.  It
> seems though that once the device is in D0, we've passed the critical
> point where the device could be accidentally unplugged.  Thanks,

Something re-broke this recently.  See:
https://bugzilla.kernel.org/show_bug.cgi?id=61891
https://bugzilla.kernel.org/show_bug.cgi?id=89731

Alex

>
> Alex
>
> ---
>
> Alex Williamson (2):
>       pci: Add reciprocal function for pci_ignore_hotplug()
>       nouveau/radeon: Un-ignore hotplug on resume
>
>
>  drivers/gpu/drm/nouveau/nouveau_drm.c |    1 +
>  drivers/gpu/drm/radeon/radeon_drv.c   |    1 +
>  include/linux/pci.h                   |    5 +++++
>  3 files changed, 7 insertions(+)
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] PCI: pci_unignore_hotplug()
  2015-02-24 20:23 ` [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Deucher
@ 2015-03-06 18:49   ` Bjorn Helgaas
  2015-03-06 22:12     ` Alex Deucher
  0 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2015-03-06 18:49 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Alex Williamson, Linux PCI, Dave Airlie, Deucher, Alexander,
	Maling list - DRI developers, LKML

On Tue, Feb 24, 2015 at 03:23:27PM -0500, Alex Deucher wrote:
> On Tue, Feb 24, 2015 at 3:12 PM, Alex Williamson
> <alex.williamson@redhat.com> wrote:
> > I'd kinda like to use pci_ignore_hotplug() for devices in use by a
> > user via vfio-pci, but the interface seems only partially implemented
> > since we can only set ignore_hotplug and not clear it.  This adds the
> > capability to clear the flag and applies it as seems to be appropriate
> > to the existing users.  I don't have a system with power control for
> > a radeon or nouveau device, so I'd certainly appreciate testing.  It
> > seems though that once the device is in D0, we've passed the critical
> > point where the device could be accidentally unplugged.  Thanks,
> 
> Something re-broke this recently.  See:
> https://bugzilla.kernel.org/show_bug.cgi?id=61891
> https://bugzilla.kernel.org/show_bug.cgi?id=89731

I'm not opposed to adding pci_unignore_hotplug() when we have users for it.
I don't really want to throw in the nouveau and radeon changes while there
are open issues in the same area, though.

I haven't looked at the bugzillas above.  Let me know if I should.

Bjorn

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] PCI: pci_unignore_hotplug()
  2015-03-06 18:49   ` Bjorn Helgaas
@ 2015-03-06 22:12     ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2015-03-06 22:12 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alex Williamson, Linux PCI, Dave Airlie, Deucher, Alexander,
	Maling list - DRI developers, LKML

On Fri, Mar 6, 2015 at 1:49 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Tue, Feb 24, 2015 at 03:23:27PM -0500, Alex Deucher wrote:
>> On Tue, Feb 24, 2015 at 3:12 PM, Alex Williamson
>> <alex.williamson@redhat.com> wrote:
>> > I'd kinda like to use pci_ignore_hotplug() for devices in use by a
>> > user via vfio-pci, but the interface seems only partially implemented
>> > since we can only set ignore_hotplug and not clear it.  This adds the
>> > capability to clear the flag and applies it as seems to be appropriate
>> > to the existing users.  I don't have a system with power control for
>> > a radeon or nouveau device, so I'd certainly appreciate testing.  It
>> > seems though that once the device is in D0, we've passed the critical
>> > point where the device could be accidentally unplugged.  Thanks,
>>
>> Something re-broke this recently.  See:
>> https://bugzilla.kernel.org/show_bug.cgi?id=61891
>> https://bugzilla.kernel.org/show_bug.cgi?id=89731
>
> I'm not opposed to adding pci_unignore_hotplug() when we have users for it.
> I don't really want to throw in the nouveau and radeon changes while there
> are open issues in the same area, though.
>
> I haven't looked at the bugzillas above.  Let me know if I should.

Please do.  My comments were not targeted at this patch set, but
rather at the fact that pci hotplug (acpiphp in this case) is again
trying to remove the driver even though it's flagged to ignore hotplug
in the hybrid laptop case.

Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-06 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 20:12 [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Williamson
2015-02-24 20:12 ` [PATCH 1/2] pci: Add reciprocal function for pci_ignore_hotplug() Alex Williamson
2015-02-24 20:12 ` [PATCH 2/2] nouveau/radeon: Un-ignore hotplug on resume Alex Williamson
2015-02-24 20:23 ` [PATCH 0/2] PCI: pci_unignore_hotplug() Alex Deucher
2015-03-06 18:49   ` Bjorn Helgaas
2015-03-06 22:12     ` Alex Deucher

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).