diff mbox

drm/nouveau: fix init with agpgart-uninorth

Message ID 1353059674-17349-1-git-send-email-aaro.koskinen@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Aaro Koskinen Nov. 16, 2012, 9:54 a.m. UTC
Check that the AGP aperture can be mapped. This follows a similar change
done for Radeon (commit 365048ff, drm/radeon: AGP memory is only I/O if
the aperture can be mapped by the CPU.).

The patch fixes the following error seen on G5 iMac:

	nouveau E[     DRM] failed to create kernel channel, -12

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michel Dänzer Nov. 16, 2012, 2:16 p.m. UTC | #1
On Fre, 2012-11-16 at 11:54 +0200, Aaro Koskinen wrote: 
> Check that the AGP aperture can be mapped. This follows a similar change
> done for Radeon (commit 365048ff, drm/radeon: AGP memory is only I/O if
> the aperture can be mapped by the CPU.).
> 
> The patch fixes the following error seen on G5 iMac:
> 
> 	nouveau E[     DRM] failed to create kernel channel, -12
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
>  drivers/gpu/drm/nouveau/nouveau_bo.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index 35ac57f..5f0e7ef 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1279,7 +1279,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
>  		if (drm->agp.stat == ENABLED) {
>  			mem->bus.offset = mem->start << PAGE_SHIFT;
>  			mem->bus.base = drm->agp.base;
> -			mem->bus.is_iomem = true;
> +			mem->bus.is_iomem = !dev->agp->cant_use_aperture;

Looks good, though radeon also doesn't set TTM_MEMTYPE_FLAG_MAPPABLE for
the TT memory type if the aperture can't be mapped directly. Maybe
nouveau should do the same, or maybe it doesn't really matter. Not sure.
Aaro Koskinen Nov. 16, 2012, 6:11 p.m. UTC | #2
Hi,

On Fri, Nov 16, 2012 at 03:16:09PM +0100, Michel Dänzer wrote:
> On Fre, 2012-11-16 at 11:54 +0200, Aaro Koskinen wrote: 
> > Check that the AGP aperture can be mapped. This follows a similar change
> > done for Radeon (commit 365048ff, drm/radeon: AGP memory is only I/O if
> > the aperture can be mapped by the CPU.).
> > 
> > The patch fixes the following error seen on G5 iMac:
> > 
> > 	nouveau E[     DRM] failed to create kernel channel, -12
> > 
> > Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> > ---
> >  drivers/gpu/drm/nouveau/nouveau_bo.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > index 35ac57f..5f0e7ef 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > @@ -1279,7 +1279,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
> >  		if (drm->agp.stat == ENABLED) {
> >  			mem->bus.offset = mem->start << PAGE_SHIFT;
> >  			mem->bus.base = drm->agp.base;
> > -			mem->bus.is_iomem = true;
> > +			mem->bus.is_iomem = !dev->agp->cant_use_aperture;
> 
> Looks good, though radeon also doesn't set TTM_MEMTYPE_FLAG_MAPPABLE for
> the TT memory type if the aperture can't be mapped directly. Maybe
> nouveau should do the same, or maybe it doesn't really matter. Not sure.

This would fail with -EINVAL if the MAPPABLE flag is not set. So I think
it's needed?

Looking at radeon_ttm.c, the MAPPABLE flag seems to be set in both cases:

   141                  man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA;
   142  #if __OS_HAS_AGP
   143                  if (rdev->flags & RADEON_IS_AGP) {
   144                          if (!(drm_core_has_AGP(rdev->ddev) && rdev->ddev->agp)) {
   145                                  DRM_ERROR("AGP is not enabled for memory type %u\n",
   146                                            (unsigned)type);
   147                                  return -EINVAL;
   148                          }
   149                          if (!rdev->ddev->agp->cant_use_aperture)
   150                                  man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;

A.
Michel Dänzer Nov. 19, 2012, 10:57 a.m. UTC | #3
On Fre, 2012-11-16 at 20:11 +0200, Aaro Koskinen wrote: 
> On Fri, Nov 16, 2012 at 03:16:09PM +0100, Michel Dänzer wrote:
> > On Fre, 2012-11-16 at 11:54 +0200, Aaro Koskinen wrote: 
> > > Check that the AGP aperture can be mapped. This follows a similar change
> > > done for Radeon (commit 365048ff, drm/radeon: AGP memory is only I/O if
> > > the aperture can be mapped by the CPU.).
> > > 
> > > The patch fixes the following error seen on G5 iMac:
> > > 
> > > 	nouveau E[     DRM] failed to create kernel channel, -12
> > > 
> > > Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > ---
> > >  drivers/gpu/drm/nouveau/nouveau_bo.c |    2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > index 35ac57f..5f0e7ef 100644
> > > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> > > @@ -1279,7 +1279,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
> > >  		if (drm->agp.stat == ENABLED) {
> > >  			mem->bus.offset = mem->start << PAGE_SHIFT;
> > >  			mem->bus.base = drm->agp.base;
> > > -			mem->bus.is_iomem = true;
> > > +			mem->bus.is_iomem = !dev->agp->cant_use_aperture;
> > 
> > Looks good, though radeon also doesn't set TTM_MEMTYPE_FLAG_MAPPABLE for
> > the TT memory type if the aperture can't be mapped directly. Maybe
> > nouveau should do the same, or maybe it doesn't really matter. Not sure.
> 
> This would fail with -EINVAL if the MAPPABLE flag is not set. So I think
> it's needed?
> 
> Looking at radeon_ttm.c, the MAPPABLE flag seems to be set in both cases:

Ah, indeed, I misread that. Your patch is

Reviewed-by: Michel Dänzer <michel@daenzer.net>
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 35ac57f..5f0e7ef 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1279,7 +1279,7 @@  nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
 		if (drm->agp.stat == ENABLED) {
 			mem->bus.offset = mem->start << PAGE_SHIFT;
 			mem->bus.base = drm->agp.base;
-			mem->bus.is_iomem = true;
+			mem->bus.is_iomem = !dev->agp->cant_use_aperture;
 		}
 #endif
 		break;