Skip to contentSkip to conversation

agp/intel: Fix dma mask for Sandybridge

PATCH Applied Takashi Iwai 3 participants 10 messages Aug 20, 2010 – Aug 23, 2010 Agpgart driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 agp/intel: Fix dma mask for Sandybridge

Sandybridge requires 36bit dma mask, but the current code checks only against i965, thus it gives Oops with i915 probing on 32bit machine:

nommu_map_sg: overflow 14a000000+4096 of device mask ffffffff [drm:drm_agp_bind_pages] *ERROR* Failed to bind AGP memory: -12

   BUG: unable to handle kernel paging request at fffffff8
   IP: [<f7fac57f>] i915_gem_evict_something+0xef/0x230 [i915]
   ...
---
 drivers/char/agp/intel-agp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/char/agp/intel-agp.c +2 -1
index ddf5def..c563a60 100644
@@ -845,7 +845,8 @@ static int __devinit intel_gmch_probe(struct pci_dev *pdev,
 
 	dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
 
-	if (bridge->driver->mask_memory == intel_i965_mask_memory) {
+	if (bridge->driver->mask_memory == intel_i965_mask_memory ||
+	    bridge->driver->mask_memory == intel_gen6_mask_memory) {
 		if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(36)))
 			dev_err(&intel_private.pcidev->dev,
 				"set gfx device dma mask 36bit failed!\n");
Signature · 1 line
1.7.2.1
#1 lore raw
Quoted 8 lines · Takashi Iwai

Sandybridge requires 36bit dma mask, but the current code checks only against i965, thus it gives Oops with i915 probing on 32bit machine:

nommu_map_sg: overflow 14a000000+4096 of device mask ffffffff [drm:drm_agp_bind_pages] *ERROR* Failed to bind AGP memory: -12

   BUG: unable to handle kernel paging request at fffffff8
   IP: [<f7fac57f>] i915_gem_evict_something+0xef/0x230 [i915]
   ...

Sandybridge can do 40-bit dma mask. This has been fixed upstream now.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
#2 lore raw

At Mon, 23 Aug 2010 09:35:07 +0800,

Quoted 5 lines · Zhenyu Wang
Quoted 3 lines · Takashi Iwai

Sandybridge requires 36bit dma mask, but the current code checks only against i965, thus it gives Oops with i915 probing on 32bit machine:

Quoted 7 lines
Quoted 5 lines

nommu_map_sg: overflow 14a000000+4096 of device mask ffffffff [drm:drm_agp_bind_pages] *ERROR* Failed to bind AGP memory: -12

   BUG: unable to handle kernel paging request at fffffff8
   IP: [<f7fac57f>] i915_gem_evict_something+0xef/0x230 [i915]
   ...

Sandybridge can do 40-bit dma mask. This has been fixed upstream now.

Could you point where is the upstream GIT tree and the corresponding commit id?

thanks,

Takashi

#3 lore raw
Quoted 5 lines · Takashi Iwai
Quoted 1 line

Sandybridge can do 40-bit dma mask. This has been fixed upstream now.

Could you point where is the upstream GIT tree and the corresponding commit id?

Linus's tree:

commit 877fdacf8291d7627f339885b5ae52c2f6061734

Author: Zhenyu Wang <[email protected]>
Date:   Thu Aug 19 09:46:13 2010 +0800

agp/intel: set 40-bit dma mask on Sandybridge

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
#4 lore raw

At Mon, 23 Aug 2010 13:43:03 +0800,

Quoted 10 lines · Zhenyu Wang
Quoted 5 lines · Takashi Iwai
Quoted 1 line

Sandybridge can do 40-bit dma mask. This has been fixed upstream now.

Could you point where is the upstream GIT tree and the corresponding commit id?

Linus's tree:

Quoted 8 lines

commit 877fdacf8291d7627f339885b5ae52c2f6061734

Author: Zhenyu Wang <[email protected]>
Date:   Thu Aug 19 09:46:13 2010 +0800

agp/intel: set 40-bit dma mask on Sandybridge

Thanks.

But, isn't it better to add .dma_mask field to struct agp_bridge_driver?

Also, I don't understand the logic of 40bit addr calculation:

Quoted 5 lines

static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
dma_addr_t addr, int type)

