From: Robert Hancock <hancockrwd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>,
Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Jason Detring <detringj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/nouveau/agp: add a quirk list to limit agp modes
Date: Sun, 27 Oct 2013 21:01:57 -0600 [thread overview]
Message-ID: <526DD3A5.6080001@gmail.com> (raw)
In-Reply-To: <1382889249-6822-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
On 10/27/2013 09:54 AM, Ilia Mirkin wrote:
> Certain combinations of hardware can't actually support the maximum
> detected speed. Add a quirk list that lists pairs of hostbridge/chip pci
> ids and the mode that they should work with.
>
> See https://bugs.freedesktop.org/show_bug.cgi?id=20341
It seems like this quirk is likely too specific. This almost certainly
affects more than 5600 Ultra cards and probably not just NV cards
either. It probably affects more VIA chipsets than this too.
Given the amount of breakage that seems to exist with VIA AGP chipsets,
I would think that being much more aggressive and forcing AGP mode to 2X
maximum at the AGP driver level for all VIA chipsets doesn't seem like
it would be a bad idea.
>
> Reported-by: Jason Detring <detringj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
> ---
>
> I didn't go as far as subdevice matching... IMO that's overkill for now.
>
> drivers/gpu/drm/nouveau/nouveau_agp.c | 44 +++++++++++++++++++++++++++++++----
> 1 file changed, 39 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_agp.c b/drivers/gpu/drm/nouveau/nouveau_agp.c
> index 6e7a55f..2953c4e 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_agp.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_agp.c
> @@ -11,10 +11,28 @@ MODULE_PARM_DESC(agpmode, "AGP mode (0 to disable AGP)");
> static int nouveau_agpmode = -1;
> module_param_named(agpmode, nouveau_agpmode, int, 0400);
>
> +struct nouveau_agpmode_quirk {
> + u16 hostbridge_vendor;
> + u16 hostbridge_device;
> + u16 chip_vendor;
> + u16 chip_device;
> + int mode;
> +};
> +
> +static struct nouveau_agpmode_quirk nouveau_agpmode_quirk_list[] = {
> + /* VIA Apollo PRO133x / GeForce FX 5600 Ultra, max agpmode 2, fdo #20341 */
> + { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 },
> +
> + {},
> +};
> +
> static unsigned long
> -get_agp_mode(struct nouveau_drm *drm, unsigned long mode)
> +get_agp_mode(struct nouveau_drm *drm, const struct drm_agp_info *info)
> {
> struct nouveau_device *device = nv_device(drm->device);
> + struct nouveau_agpmode_quirk *quirk = nouveau_agpmode_quirk_list;
> + int agpmode = nouveau_agpmode;
> + unsigned long mode = info->mode;
>
> /*
> * FW seems to be broken on nv18, it makes the card lock up
> @@ -24,11 +42,27 @@ get_agp_mode(struct nouveau_drm *drm, unsigned long mode)
> mode &= ~PCI_AGP_COMMAND_FW;
>
> /*
> + * Go through the quirks list and adjust the agpmode accordingly.
> + */
> + while (agpmode == -1 && quirk->hostbridge_vendor) {
> + if (info->id_vendor == quirk->hostbridge_vendor &&
> + info->id_device == quirk->hostbridge_device &&
> + device->pdev->vendor == quirk->chip_vendor &&
> + device->pdev->device == quirk->chip_device) {
> + agpmode = quirk->mode;
> + nv_info(device, "Forcing agp mode to %dX. Use agpmode to override.\n",
> + agpmode);
> + break;
> + }
> + ++quirk;
> + }
> +
> + /*
> * AGP mode set in the command line.
> */
> - if (nouveau_agpmode > 0) {
> + if (agpmode > 0) {
> bool agpv3 = mode & 0x8;
> - int rate = agpv3 ? nouveau_agpmode / 4 : nouveau_agpmode;
> + int rate = agpv3 ? agpmode / 4 : agpmode;
>
> mode = (mode & ~0x7) | (rate & 0x7);
> }
> @@ -90,7 +124,7 @@ nouveau_agp_reset(struct nouveau_drm *drm)
> if (ret)
> return;
>
> - mode.mode = get_agp_mode(drm, info.mode);
> + mode.mode = get_agp_mode(drm, &info);
> mode.mode &= ~PCI_AGP_COMMAND_FW;
>
> ret = drm_agp_enable(dev, mode);
> @@ -139,7 +173,7 @@ nouveau_agp_init(struct nouveau_drm *drm)
> }
>
> /* see agp.h for the AGPSTAT_* modes available */
> - mode.mode = get_agp_mode(drm, info.mode);
> + mode.mode = get_agp_mode(drm, &info);
>
> ret = drm_agp_enable(dev, mode);
> if (ret) {
>
next prev parent reply other threads:[~2013-10-28 3:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-27 15:54 [PATCH] drm/nouveau/agp: add a quirk list to limit agp modes Ilia Mirkin
[not found] ` <1382889249-6822-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2013-10-28 3:01 ` Robert Hancock [this message]
2013-10-28 3:12 ` Ilia Mirkin
[not found] ` <526DD3A5.6080001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-29 13:23 ` Alex Deucher
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=526DD3A5.6080001@gmail.com \
--to=hancockrwd-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=detringj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 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).