Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 247d36d7 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Dave Airlie
Browse files

drm (ast, cirrus, mgag200, nouveau, savage, vmwgfx): Remove drm_mtrr_{add, del}



This replaces drm_mtrr_{add,del} with arch_phys_wc_{add,del}.  The
interface is simplified (because the base and size parameters to
drm_mtrr_del never did anything), and it no longer adds MTRRs on
systems that don't need them.

Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent d0d98eed
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -271,26 +271,19 @@ int ast_mm_init(struct ast_private *ast)
		return ret;
	}

	ast->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
				    pci_resource_len(dev->pdev, 0),
				    DRM_MTRR_WC);
	ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
					pci_resource_len(dev->pdev, 0));

	return 0;
}

void ast_mm_fini(struct ast_private *ast)
{
	struct drm_device *dev = ast->dev;
	ttm_bo_device_release(&ast->ttm.bdev);

	ast_ttm_global_release(ast);

	if (ast->fb_mtrr >= 0) {
		drm_mtrr_del(ast->fb_mtrr,
			     pci_resource_start(dev->pdev, 0),
			     pci_resource_len(dev->pdev, 0), DRM_MTRR_WC);
		ast->fb_mtrr = -1;
	}
	arch_phys_wc_del(ast->fb_mtrr);
}

void ast_ttm_placement(struct ast_bo *bo, int domain)
+4 −11
Original line number Diff line number Diff line
@@ -271,9 +271,8 @@ int cirrus_mm_init(struct cirrus_device *cirrus)
		return ret;
	}

	cirrus->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
				    pci_resource_len(dev->pdev, 0),
				    DRM_MTRR_WC);
	cirrus->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
					   pci_resource_len(dev->pdev, 0));

	cirrus->mm_inited = true;
	return 0;
@@ -281,8 +280,6 @@ int cirrus_mm_init(struct cirrus_device *cirrus)

void cirrus_mm_fini(struct cirrus_device *cirrus)
{
	struct drm_device *dev = cirrus->dev;

	if (!cirrus->mm_inited)
		return;

@@ -290,12 +287,8 @@ void cirrus_mm_fini(struct cirrus_device *cirrus)

	cirrus_ttm_global_release(cirrus);

	if (cirrus->fb_mtrr >= 0) {
		drm_mtrr_del(cirrus->fb_mtrr,
			     pci_resource_start(dev->pdev, 0),
			     pci_resource_len(dev->pdev, 0), DRM_MTRR_WC);
		cirrus->fb_mtrr = -1;
	}
	arch_phys_wc_del(cirrus->fb_mtrr);
	cirrus->fb_mtrr = 0;
}

void cirrus_ttm_placement(struct cirrus_bo *bo, int domain)
+4 −10
Original line number Diff line number Diff line
@@ -270,26 +270,20 @@ int mgag200_mm_init(struct mga_device *mdev)
		return ret;
	}

	mdev->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
				    pci_resource_len(dev->pdev, 0),
				    DRM_MTRR_WC);
	mdev->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
					 pci_resource_len(dev->pdev, 0));

	return 0;
}

void mgag200_mm_fini(struct mga_device *mdev)
{
	struct drm_device *dev = mdev->dev;
	ttm_bo_device_release(&mdev->ttm.bdev);

	mgag200_ttm_global_release(mdev);

	if (mdev->fb_mtrr >= 0) {
		drm_mtrr_del(mdev->fb_mtrr,
			     pci_resource_start(dev->pdev, 0),
			     pci_resource_len(dev->pdev, 0), DRM_MTRR_WC);
		mdev->fb_mtrr = -1;
	}
	arch_phys_wc_del(mdev->fb_mtrr);
	mdev->fb_mtrr = 0;
}

void mgag200_ttm_placement(struct mgag200_bo *bo, int domain)
+4 −9
Original line number Diff line number Diff line
@@ -396,9 +396,8 @@ nouveau_ttm_init(struct nouveau_drm *drm)
		return ret;
	}

	drm->ttm.mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 1),
				     pci_resource_len(dev->pdev, 1),
				     DRM_MTRR_WC);
	drm->ttm.mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 1),
					 pci_resource_len(dev->pdev, 1));

	/* GART init */
	if (drm->agp.stat != ENABLED) {
@@ -433,10 +432,6 @@ nouveau_ttm_fini(struct nouveau_drm *drm)

	nouveau_ttm_global_release(drm);

	if (drm->ttm.mtrr >= 0) {
		drm_mtrr_del(drm->ttm.mtrr,
			     pci_resource_start(drm->dev->pdev, 1),
			     pci_resource_len(drm->dev->pdev, 1), DRM_MTRR_WC);
		drm->ttm.mtrr = -1;
	}
	arch_phys_wc_del(drm->ttm.mtrr);
	drm->ttm.mtrr = 0;
}
+15 −28
Original line number Diff line number Diff line
@@ -570,9 +570,6 @@ int savage_driver_firstopen(struct drm_device *dev)
	unsigned int fb_rsrc, aper_rsrc;
	int ret = 0;

	dev_priv->mtrr[0].handle = -1;
	dev_priv->mtrr[1].handle = -1;
	dev_priv->mtrr[2].handle = -1;
	if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
		fb_rsrc = 0;
		fb_base = pci_resource_start(dev->pdev, 0);
@@ -584,21 +581,14 @@ int savage_driver_firstopen(struct drm_device *dev)
		if (pci_resource_len(dev->pdev, 0) == 0x08000000) {
			/* Don't make MMIO write-cobining! We need 3
			 * MTRRs. */
			dev_priv->mtrr[0].base = fb_base;
			dev_priv->mtrr[0].size = 0x01000000;
			dev_priv->mtrr[0].handle =
			    drm_mtrr_add(dev_priv->mtrr[0].base,
				         dev_priv->mtrr[0].size, DRM_MTRR_WC);
			dev_priv->mtrr[1].base = fb_base + 0x02000000;
			dev_priv->mtrr[1].size = 0x02000000;
			dev_priv->mtrr[1].handle =
			    drm_mtrr_add(dev_priv->mtrr[1].base,
					 dev_priv->mtrr[1].size, DRM_MTRR_WC);
			dev_priv->mtrr[2].base = fb_base + 0x04000000;
			dev_priv->mtrr[2].size = 0x04000000;
			dev_priv->mtrr[2].handle =
			    drm_mtrr_add(dev_priv->mtrr[2].base,
					 dev_priv->mtrr[2].size, DRM_MTRR_WC);
			dev_priv->mtrr_handles[0] =
				arch_phys_wc_add(fb_base, 0x01000000);
			dev_priv->mtrr_handles[1] =
				arch_phys_wc_add(fb_base + 0x02000000,
						 0x02000000);
			dev_priv->mtrr_handles[2] =
				arch_phys_wc_add(fb_base + 0x04000000,
						0x04000000);
		} else {
			DRM_ERROR("strange pci_resource_len %08llx\n",
				  (unsigned long long)
@@ -616,11 +606,9 @@ int savage_driver_firstopen(struct drm_device *dev)
		if (pci_resource_len(dev->pdev, 1) == 0x08000000) {
			/* Can use one MTRR to cover both fb and
			 * aperture. */
			dev_priv->mtrr[0].base = fb_base;
			dev_priv->mtrr[0].size = 0x08000000;
			dev_priv->mtrr[0].handle =
			    drm_mtrr_add(dev_priv->mtrr[0].base,
					 dev_priv->mtrr[0].size, DRM_MTRR_WC);
			dev_priv->mtrr_handles[0] =
				arch_phys_wc_add(fb_base,
						 0x08000000);
		} else {
			DRM_ERROR("strange pci_resource_len %08llx\n",
				  (unsigned long long)
@@ -660,11 +648,10 @@ void savage_driver_lastclose(struct drm_device *dev)
	drm_savage_private_t *dev_priv = dev->dev_private;
	int i;

	for (i = 0; i < 3; ++i)
		if (dev_priv->mtrr[i].handle >= 0)
			drm_mtrr_del(dev_priv->mtrr[i].handle,
				 dev_priv->mtrr[i].base,
				 dev_priv->mtrr[i].size, DRM_MTRR_WC);
	for (i = 0; i < 3; ++i) {
		arch_phys_wc_del(dev_priv->mtrr_handles[i]);
		dev_priv->mtrr_handles[i] = 0;
	}
}

int savage_driver_unload(struct drm_device *dev)
Loading