Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart

* master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart:
[AGPGART] drivers/char/agp/sgi-agp.c: check kmalloc() return value
[AGPGART] Fix PCI-posting flush typo.
[AGPGART] fix detection of aperture size versus GTT size on G965
[AGPGART] Remove unnecessary flushes when inserting and removing pages.
[AGPGART] K8M890 support for amd-k8.

+127 -79
+4
drivers/char/agp/agp.h
··· 225 225 #define I810_GMS_DISABLE 0x00000000 226 226 #define I810_PGETBL_CTL 0x2020 227 227 #define I810_PGETBL_ENABLED 0x00000001 228 + #define I965_PGETBL_SIZE_MASK 0x0000000e 229 + #define I965_PGETBL_SIZE_512KB (0 << 1) 230 + #define I965_PGETBL_SIZE_256KB (1 << 1) 231 + #define I965_PGETBL_SIZE_128KB (2 << 1) 228 232 #define I810_DRAM_CTL 0x3000 229 233 #define I810_DRAM_ROW_0 0x00000001 230 234 #define I810_DRAM_ROW_0_SDRAM 0x00000001
+9
drivers/char/agp/amd64-agp.c
··· 650 650 .subvendor = PCI_ANY_ID, 651 651 .subdevice = PCI_ANY_ID, 652 652 }, 653 + /* VIA K8M890 / K8N890 */ 654 + { 655 + .class = (PCI_CLASS_BRIDGE_HOST << 8), 656 + .class_mask = ~0, 657 + .vendor = PCI_VENDOR_ID_VIA, 658 + .device = PCI_DEVICE_ID_VIA_K8M890CE, 659 + .subvendor = PCI_ANY_ID, 660 + .subdevice = PCI_ANY_ID, 661 + }, 653 662 /* VIA K8T890 */ 654 663 { 655 664 .class = (PCI_CLASS_BRIDGE_HOST << 8),
+8 -3
drivers/char/agp/generic.c
··· 965 965 if (!bridge) 966 966 return -EINVAL; 967 967 968 + if (mem->page_count == 0) 969 + return 0; 970 + 968 971 temp = bridge->current_size; 969 972 970 973 switch (bridge->driver->size_type) { ··· 1019 1016 1020 1017 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 1021 1018 writel(bridge->driver->mask_memory(bridge, mem->memory[i], mem->type), bridge->gatt_table+j); 1022 - readl(bridge->gatt_table+j); /* PCI Posting. */ 1023 1019 } 1020 + readl(bridge->gatt_table+j-1); /* PCI Posting. */ 1024 1021 1025 1022 bridge->driver->tlb_flush(mem); 1026 1023 return 0; ··· 1037 1034 if (!bridge) 1038 1035 return -EINVAL; 1039 1036 1037 + if (mem->page_count == 0) 1038 + return 0; 1039 + 1040 1040 if (type != 0 || mem->type != 0) { 1041 1041 /* The generic routines know nothing of memory types */ 1042 1042 return -EINVAL; ··· 1048 1042 /* AK: bogus, should encode addresses > 4GB */ 1049 1043 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 1050 1044 writel(bridge->scratch_page, bridge->gatt_table+i); 1051 - readl(bridge->gatt_table+i); /* PCI Posting. */ 1052 1045 } 1046 + readl(bridge->gatt_table+i-1); /* PCI Posting. */ 1053 1047 1054 - global_cache_flush(); 1055 1048 bridge->driver->tlb_flush(mem); 1056 1049 return 0; 1057 1050 }
+100 -72
drivers/char/agp/intel-agp.c
··· 207 207 int i, j, num_entries; 208 208 void *temp; 209 209 210 + if (mem->page_count == 0) 211 + return 0; 212 + 210 213 temp = agp_bridge->current_size; 211 214 num_entries = A_SIZE_FIX(temp)->num_entries; 212 215 ··· 224 221 if (type != 0 || mem->type != 0) { 225 222 if ((type == AGP_DCACHE_MEMORY) && (mem->type == AGP_DCACHE_MEMORY)) { 226 223 /* special insert */ 227 - global_cache_flush(); 224 + if (!mem->is_flushed) { 225 + global_cache_flush(); 226 + mem->is_flushed = TRUE; 227 + } 228 + 228 229 for (i = pg_start; i < (pg_start + mem->page_count); i++) { 229 230 writel((i*4096)|I810_PTE_LOCAL|I810_PTE_VALID, intel_i810_private.registers+I810_PTE_BASE+(i*4)); 230 - readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ 231 231 } 232 - global_cache_flush(); 232 + readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */ 233 + 233 234 agp_bridge->driver->tlb_flush(mem); 234 235 return 0; 235 236 } ··· 243 236 } 244 237 245 238 insert: 246 - global_cache_flush(); 239 + if (!mem->is_flushed) { 240 + global_cache_flush(); 241 + mem->is_flushed = TRUE; 242 + } 243 + 247 244 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 248 245 writel(agp_bridge->driver->mask_memory(agp_bridge, 249 246 mem->memory[i], mem->type), 250 247 intel_i810_private.registers+I810_PTE_BASE+(j*4)); 251 - readl(intel_i810_private.registers+I810_PTE_BASE+(j*4)); /* PCI Posting. */ 252 248 } 253 - global_cache_flush(); 249 + readl(intel_i810_private.registers+I810_PTE_BASE+((j-1)*4)); /* PCI Posting. */ 254 250 255 251 agp_bridge->driver->tlb_flush(mem); 256 252 return 0; ··· 264 254 { 265 255 int i; 266 256 257 + if (mem->page_count == 0) 258 + return 0; 259 + 267 260 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 268 261 writel(agp_bridge->scratch_page, intel_i810_private.registers+I810_PTE_BASE+(i*4)); 269 - readl(intel_i810_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ 270 262 } 263 + readl(intel_i810_private.registers+I810_PTE_BASE+((i-1)*4)); 271 264 272 - global_cache_flush(); 273 265 agp_bridge->driver->tlb_flush(mem); 274 266 return 0; 275 267 } ··· 382 370 struct pci_dev *i830_dev; /* device one */ 383 371 volatile u8 __iomem *registers; 384 372 volatile u32 __iomem *gtt; /* I915G */ 373 + /* gtt_entries is the number of gtt entries that are already mapped 374 + * to stolen memory. Stolen memory is larger than the memory mapped 375 + * through gtt_entries, as it includes some reserved space for the BIOS 376 + * popup and for the GTT. 377 + */ 385 378 int gtt_entries; 386 379 } intel_i830_private; 387 380 ··· 397 380 u8 rdct; 398 381 int local = 0; 399 382 static const int ddt[4] = { 0, 16, 32, 64 }; 400 - int size; 383 + int size; /* reserved space (in kb) at the top of stolen memory */ 401 384 402 385 pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 403 386 404 - /* We obtain the size of the GTT, which is also stored (for some 405 - * reason) at the top of stolen memory. Then we add 4KB to that 406 - * for the video BIOS popup, which is also stored in there. */ 407 - size = agp_bridge->driver->fetch_size() + 4; 387 + if (IS_I965) { 388 + u32 pgetbl_ctl; 389 + 390 + pci_read_config_dword(agp_bridge->dev, I810_PGETBL_CTL, 391 + &pgetbl_ctl); 392 + /* The 965 has a field telling us the size of the GTT, 393 + * which may be larger than what is necessary to map the 394 + * aperture. 395 + */ 396 + switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) { 397 + case I965_PGETBL_SIZE_128KB: 398 + size = 128; 399 + break; 400 + case I965_PGETBL_SIZE_256KB: 401 + size = 256; 402 + break; 403 + case I965_PGETBL_SIZE_512KB: 404 + size = 512; 405 + break; 406 + default: 407 + printk(KERN_INFO PFX "Unknown page table size, " 408 + "assuming 512KB\n"); 409 + size = 512; 410 + } 411 + size += 4; /* add in BIOS popup space */ 412 + } else { 413 + /* On previous hardware, the GTT size was just what was 414 + * required to map the aperture. 415 + */ 416 + size = agp_bridge->driver->fetch_size() + 4; 417 + } 408 418 409 419 if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || 410 420 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { ··· 620 576 int i,j,num_entries; 621 577 void *temp; 622 578 579 + if (mem->page_count == 0) 580 + return 0; 581 + 623 582 temp = agp_bridge->current_size; 624 583 num_entries = A_SIZE_FIX(temp)->num_entries; 625 584 ··· 645 598 (mem->type != 0 && mem->type != AGP_PHYS_MEMORY)) 646 599 return -EINVAL; 647 600 648 - global_cache_flush(); /* FIXME: Necessary ?*/ 601 + if (!mem->is_flushed) { 602 + global_cache_flush(); 603 + mem->is_flushed = TRUE; 604 + } 649 605 650 606 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 651 607 writel(agp_bridge->driver->mask_memory(agp_bridge, 652 608 mem->memory[i], mem->type), 653 609 intel_i830_private.registers+I810_PTE_BASE+(j*4)); 654 - readl(intel_i830_private.registers+I810_PTE_BASE+(j*4)); /* PCI Posting. */ 655 610 } 611 + readl(intel_i830_private.registers+I810_PTE_BASE+((j-1)*4)); 656 612 657 - global_cache_flush(); 658 613 agp_bridge->driver->tlb_flush(mem); 659 614 return 0; 660 615 } ··· 666 617 { 667 618 int i; 668 619 669 - global_cache_flush(); 620 + if (mem->page_count == 0) 621 + return 0; 670 622 671 623 if (pg_start < intel_i830_private.gtt_entries) { 672 624 printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); ··· 676 626 677 627 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 678 628 writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4)); 679 - readl(intel_i830_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */ 680 629 } 630 + readl(intel_i830_private.registers+I810_PTE_BASE+((i-1)*4)); 681 631 682 - global_cache_flush(); 683 632 agp_bridge->driver->tlb_flush(mem); 684 633 return 0; 685 634 } ··· 735 686 int i,j,num_entries; 736 687 void *temp; 737 688 689 + if (mem->page_count == 0) 690 + return 0; 691 + 738 692 temp = agp_bridge->current_size; 739 693 num_entries = A_SIZE_FIX(temp)->num_entries; 740 694 ··· 760 708 (mem->type != 0 && mem->type != AGP_PHYS_MEMORY)) 761 709 return -EINVAL; 762 710 763 - global_cache_flush(); 711 + if (!mem->is_flushed) { 712 + global_cache_flush(); 713 + mem->is_flushed = TRUE; 714 + } 764 715 765 716 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 766 717 writel(agp_bridge->driver->mask_memory(agp_bridge, 767 718 mem->memory[i], mem->type), intel_i830_private.gtt+j); 768 - readl(intel_i830_private.gtt+j); /* PCI Posting. */ 769 719 } 720 + readl(intel_i830_private.gtt+j-1); 770 721 771 - global_cache_flush(); 772 722 agp_bridge->driver->tlb_flush(mem); 773 723 return 0; 774 724 } ··· 780 726 { 781 727 int i; 782 728 783 - global_cache_flush(); 729 + if (mem->page_count == 0) 730 + return 0; 784 731 785 732 if (pg_start < intel_i830_private.gtt_entries) { 786 733 printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); ··· 790 735 791 736 for (i = pg_start; i < (mem->page_count + pg_start); i++) { 792 737 writel(agp_bridge->scratch_page, intel_i830_private.gtt+i); 793 - readl(intel_i830_private.gtt+i); 794 738 } 739 + readl(intel_i830_private.gtt+i-1); 795 740 796 - global_cache_flush(); 797 741 agp_bridge->driver->tlb_flush(mem); 798 742 return 0; 799 743 } 800 744 801 - static int intel_i915_fetch_size(void) 745 + /* Return the aperture size by just checking the resource length. The effect 746 + * described in the spec of the MSAC registers is just changing of the 747 + * resource size. 748 + */ 749 + static int intel_i9xx_fetch_size(void) 802 750 { 803 - struct aper_size_info_fixed *values; 804 - u32 temp, offset; 751 + int num_sizes = sizeof(intel_i830_sizes) / sizeof(*intel_i830_sizes); 752 + int aper_size; /* size in megabytes */ 753 + int i; 805 754 806 - #define I915_256MB_ADDRESS_MASK (1<<27) 755 + aper_size = pci_resource_len(intel_i830_private.i830_dev, 2) / MB(1); 807 756 808 - values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes); 757 + for (i = 0; i < num_sizes; i++) { 758 + if (aper_size == intel_i830_sizes[i].size) { 759 + agp_bridge->current_size = intel_i830_sizes + i; 760 + agp_bridge->previous_size = agp_bridge->current_size; 761 + return aper_size; 762 + } 763 + } 809 764 810 - pci_read_config_dword(intel_i830_private.i830_dev, I915_GMADDR, &temp); 811 - if (temp & I915_256MB_ADDRESS_MASK) 812 - offset = 0; /* 128MB aperture */ 813 - else 814 - offset = 2; /* 256MB aperture */ 815 - agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); 816 - return values[offset].size; 765 + return 0; 817 766 } 818 767 819 768 /* The intel i915 automatically initializes the agp aperture during POST. ··· 880 821 return addr | bridge->driver->masks[type].mask; 881 822 } 882 823 883 - static int intel_i965_fetch_size(void) 884 - { 885 - struct aper_size_info_fixed *values; 886 - u32 offset = 0; 887 - u8 temp; 888 - 889 - #define I965_512MB_ADDRESS_MASK (3<<1) 890 - 891 - values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes); 892 - 893 - pci_read_config_byte(intel_i830_private.i830_dev, I965_MSAC, &temp); 894 - temp &= I965_512MB_ADDRESS_MASK; 895 - switch (temp) { 896 - case 0x00: 897 - offset = 0; /* 128MB */ 898 - break; 899 - case 0x06: 900 - offset = 3; /* 512MB */ 901 - break; 902 - default: 903 - case 0x02: 904 - offset = 2; /* 256MB */ 905 - break; 906 - } 907 - 908 - agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); 909 - 910 - /* The i965 GTT is always sized as if it had a 512kB aperture size */ 911 - return 512; 912 - } 913 - 914 824 /* The intel i965 automatically initializes the agp aperture during POST. 915 - + * Use the memory already set aside for in the GTT. 916 - + */ 825 + * Use the memory already set aside for in the GTT. 826 + */ 917 827 static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) 918 828 { 919 829 int page_order; ··· 1602 1574 .num_aperture_sizes = 4, 1603 1575 .needs_scratch_page = TRUE, 1604 1576 .configure = intel_i915_configure, 1605 - .fetch_size = intel_i915_fetch_size, 1577 + .fetch_size = intel_i9xx_fetch_size, 1606 1578 .cleanup = intel_i915_cleanup, 1607 1579 .tlb_flush = intel_i810_tlbflush, 1608 1580 .mask_memory = intel_i810_mask_memory, ··· 1626 1598 .num_aperture_sizes = 4, 1627 1599 .needs_scratch_page = TRUE, 1628 1600 .configure = intel_i915_configure, 1629 - .fetch_size = intel_i965_fetch_size, 1601 + .fetch_size = intel_i9xx_fetch_size, 1630 1602 .cleanup = intel_i915_cleanup, 1631 1603 .tlb_flush = intel_i810_tlbflush, 1632 1604 .mask_memory = intel_i965_mask_memory,
+5 -4
drivers/char/agp/sgi-agp.c
··· 281 281 else 282 282 return 0; 283 283 284 - sgi_tioca_agp_bridges = 285 - (struct agp_bridge_data **)kmalloc(tioca_gart_found * 286 - sizeof(struct agp_bridge_data *), 287 - GFP_KERNEL); 284 + sgi_tioca_agp_bridges = kmalloc(tioca_gart_found * 285 + sizeof(struct agp_bridge_data *), 286 + GFP_KERNEL); 287 + if (!sgi_tioca_agp_bridges) 288 + return -ENOMEM; 288 289 289 290 j = 0; 290 291 list_for_each_entry(info, &tioca_list, ca_list) {
+1
include/linux/pci_ids.h
··· 1277 1277 #define PCI_DEVICE_ID_VIA_3296_0 0x0296 1278 1278 #define PCI_DEVICE_ID_VIA_8363_0 0x0305 1279 1279 #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 1280 + #define PCI_DEVICE_ID_VIA_K8M890CE 0x0336 1280 1281 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 1281 1282 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 1282 1283 #define PCI_DEVICE_ID_VIA_82C561 0x0561