diff mbox

[3/3] agp/uninorth: Unify U3 and pre-U3 insert_memory and remove_memory hooks.

Message ID 1250151313.4992.202.camel@thor (mailing list archive)
State Not Applicable
Headers show

Commit Message

Michel Dänzer Aug. 13, 2009, 8:15 a.m. UTC
On Thu, 2009-08-13 at 17:05 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2009-08-04 at 23:51 +0200, Michel Dänzer wrote:
> > From: Michel Dänzer <daenzer@vmware.com>
> > 
> > Signed-off-by: Michel Dänzer <daenzer@vmware.com>
> > ---
> 
> Hi Michel !
> 
> While your two previous patches apply just fine, this one doesn't,
> the uninorth_insert_memory() function seems to be slightly different
> upstream. Does this depend on some separate yet unapplied patches ?

I previously sent the attached patches to Dave in the course of the
radeon KMS issues thread. Not sure which of these he's picked up yet, if
any.


> I'm putting 1/3 and 2/3 into my -test branch and they should hit my
> -next branch in a couple of days.
> 
> Or do you prefer us to merge that via Dave ?
> 
> The thing is, stuff in -powerpc is much more likely to get some amount
> of testing on actual ppc hardware than stuff in random other trees :-)

I'm fine with either way.

Comments

Benjamin Herrenschmidt Aug. 20, 2009, 12:47 a.m. UTC | #1
On Thu, 2009-08-13 at 10:15 +0200, Michel Dänzer wrote:
> On Thu, 2009-08-13 at 17:05 +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2009-08-04 at 23:51 +0200, Michel Dänzer wrote:
> > > From: Michel Dänzer <daenzer@vmware.com>
> > > 
> > > Signed-off-by: Michel Dänzer <daenzer@vmware.com>
> > > ---
> > 
> > Hi Michel !
> > 
> > While your two previous patches apply just fine, this one doesn't,
> > the uninorth_insert_memory() function seems to be slightly different
> > upstream. Does this depend on some separate yet unapplied patches ?
> 
> I previously sent the attached patches to Dave in the course of the
> radeon KMS issues thread. Not sure which of these he's picked up yet, if
> any.

I merged the first two patches in your series, we can sort out the 3rd
one in a second pass on the merge window.

Cheers,
Ben.

> 
> > I'm putting 1/3 and 2/3 into my -test branch and they should hit my
> > -next branch in a couple of days.
> > 
> > Or do you prefer us to merge that via Dave ?
> > 
> > The thing is, stuff in -powerpc is much more likely to get some amount
> > of testing on actual ppc hardware than stuff in random other trees :-)
> 
> I'm fine with either way.
> 
>
diff mbox

Patch

From 0e4f25a616fdb5136372ab0523a43af39ff7fcd6 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Michel=20D=C3=A4nzer?= <daenzer@vmware.com>
Date: Thu, 13 Aug 2009 08:42:38 +0200
Subject: [PATCH] uninorth: Also handle user memory types in u3_remove_memory().
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Also short-circuit empty updates.

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
---
 drivers/char/agp/uninorth-agp.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 880d3f6..cd63d76 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -148,9 +148,6 @@  static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
 	void *temp;
 	int mask_type;
 
-	temp = agp_bridge->current_size;
-	num_entries = A_SIZE_32(temp)->num_entries;
-
 	if (type != mem->type)
 		return -EINVAL;
 
@@ -160,6 +157,12 @@  static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start,
 		return -EINVAL;
 	}
 
+	if (mem->page_count == 0)
+		return 0;
+
+	temp = agp_bridge->current_size;
+	num_entries = A_SIZE_32(temp)->num_entries;
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
@@ -193,9 +196,6 @@  static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
 	u32 *gp;
 	int mask_type;
 
-	temp = agp_bridge->current_size;
-	num_entries = A_SIZE_32(temp)->num_entries;
-
 	if (type != mem->type)
 		return -EINVAL;
 
@@ -205,6 +205,12 @@  static int u3_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
 		return -EINVAL;
 	}
 
+	if (mem->page_count == 0)
+		return 0;
+
+	temp = agp_bridge->current_size;
+	num_entries = A_SIZE_32(temp)->num_entries;
+
 	if ((pg_start + mem->page_count) > num_entries)
 		return -EINVAL;
 
@@ -234,10 +240,19 @@  int u3_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
 {
 	size_t i;
 	u32 *gp;
+	int mask_type;
+
+	if (type != mem->type)
+		return -EINVAL;
 
-	if (type != 0 || mem->type != 0)
+	mask_type = agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type);
+	if (mask_type != 0) {
 		/* We know nothing of memory types */
 		return -EINVAL;
+	}
+
+	if (mem->page_count == 0)
+		return 0;
 
 	gp = (u32 *) &agp_bridge->gatt_table[pg_start];
 	for (i = 0; i < mem->page_count; ++i)
-- 
1.6.3.3