From: "Michel Dänzer" <michel@daenzer.net>
To: glisse@freedesktop.org
Cc: Jerome Glisse <jglisse@redhat.com>, stable <stable@kernel.org>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] agp: use scratch page on memory remove and at GATT creation V2
Date: Tue, 20 Apr 2010 16:57:11 +0200 [thread overview]
Message-ID: <1271775431.3891.10.camel@thor.local> (raw)
In-Reply-To: <1271766712-2032-1-git-send-email-glisse@freedesktop.org>
On Die, 2010-04-20 at 14:31 +0200, glisse@freedesktop.org wrote:
> From: Jerome Glisse <jglisse@redhat.com>
>
> Convert most AGP chipset to use scratch page as default entries.
> This help avoiding GPU querying 0 address and trigger computer
> fault. With KMS and memory manager we bind/unbind AGP memory
> constantly and it seems that some GPU are still doing AGP
> traffic even after GPU report being idle with the memory segment.
>
> Tested (radeon GPU KMS + Xorg + compiz + glxgears + quake3) on :
> - SIS 1039:0001 & 1039:0003
> - Intel 865 8086:2571
>
> Compile tested for other bridges
>
> V2 enable scratch page on uninorth
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> Cc: stable <stable@kernel.org>
[...]
> diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
> index d89da4a..f01a8df 100644
> --- a/drivers/char/agp/uninorth-agp.c
> +++ b/drivers/char/agp/uninorth-agp.c
> @@ -27,6 +27,7 @@
> */
> static int uninorth_rev;
> static int is_u3;
> +static u32 scratch_value;
>
> #define DEFAULT_APERTURE_SIZE 256
> #define DEFAULT_APERTURE_STRING "256"
> @@ -213,8 +214,9 @@ int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
> return 0;
>
> gp = (u32 *) &agp_bridge->gatt_table[pg_start];
> - for (i = 0; i < mem->page_count; ++i)
> - gp[i] = 0;
> + for (i = 0; i < mem->page_count; ++i) {
> + gp[i] = scratch_value;
> + }
> mb();
> uninorth_tlbflush(mem);
>
> @@ -420,8 +422,13 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
>
> bridge->gatt_bus_addr = virt_to_phys(table);
>
> + if (is_u3)
> + scratch_value = (page_to_phys(agp_bridge->scratch_page_page) >> PAGE_SHIFT) | 0x80000000UL;
> + else
> + scratch_value = cpu_to_le32((page_to_phys(agp_bridge->scratch_page_page) & 0xFFFFF000UL) |
> + 0x1UL);
> for (i = 0; i < num_entries; i++)
> - bridge->gatt_table[i] = 0;
> + bridge->gatt_table[i] = scratch_value;
>
> return 0;
>
> @@ -518,6 +525,7 @@ const struct agp_bridge_driver uninorth_agp_driver = {
> .agp_destroy_pages = agp_generic_destroy_pages,
> .agp_type_to_mask_type = agp_generic_type_to_mask_type,
> .cant_use_aperture = true,
> + .needs_scratch_page = true,
> };
>
> const struct agp_bridge_driver u3_agp_driver = {
The uninorth driver also needs the change below, or no memory can be
bound anymore. With that, it's working on my PowerBook.
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index f01a8df..9b26341 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -172,7 +172,7 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int ty
gp = (u32 *) &agp_bridge->gatt_table[pg_start];
for (i = 0; i < mem->page_count; ++i) {
- if (gp[i]) {
+ if (gp[i] != scratch_value) {
dev_info(&agp_bridge->dev->dev,
"uninorth_insert_memory: entry 0x%x occupied (%x)\n",
i, gp[i]);
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2010-04-20 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 12:31 [PATCH] agp: use scratch page on memory remove and at GATT creation V2 glisse
2010-04-20 13:44 ` Ville Syrjälä
2010-04-20 14:40 ` Jerome Glisse
2010-04-20 14:57 ` Michel Dänzer [this message]
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=1271775431.3891.10.camel@thor.local \
--to=michel@daenzer.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=glisse@freedesktop.org \
--cc=jglisse@redhat.com \
--cc=stable@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.