linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH]Allow agp memory allocations to use node information
@ 2004-05-12 18:47 Mike Werner
  2004-05-12 20:26 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Werner @ 2004-05-12 18:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: davej

diff -u linux-2.6.6.orig/drivers/char/agp/agp.h
linux-2.6.6/drivers/char/agp/agp.h
--- linux-2.6.6.orig/drivers/char/agp/agp.h     Sun May  9 19:32:28 2004

+++ linux-2.6.6/drivers/char/agp/agp.h  Wed May 12 11:43:19 2004
@@ -111,7 +111,7 @@
        int (*remove_memory)(struct agp_memory *, off_t, int);
        struct agp_memory *(*alloc_by_type) (size_t, int);
        void (*free_by_type)(struct agp_memory *);
-       void *(*agp_alloc_page)(void);
+       void *(*agp_alloc_page)(int);
        void (*agp_destroy_page)(void *);
 };

@@ -137,6 +137,7 @@
        int max_memory_agp;     /* in number of pages */
        int aperture_size_idx;
        int capndx;
+       int nodeid;
        char major_version;
        char minor_version;
 };
@@ -261,7 +262,7 @@
 int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start,
int type);
 struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int
type);
 void agp_generic_free_by_type(struct agp_memory *curr);
-void *agp_generic_alloc_page(void);
+void *agp_generic_alloc_page(int);
 void agp_generic_destroy_page(void *addr);
 void agp_free_key(int key);
 int agp_num_entries(void);
@@ -325,4 +326,5 @@
 #define AGPCTRL_APERENB                (1<<8)
 #define AGPCTRL_GTLBEN         (1<<7)

+#define AGPGART_DEFAULT_NODE   (0)
 #endif /* _AGP_BACKEND_PRIV_H */
diff -u linux-2.6.6.orig/drivers/char/agp/backend.c
linux-2.6.6/drivers/char/agp/backend.c
--- linux-2.6.6.orig/drivers/char/agp/backend.c Sun May  9 19:32:53 2004

+++ linux-2.6.6/drivers/char/agp/backend.c      Wed May 12 11:43:48 2004