{
        /* Shift high bits down */
       addr |= (addr >> 28) & 0xff;

Isn't it 0xff0?

Takashi

#5 lore raw

At Mon, 23 Aug 2010 08:02:42 +0200,

Quoted 29 lines · I wrote:

At Mon, 23 Aug 2010 13:43:03 +0800,

Quoted 10 lines · Zhenyu Wang
Quoted 5 lines · Takashi Iwai
Quoted 1 line

Sandybridge can do 40-bit dma mask. This has been fixed upstream now.

Could you point where is the upstream GIT tree and the corresponding commit id?

Linus's tree:

Quoted 8 lines

commit 877fdacf8291d7627f339885b5ae52c2f6061734

Author: Zhenyu Wang <[email protected]>
Date:   Thu Aug 19 09:46:13 2010 +0800

agp/intel: set 40-bit dma mask on Sandybridge

Thanks.

But, isn't it better to add .dma_mask field to struct agp_bridge_driver?

Also, I don't understand the logic of 40bit addr calculation:

Quoted 7 lines
Quoted 5 lines

static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
dma_addr_t addr, int type)

{
        /* Shift high bits down */
       addr |= (addr >> 28) & 0xff;

Isn't it 0xff0?

Or, it's rather meant (addr >> 32) & 0xff?
If so, better to be upper_32_bits(addr) & 0xff...

thanks,

Takashi

#6 lore raw
In reply to Takashi Iwai
Quoted 11 lines · Takashi Iwai

Also, I don't understand the logic of 40bit addr calculation:

Quoted 5 lines

static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
dma_addr_t addr, int type)

{
        /* Shift high bits down */
       addr |= (addr >> 28) & 0xff;

Isn't it 0xff0?

No. This depends on hw 32bit PTE format for sandybridge.

bit 31 bit 11 bit 4 bit 0
|<-physical addr 31:12->|<-physical addr 39:32->|<-cache ctl 3:1->|valid|

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
#7 lore raw

At Mon, 23 Aug 2010 14:19:22 +0800,

Quoted 11 lines · Zhenyu Wang
Quoted 9 lines · Takashi Iwai

Also, I don't understand the logic of 40bit addr calculation:

Quoted 5 lines

static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
dma_addr_t addr, int type)

{
        /* Shift high bits down */
       addr |= (addr >> 28) & 0xff;
Quoted 7 lines
Quoted 2 lines

Isn't it 0xff0?

No. This depends on hw 32bit PTE format for sandybridge.

bit 31 bit 11 bit 4 bit 0
|<-physical addr 31:12->|<-physical addr 39:32->|<-cache ctl 3:1->|valid|

Then I really don't understand why it works.
You shift 28bit and mask with 0xff. Obviously it overwrite bits 0:3 with original 28:31 bits. Masking 0xff0 fixes the issue.

And, the information like above would be greatly helpful if put into either changelog or comment...

thanks,

Takashi

#8 lore raw
Quoted 7 lines · Takashi Iwai
Quoted 2 lines

bit 31 bit 11 bit 4 bit 0
|<-physical addr 31:12->|<-physical addr 39:32->|<-cache ctl 3:1->|valid|

Then I really don't understand why it works.
You shift 28bit and mask with 0xff. Obviously it overwrite bits 0:3 with original 28:31 bits. Masking 0xff0 fixes the issue.

ah, sorry, my stupid. Thanks for catching this!

Subject: [PATCH] agp/intel: fix physical address mask bits for sandybridge

It should shift bit 39-32 into pte's bit 11-4.

---
 drivers/char/agp/intel-gtt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/agp/intel-gtt.c +2 -2
index d22ffb8..0edfc87 100644
@@ -1333,8 +1333,8 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge,
 static unsigned long intel_gen6_mask_memory(struct agp_bridge_data *bridge,
 					    dma_addr_t addr, int type)
 {
-	/* Shift high bits down */
-	addr |= (addr >> 28) & 0xff;
+	/* gen6 has bit11-4 for physical addr bit39-32 */
+	addr |= (addr >> 28) & 0xff0;
 
 	/* Type checking must be done elsewhere */
 	return addr | bridge->driver->masks[type].mask;
Signature · 6 lines
1.7.0.4

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
Applied
#9 lore raw
Quoted 9 lines · Zhenyu Wang
Quoted 7 lines · Takashi Iwai
Quoted 2 lines

bit 31 bit 11 bit 4 bit 0
|<-physical addr 31:12->|<-physical addr 39:32->|<-cache ctl 3:1->|valid|

Then I really don't understand why it works.
You shift 28bit and mask with 0xff. Obviously it overwrite bits 0:3 with original 28:31 bits. Masking 0xff0 fixes the issue.

Quoted 5 lines

ah, sorry, my stupid. Thanks for catching this!

Subject: [PATCH] agp/intel: fix physical address mask bits for sandybridge

It should shift bit 39-32 into pte's bit 11-4.

Applied. Thanks!

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel