linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] alpha, drm: Add Alpha support to Radeon DRM code
@ 2011-06-09 22:20 Jay Estabrook
  2011-06-13 23:35 ` Dave Airlie
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Estabrook @ 2011-06-09 22:20 UTC (permalink / raw)
  To: linux-alpha, linux-kernel, dri-devel
  Cc: Matt Turner, Richard Henderson, Ivan Kokshaysky, Jay Estabrook, airlied


Alpha needs to have the system bus address for the device's local
memory available, so that it can be returned to user-level, where
it may be used in an mmap(). So, we make bus.addr hold the ioremap()
return for kernel use, and then we can modify bus.base appropriately.

Signed-off-by: Jay Estabrook <jay.estabrook@gmail.com>
---
 drivers/gpu/drm/radeon/radeon_ttm.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff -Naurp a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
--- a/drivers/gpu/drm/radeon/radeon_ttm.c	2011-04-26 23:48:50.000000000 -0400
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c	2011-05-03 18:24:27.000000000 -0400
@@ -450,6 +450,29 @@ static int radeon_ttm_io_mem_reserve(str
 			return -EINVAL;
 		mem->bus.base = rdev->mc.aper_base;
 		mem->bus.is_iomem = true;
+#ifdef __alpha__
+		/*
+		 * Alpha: use bus.addr to hold the ioremap() return,
+		 * so we can modify bus.base below.
+		 */
+		if (mem->placement & TTM_PL_FLAG_WC)
+			mem->bus.addr =
+				ioremap_wc(mem->bus.base + mem->bus.offset,
+					   mem->bus.size);
+		else
+			mem->bus.addr =
+				ioremap_nocache(mem->bus.base + mem->bus.offset,
+						mem->bus.size);
+
+		/*
+		 * Alpha: Take just the bus offset and
+		 * add the hose/domain memory base.
+		 * Then, bus.base can be returned
+		 * for use in an mmap() call.
+		 */
+		mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
+			rdev->ddev->hose->dense_mem_base;
+#endif
 		break;
 	default:
 		return -EINVAL;

---

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

* Re: [PATCH 3/3] alpha, drm: Add Alpha support to Radeon DRM code
  2011-06-09 22:20 [PATCH 3/3] alpha, drm: Add Alpha support to Radeon DRM code Jay Estabrook
@ 2011-06-13 23:35 ` Dave Airlie
  2011-06-15  2:38   ` Jay Estabrook
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Airlie @ 2011-06-13 23:35 UTC (permalink / raw)
  To: Jay Estabrook
  Cc: linux-alpha, linux-kernel, dri-devel, Matt Turner,
	Richard Henderson, Ivan Kokshaysky, airlied

On Fri, Jun 10, 2011 at 8:20 AM, Jay Estabrook <jay.estabrook@gmail.com> wrote:
>
> Alpha needs to have the system bus address for the device's local
> memory available, so that it can be returned to user-level, where
> it may be used in an mmap(). So, we make bus.addr hold the ioremap()
> return for kernel use, and then we can modify bus.base appropriately.
>

I don't get this. why is mmap passing in an address? we don't do that anymore.

When you mmap the device node it passes back a hashed offset in the
table, that the
kernel then translates into a proper address and sets up the page tables.

So I really don't get what this patch is doing, either the
explaination of what it is doing is wrong
or it is wrong.

Dave.

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

* Re: [PATCH 3/3] alpha, drm: Add Alpha support to Radeon DRM code
  2011-06-13 23:35 ` Dave Airlie
@ 2011-06-15  2:38   ` Jay Estabrook
  0 siblings, 0 replies; 3+ messages in thread
From: Jay Estabrook @ 2011-06-15  2:38 UTC (permalink / raw)
  To: Dave Airlie
  Cc: linux-alpha, linux-kernel, dri-devel, Matt Turner,
	Richard Henderson, Ivan Kokshaysky, airlied

Hi, Dave,

It is the explanation that is inaccurate; I was still thinking about mmap when
the new paradigm is to do the mapping when the VM faults.

I believe the code that requires this patch is: ttm/ttm_bo_vm.c: ttm_bo_vm_fault(),
specifically:

    for (i = 0; i < TTM_BO_VM_NUM_PREFAULT; ++i) {
        if (bo->mem.bus.is_iomem)
            pfn = ((bo->mem.bus.base + bo->mem.bus.offset) >> PAGE_SHIFT) + page_offset;
        else {

The "pfn" needs to reflect the correct system bus address to get to the VRAM
on the graphics card.

I will rework the commentary and resend.

Thanks for the feedback.

Jay


On 06/13/2011 07:35 PM, Dave Airlie wrote:
> On Fri, Jun 10, 2011 at 8:20 AM, Jay Estabrook <jay.estabrook@gmail.com> wrote:
>> Alpha needs to have the system bus address for the device's local
>> memory available, so that it can be returned to user-level, where
>> it may be used in an mmap(). So, we make bus.addr hold the ioremap()
>> return for kernel use, and then we can modify bus.base appropriately.
>>
> 
> I don't get this. why is mmap passing in an address? we don't do that anymore.
> 
> When you mmap the device node it passes back a hashed offset in the
> table, that the
> kernel then translates into a proper address and sets up the page tables.
> 
> So I really don't get what this patch is doing, either the
> explaination of what it is doing is wrong
> or it is wrong.
> 
> Dave.

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

end of thread, other threads:[~2011-06-15  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 22:20 [PATCH 3/3] alpha, drm: Add Alpha support to Radeon DRM code Jay Estabrook
2011-06-13 23:35 ` Dave Airlie
2011-06-15  2:38   ` Jay Estabrook

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