rpms/kernel/devel linux-2.6-vga-arb.patch, 1.5, 1.6 kernel.spec, 1.1686, 1.1687

Dave Airlie airlied at fedoraproject.org
Tue Aug 4 01:47:33 UTC 2009


Author: airlied

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13380

Modified Files:
	linux-2.6-vga-arb.patch kernel.spec 
Log Message:
* Tue Aug 04 2009 Dave Airlie <airlied at redhat.com>
- update VGA arb patches again


linux-2.6-vga-arb.patch:
 drivers/gpu/Makefile     |    2 
 drivers/gpu/vga/Kconfig  |   10 
 drivers/gpu/vga/Makefile |    1 
 drivers/gpu/vga/vgaarb.c | 1195 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pci.c        |   44 +
 drivers/video/Kconfig    |    2 
 include/linux/pci.h      |    2 
 include/linux/vgaarb.h   |  196 +++++++
 8 files changed, 1450 insertions(+), 2 deletions(-)

Index: linux-2.6-vga-arb.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-vga-arb.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- linux-2.6-vga-arb.patch	3 Aug 2009 06:03:08 -0000	1.5
+++ linux-2.6-vga-arb.patch	4 Aug 2009 01:47:32 -0000	1.6
@@ -1,11 +1,9 @@
-From 28a788c99a243050ab55e819e8e81c4ba019bb35 Mon Sep 17 00:00:00 2001
+From a00c47b3e783fe9ebb871071d2472387451d9225 Mon Sep 17 00:00:00 2001
 From: Tiago Vignatti <tiago.vignatti at nokia.com>
 Date: Tue, 14 Jul 2009 15:57:29 +0300
 Subject: [PATCH] vga: implements VGA arbitration on Linux
 
 changes since last patch:
-fixup unlock userspace api so it can't go < 0
-add exports for vga put/get/tryget
 fix up so the arb doesn't turn off vga decodes
 on hw until first used. This worksaround an
 X.org problem with older X servers which fail
@@ -14,18 +12,21 @@ bit enabled. Newer pciacccess + X server
 add default processing
 use hex for the target API to match the output API
 balance pci get/put
+use the decodes count for userspace to get card
+count also if a gpu disables decodes move it to
+the next card
 
 Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
 ---
  drivers/gpu/Makefile     |    2 +-
  drivers/gpu/vga/Kconfig  |   10 +
  drivers/gpu/vga/Makefile |    1 +
- drivers/gpu/vga/vgaarb.c | 1159 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/gpu/vga/vgaarb.c | 1195 ++++++++++++++++++++++++++++++++++++++++++++++
  drivers/pci/pci.c        |   44 ++
  drivers/video/Kconfig    |    2 +
  include/linux/pci.h      |    2 +
  include/linux/vgaarb.h   |  195 ++++++++
- 8 files changed, 1414 insertions(+), 1 deletions(-)
+ 8 files changed, 1450 insertions(+), 1 deletions(-)
  create mode 100644 drivers/gpu/vga/Kconfig
  create mode 100644 drivers/gpu/vga/Makefile
  create mode 100644 drivers/gpu/vga/vgaarb.c
@@ -63,10 +64,10 @@ index 0000000..7cc8c1e
 +obj-$(CONFIG_VGA_ARB)  += vgaarb.o
 diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
 new file mode 100644
-index 0000000..7383d00
+index 0000000..08ba44d
 --- /dev/null
 +++ b/drivers/gpu/vga/vgaarb.c
-@@ -0,0 +1,1159 @@
+@@ -0,0 +1,1195 @@
 +/*
 + * vgaarb.c
 + *
@@ -117,7 +118,7 @@ index 0000000..7383d00
 +};
 +
 +static LIST_HEAD(vga_list);
-+static int vga_count;
++static int vga_count, vga_decode_count;
 +static bool vga_arbiter_used;
 +static DEFINE_SPINLOCK(vga_lock);
 +static DECLARE_WAIT_QUEUE_HEAD(vga_wait_queue);
@@ -512,6 +513,8 @@ index 0000000..7383d00
 +	vgadev->decodes = VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
 +			  VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
 +
++	/* by default mark it as decoding */
++	vga_decode_count++;
 +	/* Mark that we "own" resources based on our enables, we will
 +	 * clear that below if the bridge isn't forwarding
 +	 */
@@ -577,6 +580,9 @@ index 0000000..7383d00
 +		vga_default = NULL;
 +	}
 +
++	if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
++		vga_decode_count--;
++
 +	/* Remove entry from list */
 +	list_del(&vgadev->list);
 +	vga_count--;
@@ -592,11 +598,49 @@ index 0000000..7383d00
 +	kfree(vgadev);
 +}
 +
++/* this is called with the lock */
++static inline void vga_update_device_decodes(struct vga_device *vgadev,
++					     int new_decodes)
++{
++	int old_decodes;
++	struct vga_device *new_vgadev, *conflict;
++
++	old_decodes = vgadev->decodes;
++	vgadev->decodes = new_decodes;
++
++	pr_info("vgaarb: device changed decodes: PCI:%s,olddecodes=%s,decodes=%s\n",
++		pci_name(vgadev->pdev),
++		vga_iostate_to_str(old_decodes),
++		vga_iostate_to_str(vgadev->decodes));
++
++	/* if we own the decodes we should move them along to
++	   another card */
++	if ((vgadev->owns & new_decodes) && (vga_count > 1)) {
++		vgadev->owns &= new_decodes;
++		list_for_each_entry(new_vgadev, &vga_list, list) {
++			if ((new_vgadev != vgadev) &&
++			    (new_vgadev->decodes & VGA_RSRC_LEGACY_MASK)) {
++				conflict = __vga_tryget(new_vgadev, VGA_RSRC_LEGACY_MASK);
++				if (!conflict)
++					__vga_put(new_vgadev, VGA_RSRC_LEGACY_MASK);
++				break;
++			}
++		}
++	}
++
++	/* change decodes counter */
++	if (old_decodes != new_decodes) {
++		if (new_decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
++			vga_decode_count++;
++		else
++			vga_decode_count--;
++	}
++}
++
 +void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace)
 +{
 +	struct vga_device *vgadev;
 +	unsigned long flags;
-+	int old_decodes;
 +
 +	decodes &= VGA_RSRC_LEGACY_MASK;
 +
@@ -609,14 +653,8 @@ index 0000000..7383d00
 +	if (userspace && vgadev->set_vga_decode)
 +		goto bail;
 +
-+	old_decodes = vgadev->decodes;
-+	vgadev->decodes = decodes;
-+	vgadev->owns &= decodes;
-+
-+	pr_info("vgaarb: device changed decodes: PCI:%s,olddecodes=%s,decodes=%s\n",
-+		pci_name(pdev),
-+		vga_iostate_to_str(old_decodes),
-+		vga_iostate_to_str(vgadev->decodes));
++	/* update the device decodes + counter */
++	vga_update_device_decodes(vgadev, decodes);
 +
 +	/* XXX if somebody is going from "doesn't decode" to "decodes" state
 +	 * here, additional care must be taken as we may have pending owner
@@ -799,8 +837,8 @@ index 0000000..7383d00
 +
 +	/* Fill the buffer with infos */
 +	len = snprintf(lbuf, 1024,
-+		       "count:%d,PCI:%s,decodes=%s,owns=%s,locks=%s (%d,%d)\n",
-+		       vga_count, pci_name(pdev),
++		       "count:%d,PCI:%s,decodes=%s,owns=%s,locks=%s(%d:%d)\n",
++		       vga_decode_count, pci_name(pdev),
 +		       vga_iostate_to_str(vgadev->decodes),
 +		       vga_iostate_to_str(vgadev->owns),
 +		       vga_iostate_to_str(vgadev->locks),
@@ -1160,8 +1198,7 @@ index 0000000..7383d00
 +			new_state = true;
 +		if (vgadev->set_vga_decode) {
 +			new_decodes = vgadev->set_vga_decode(vgadev->cookie, new_state);
-+			vgadev->decodes = new_decodes;
-+			vgadev->owns &= new_decodes;
++			vga_update_device_decodes(vgadev, new_decodes);
 +		}
 +	}
 +	spin_unlock_irqrestore(&vga_lock, flags);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1686
retrieving revision 1.1687
diff -u -p -r1.1686 -r1.1687
--- kernel.spec	3 Aug 2009 18:24:04 -0000	1.1686
+++ kernel.spec	4 Aug 2009 01:47:32 -0000	1.1687
@@ -1944,6 +1944,9 @@ fi
 # and build.
 
 %changelog
+* Tue Aug 04 2009 Dave Airlie <airlied at redhat.com>
+- update VGA arb patches again
+
 * Mon Aug 03 2009 Adam Jackson <ajax at redhat.com>
 - Update intel drm from anholt's tree
 - Rebase drm-intel-pm.patch to match




More information about the fedora-extras-commits mailing list