@@ -130,12 +130,13 @@
 static int agp_backend_initialize(struct agp_bridge_data *bridge)
 {
        int size_value, rc, got_gatt=0, got_keylist=0;
+       int nid = bridge->nodeid;

        bridge->max_memory_agp = agp_find_max();
        bridge->version = &agp_current_version;

        if (bridge->driver->needs_scratch_page) {
-               void *addr = bridge->driver->agp_alloc_page();
+               void *addr = bridge->driver->agp_alloc_page(nid);

                if (!addr) {
                        printk(KERN_ERR PFX "unable to get memory for
scratch page.\n");
diff -u linux-2.6.6.orig/drivers/char/agp/generic.c
linux-2.6.6/drivers/char/agp/generic.c
--- linux-2.6.6.orig/drivers/char/agp/generic.c Sun May  9 19:32:27 2004

+++ linux-2.6.6/drivers/char/agp/generic.c      Wed May 12 11:44:03 2004

@@ -154,6 +154,7 @@
        int scratch_pages;
        struct agp_memory *new;
        size_t i;
+       int nid = agp_bridge->nodeid;

        if (agp_bridge->type == NOT_SUPPORTED)
                return NULL;
@@ -174,7 +175,7 @@
                return NULL;

        for (i = 0; i < page_count; i++) {
-               void *addr = agp_bridge->driver->agp_alloc_page();
+               void *addr = agp_bridge->driver->agp_alloc_page(nid);

                if (addr == NULL) {
                        agp_free_memory(new);
@@ -877,11 +878,11 @@
  * against a maximum value.
  */

-void *agp_generic_alloc_page(void)
+void *agp_generic_alloc_page(int nid)
 {
        struct page * page;

-       page = alloc_page(GFP_KERNEL);
+       page = alloc_pages_node(nid, GFP_KERNEL, 0);
        if (page == NULL)
                return 0;

diff -u linux-2.6.6.orig/drivers/char/agp/i460-agp.c
linux-2.6.6/drivers/char/agp/i460-agp.c
--- linux-2.6.6.orig/drivers/char/agp/i460-agp.c        Sun May  9
19:32:39 2004
+++ linux-2.6.6/drivers/char/agp/i460-agp.c     Wed May 12 10:49:06 2004

@@ -508,12 +508,12 @@
  * Let's just hope nobody counts on the allocated AGP memory being
there before bind time
  * (I don't think current drivers do)...
  */
-static void *i460_alloc_page (void)
+static void *i460_alloc_page (int nid)
 {
        void *page;

        if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT)
-               page = agp_generic_alloc_page();
+               page = agp_generic_alloc_page(nid);
        else
                /* Returning NULL would cause problems */
                /* AK: really dubious code. */
diff -u linux-2.6.6.orig/drivers/char/agp/intel-agp.c
linux-2.6.6/drivers/char/agp/intel-agp.c
--- linux-2.6.6.orig/drivers/char/agp/intel-agp.c       Sun May  9
19:32:36 2004
+++ linux-2.6.6/drivers/char/agp/intel-agp.c    Wed May 12 10:47:19 2004

@@ -221,7 +221,7 @@
        if (pg_count != 1)
                return NULL;

-       addr = agp_bridge->driver->agp_alloc_page();
+       addr = agp_bridge->driver->agp_alloc_page(AGPGART_DEFAULT_NODE);

        if (addr == NULL)
                return NULL;

diff -u linux-2.6.6.orig/drivers/char/agp/intel-mch-agp.c
linux-2.6.6/drivers/char/agp/intel-mch-agp.c
--- linux-2.6.6.orig/drivers/char/agp/intel-mch-agp.c   Sun May  9
19:32:00 2004
+++ linux-2.6.6/drivers/char/agp/intel-mch-agp.c        Wed May 12
11:16:02 2004
@@ -43,7 +43,7 @@
        if (pg_count != 1)
                return NULL;

-       addr = agp_bridge->driver->agp_alloc_page();
+       addr = agp_bridge->driver->agp_alloc_page(AGPGART_DEFAULT_NODE);

        if (addr == NULL)
                return NULL;




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

* Re: [RFC/PATCH]Allow agp memory allocations to use node information
  2004-05-12 18:47 [RFC/PATCH]Allow agp memory allocations to use node information Mike Werner
@ 2004-05-12 20:26 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2004-05-12 20:26 UTC (permalink / raw)
  To: Mike Werner; +Cc: linux-kernel, davej

not a lot of description here, he? :-)


On Wed, May 12, 2004 at 11:47:39AM -0700, Mike Werner wrote:
> diff -u linux-2.6.6.orig/drivers/char/agp/agp.h
> linux-2.6.6/drivers/char/agp/agp.h
> --- linux-2.6.6.orig/drivers/char/agp/agp.h     Sun May  9 19:32:28 2004
> 
> +++ linux-2.6.6/drivers/char/agp/agp.h  Wed May 12 11:43:19 2004
> @@ -111,7 +111,7 @@
>         int (*remove_memory)(struct agp_memory *, off_t, int);
>         struct agp_memory *(*alloc_by_type) (size_t, int);
>         void (*free_by_type)(struct agp_memory *);
> -       void *(*agp_alloc_page)(void);
> +       void *(*agp_alloc_page)(int);
>         void (*agp_destroy_page)(void *);

Wrong interface.  We need to pass a struct agp_bridge_data to
each of the methods anyway for proper support for multiple AGP
bridges in a single system.  And once you have that you can simply
use the node id your patches stores in agp_bridge_data.

> +++ linux-2.6.6/drivers/char/agp/intel-mch-agp.c        Wed May 12
> 11:16:02 2004
> @@ -43,7 +43,7 @@
>         if (pg_count != 1)
>                 return NULL;
> 
> -       addr = agp_bridge->driver->agp_alloc_page();
> +       addr = agp_bridge->driver->agp_alloc_page(AGPGART_DEFAULT_NODE);

wrong default again.  for the agp bridges that have an associated pci
device (aka about everything except hpzx and alpha IIRC) you should
use pcibus_to_cpumask (or what the thing was called).  For the others
you should try to contact the maintainers for a proper choice.


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

end of thread, other threads:[~2004-05-12 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-12 18:47 [RFC/PATCH]Allow agp memory allocations to use node information Mike Werner
2004-05-12 20:26 ` Christoph Hellwig

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