diff options
Diffstat (limited to 'arch')
81 files changed, 1624 insertions, 1027 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 5b7dcd5a0e75..002703b8c0b0 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config ALPHA | 5 | config ALPHA |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | select HAVE_OPROFILE | 9 | select HAVE_OPROFILE |
9 | help | 10 | help |
10 | The Alpha is a 64-bit general-purpose processor designed and | 11 | The Alpha is a 64-bit general-purpose processor designed and |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4127af93c5f3..9619c43783ff 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -222,6 +222,7 @@ config ARCH_CLPS7500 | |||
222 | select TIMER_ACORN | 222 | select TIMER_ACORN |
223 | select ISA | 223 | select ISA |
224 | select NO_IOPORT | 224 | select NO_IOPORT |
225 | select HAVE_IDE | ||
225 | help | 226 | help |
226 | Support for the Cirrus Logic PS7500FE system-on-a-chip. | 227 | Support for the Cirrus Logic PS7500FE system-on-a-chip. |
227 | 228 | ||
@@ -234,6 +235,7 @@ config ARCH_CO285 | |||
234 | bool "Co-EBSA285" | 235 | bool "Co-EBSA285" |
235 | select FOOTBRIDGE | 236 | select FOOTBRIDGE |
236 | select FOOTBRIDGE_ADDIN | 237 | select FOOTBRIDGE_ADDIN |
238 | select HAVE_IDE | ||
237 | help | 239 | help |
238 | Support for Intel's EBSA285 companion chip. | 240 | Support for Intel's EBSA285 companion chip. |
239 | 241 | ||
@@ -258,6 +260,7 @@ config ARCH_EP93XX | |||
258 | config ARCH_FOOTBRIDGE | 260 | config ARCH_FOOTBRIDGE |
259 | bool "FootBridge" | 261 | bool "FootBridge" |
260 | select FOOTBRIDGE | 262 | select FOOTBRIDGE |
263 | select HAVE_IDE | ||
261 | help | 264 | help |
262 | Support for systems based on the DC21285 companion chip | 265 | Support for systems based on the DC21285 companion chip |
263 | ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. | 266 | ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. |
@@ -296,6 +299,7 @@ config ARCH_IOP32X | |||
296 | depends on MMU | 299 | depends on MMU |
297 | select PLAT_IOP | 300 | select PLAT_IOP |
298 | select PCI | 301 | select PCI |
302 | select HAVE_IDE | ||
299 | help | 303 | help |
300 | Support for Intel's 80219 and IOP32X (XScale) family of | 304 | Support for Intel's 80219 and IOP32X (XScale) family of |
301 | processors. | 305 | processors. |
@@ -305,12 +309,14 @@ config ARCH_IOP33X | |||
305 | depends on MMU | 309 | depends on MMU |
306 | select PLAT_IOP | 310 | select PLAT_IOP |
307 | select PCI | 311 | select PCI |
312 | select HAVE_IDE | ||
308 | help | 313 | help |
309 | Support for Intel's IOP33X (XScale) family of processors. | 314 | Support for Intel's IOP33X (XScale) family of processors. |
310 | 315 | ||
311 | config ARCH_IXP23XX | 316 | config ARCH_IXP23XX |
312 | bool "IXP23XX-based" | 317 | bool "IXP23XX-based" |
313 | depends on MMU | 318 | depends on MMU |
319 | select HAVE_IDE | ||
314 | select PCI | 320 | select PCI |
315 | help | 321 | help |
316 | Support for Intel's IXP23xx (XScale) family of processors. | 322 | Support for Intel's IXP23xx (XScale) family of processors. |
@@ -328,12 +334,14 @@ config ARCH_IXP4XX | |||
328 | select GENERIC_GPIO | 334 | select GENERIC_GPIO |
329 | select GENERIC_TIME | 335 | select GENERIC_TIME |
330 | select GENERIC_CLOCKEVENTS | 336 | select GENERIC_CLOCKEVENTS |
337 | select HAVE_IDE | ||
331 | help | 338 | help |
332 | Support for Intel's IXP4XX (XScale) family of processors. | 339 | Support for Intel's IXP4XX (XScale) family of processors. |
333 | 340 | ||
334 | config ARCH_L7200 | 341 | config ARCH_L7200 |
335 | bool "LinkUp-L7200" | 342 | bool "LinkUp-L7200" |
336 | select FIQ | 343 | select FIQ |
344 | select HAVE_IDE | ||
337 | help | 345 | help |
338 | Say Y here if you intend to run this kernel on a LinkUp Systems | 346 | Say Y here if you intend to run this kernel on a LinkUp Systems |
339 | L7200 Software Development Board which uses an ARM720T processor. | 347 | L7200 Software Development Board which uses an ARM720T processor. |
@@ -388,6 +396,7 @@ config ARCH_PXA | |||
388 | depends on MMU | 396 | depends on MMU |
389 | select ARCH_MTD_XIP | 397 | select ARCH_MTD_XIP |
390 | select GENERIC_GPIO | 398 | select GENERIC_GPIO |
399 | select HAVE_IDE | ||
391 | select HAVE_GPIO_LIB | 400 | select HAVE_GPIO_LIB |
392 | select GENERIC_TIME | 401 | select GENERIC_TIME |
393 | select GENERIC_CLOCKEVENTS | 402 | select GENERIC_CLOCKEVENTS |
@@ -403,6 +412,7 @@ config ARCH_RPC | |||
403 | select ARCH_MAY_HAVE_PC_FDC | 412 | select ARCH_MAY_HAVE_PC_FDC |
404 | select ISA_DMA_API | 413 | select ISA_DMA_API |
405 | select NO_IOPORT | 414 | select NO_IOPORT |
415 | select HAVE_IDE | ||
406 | help | 416 | help |
407 | On the Acorn Risc-PC, Linux can support the internal IDE disk and | 417 | On the Acorn Risc-PC, Linux can support the internal IDE disk and |
408 | CD-ROM interface, serial and parallel port, and the floppy drive. | 418 | CD-ROM interface, serial and parallel port, and the floppy drive. |
@@ -414,12 +424,14 @@ config ARCH_SA1100 | |||
414 | select ARCH_MTD_XIP | 424 | select ARCH_MTD_XIP |
415 | select GENERIC_GPIO | 425 | select GENERIC_GPIO |
416 | select GENERIC_TIME | 426 | select GENERIC_TIME |
427 | select HAVE_IDE | ||
417 | help | 428 | help |
418 | Support for StrongARM 11x0 based boards. | 429 | Support for StrongARM 11x0 based boards. |
419 | 430 | ||
420 | config ARCH_S3C2410 | 431 | config ARCH_S3C2410 |
421 | bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" | 432 | bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" |
422 | select GENERIC_GPIO | 433 | select GENERIC_GPIO |
434 | select HAVE_IDE | ||
423 | help | 435 | help |
424 | Samsung S3C2410X CPU based systems, such as the Simtec Electronics | 436 | Samsung S3C2410X CPU based systems, such as the Simtec Electronics |
425 | BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or | 437 | BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or |
@@ -427,6 +439,7 @@ config ARCH_S3C2410 | |||
427 | 439 | ||
428 | config ARCH_SHARK | 440 | config ARCH_SHARK |
429 | bool "Shark" | 441 | bool "Shark" |
442 | select HAVE_IDE | ||
430 | select ISA | 443 | select ISA |
431 | select ISA_DMA | 444 | select ISA_DMA |
432 | select PCI | 445 | select PCI |
@@ -436,6 +449,7 @@ config ARCH_SHARK | |||
436 | 449 | ||
437 | config ARCH_LH7A40X | 450 | config ARCH_LH7A40X |
438 | bool "Sharp LH7A40X" | 451 | bool "Sharp LH7A40X" |
452 | select HAVE_IDE | ||
439 | help | 453 | help |
440 | Say Y here for systems based on one of the Sharp LH7A40X | 454 | Say Y here for systems based on one of the Sharp LH7A40X |
441 | System on a Chip processors. These CPUs include an ARM922T | 455 | System on a Chip processors. These CPUs include an ARM922T |
@@ -1093,12 +1107,7 @@ source "drivers/block/Kconfig" | |||
1093 | 1107 | ||
1094 | source "drivers/misc/Kconfig" | 1108 | source "drivers/misc/Kconfig" |
1095 | 1109 | ||
1096 | if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \ | ||
1097 | || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ | ||
1098 | || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \ | ||
1099 | || ARCH_IXP23XX | ||
1100 | source "drivers/ide/Kconfig" | 1110 | source "drivers/ide/Kconfig" |
1101 | endif | ||
1102 | 1111 | ||
1103 | source "drivers/scsi/Kconfig" | 1112 | source "drivers/scsi/Kconfig" |
1104 | 1113 | ||
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 28e0caf4156c..c75d7089f982 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -10,6 +10,7 @@ config AVR32 | |||
10 | # With EMBEDDED=n, we get lots of stuff automatically selected | 10 | # With EMBEDDED=n, we get lots of stuff automatically selected |
11 | # that we usually don't need on AVR32. | 11 | # that we usually don't need on AVR32. |
12 | select EMBEDDED | 12 | select EMBEDDED |
13 | select HAVE_IDE | ||
13 | select HAVE_OPROFILE | 14 | select HAVE_OPROFILE |
14 | select HAVE_KPROBES | 15 | select HAVE_KPROBES |
15 | help | 16 | help |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 368bc7fe167e..589c6aca4803 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -24,6 +24,7 @@ config RWSEM_XCHGADD_ALGORITHM | |||
24 | config BLACKFIN | 24 | config BLACKFIN |
25 | bool | 25 | bool |
26 | default y | 26 | default y |
27 | select HAVE_IDE | ||
27 | select HAVE_OPROFILE | 28 | select HAVE_OPROFILE |
28 | 29 | ||
29 | config ZONE_DMA | 30 | config ZONE_DMA |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 8456bc8efb7c..9389d38f222f 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -54,6 +54,7 @@ config FORCE_MAX_ZONEORDER | |||
54 | config CRIS | 54 | config CRIS |
55 | bool | 55 | bool |
56 | default y | 56 | default y |
57 | select HAVE_IDE | ||
57 | 58 | ||
58 | config HZ | 59 | config HZ |
59 | int | 60 | int |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 9e561ede0925..a5aac1b07562 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config FRV | 5 | config FRV |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | 9 | ||
9 | config ZONE_DMA | 10 | config ZONE_DMA |
10 | bool | 11 | bool |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index f69e5ea38558..085dc6ec152b 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration" | |||
8 | config H8300 | 8 | config H8300 |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | 12 | ||
12 | config MMU | 13 | config MMU |
13 | bool | 14 | bool |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index b0de1132dfc0..2d4fcd01bc91 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -15,6 +15,7 @@ config IA64 | |||
15 | select ACPI if (!IA64_HP_SIM) | 15 | select ACPI if (!IA64_HP_SIM) |
16 | select PM if (!IA64_HP_SIM) | 16 | select PM if (!IA64_HP_SIM) |
17 | select ARCH_SUPPORTS_MSI | 17 | select ARCH_SUPPORTS_MSI |
18 | select HAVE_IDE | ||
18 | select HAVE_OPROFILE | 19 | select HAVE_OPROFILE |
19 | select HAVE_KPROBES | 20 | select HAVE_KPROBES |
20 | default y | 21 | default y |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 488e48a5deea..8fd7e825192b 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ | 43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ |
44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) | 44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) |
45 | 45 | ||
46 | static int | 46 | int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn, |
47 | pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
48 | int reg, int len, u32 *value) | 47 | int reg, int len, u32 *value) |
49 | { | 48 | { |
50 | u64 addr, data = 0; | 49 | u64 addr, data = 0; |
@@ -68,8 +67,7 @@ pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
68 | return 0; | 67 | return 0; |
69 | } | 68 | } |
70 | 69 | ||
71 | static int | 70 | int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn, |
72 | pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
73 | int reg, int len, u32 value) | 71 | int reg, int len, u32 value) |
74 | { | 72 | { |
75 | u64 addr; | 73 | u64 addr; |
@@ -91,24 +89,17 @@ pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
94 | static struct pci_raw_ops pci_sal_ops = { | 92 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, |
95 | .read = pci_sal_read, | 93 | int size, u32 *value) |
96 | .write = pci_sal_write | ||
97 | }; | ||
98 | |||
99 | struct pci_raw_ops *raw_pci_ops = &pci_sal_ops; | ||
100 | |||
101 | static int | ||
102 | pci_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | ||
103 | { | 94 | { |
104 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 95 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
105 | devfn, where, size, value); | 96 | devfn, where, size, value); |
106 | } | 97 | } |
107 | 98 | ||
108 | static int | 99 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, |
109 | pci_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 100 | int size, u32 value) |
110 | { | 101 | { |
111 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 102 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
112 | devfn, where, size, value); | 103 | devfn, where, size, value); |
113 | } | 104 | } |
114 | 105 | ||
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index e1a3e19d3d9c..999f14f986e2 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c | |||
@@ -752,13 +752,13 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
752 | * Determine the secondary bus number of the port2 logical PPB. | 752 | * Determine the secondary bus number of the port2 logical PPB. |
753 | * This is used to decide whether a given pci device resides on | 753 | * This is used to decide whether a given pci device resides on |
754 | * port1 or port2. Note: We don't have enough plumbing set up | 754 | * port1 or port2. Note: We don't have enough plumbing set up |
755 | * here to use pci_read_config_xxx() so use the raw_pci_ops vector. | 755 | * here to use pci_read_config_xxx() so use raw_pci_read(). |
756 | */ | 756 | */ |
757 | 757 | ||
758 | seg = tioce_common->ce_pcibus.bs_persist_segment; | 758 | seg = tioce_common->ce_pcibus.bs_persist_segment; |
759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; | 759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; |
760 | 760 | ||
761 | raw_pci_ops->read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); | 761 | raw_pci_read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); |
762 | tioce_kern->ce_port1_secondary = (u8) tmp; | 762 | tioce_kern->ce_port1_secondary = (u8) tmp; |
763 | 763 | ||
764 | /* | 764 | /* |
@@ -799,11 +799,11 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
799 | 799 | ||
800 | /* mem base/limit */ | 800 | /* mem base/limit */ |
801 | 801 | ||
802 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 802 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
803 | PCI_MEMORY_BASE, 2, &tmp); | 803 | PCI_MEMORY_BASE, 2, &tmp); |
804 | base = (u64)tmp << 16; | 804 | base = (u64)tmp << 16; |
805 | 805 | ||
806 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 806 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
807 | PCI_MEMORY_LIMIT, 2, &tmp); | 807 | PCI_MEMORY_LIMIT, 2, &tmp); |
808 | limit = (u64)tmp << 16; | 808 | limit = (u64)tmp << 16; |
809 | limit |= 0xfffffUL; | 809 | limit |= 0xfffffUL; |
@@ -817,21 +817,21 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
817 | * attributes. | 817 | * attributes. |
818 | */ | 818 | */ |
819 | 819 | ||
820 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 820 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
821 | PCI_PREF_MEMORY_BASE, 2, &tmp); | 821 | PCI_PREF_MEMORY_BASE, 2, &tmp); |
822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
823 | 823 | ||
824 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 824 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
825 | PCI_PREF_BASE_UPPER32, 4, &tmp); | 825 | PCI_PREF_BASE_UPPER32, 4, &tmp); |
826 | base |= (u64)tmp << 32; | 826 | base |= (u64)tmp << 32; |
827 | 827 | ||
828 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 828 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); | 829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); |
830 | 830 | ||
831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
832 | limit |= 0xfffffUL; | 832 | limit |= 0xfffffUL; |
833 | 833 | ||
834 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 834 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); | 835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); |
836 | limit |= (u64)tmp << 32; | 836 | limit |= (u64)tmp << 32; |
837 | 837 | ||
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index d4679ab55b96..de153de2ea9f 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/M32R Kernel Configuration" | |||
8 | config M32R | 8 | config M32R |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | select HAVE_OPROFILE | 12 | select HAVE_OPROFILE |
12 | 13 | ||
13 | config SBUS | 14 | config SBUS |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 2b0ed89cd173..65db2261b9ea 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config M68K | 5 | config M68K |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | 9 | ||
9 | config MMU | 10 | config MMU |
10 | bool | 11 | bool |
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index 548a7b321633..07eb4c4bab82 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "uClinux/68k (w/o MMU) Kernel Configuration" | |||
8 | config M68K | 8 | config M68K |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | 12 | ||
12 | config MMU | 13 | config MMU |
13 | bool | 14 | bool |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ec78a5762e9e..ade230d445d9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config MIPS | 1 | config MIPS |
2 | bool | 2 | bool |
3 | default y | 3 | default y |
4 | select HAVE_IDE | ||
4 | select HAVE_OPROFILE | 5 | select HAVE_OPROFILE |
5 | # Horrible source of confusion. Die, die, die ... | 6 | # Horrible source of confusion. Die, die, die ... |
6 | select EMBEDDED | 7 | select EMBEDDED |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index d929ac84f25a..bc7a19da6245 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -7,6 +7,7 @@ mainmenu "Linux/PA-RISC Kernel Configuration" | |||
7 | 7 | ||
8 | config PARISC | 8 | config PARISC |
9 | def_bool y | 9 | def_bool y |
10 | select HAVE_IDE | ||
10 | select HAVE_OPROFILE | 11 | select HAVE_OPROFILE |
11 | help | 12 | help |
12 | The PA-RISC microprocessor is designed by Hewlett-Packard and used | 13 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 26b963c33c88..485513c9f1af 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -87,6 +87,7 @@ config ARCH_NO_VIRT_TO_BUS | |||
87 | config PPC | 87 | config PPC |
88 | bool | 88 | bool |
89 | default y | 89 | default y |
90 | select HAVE_IDE | ||
90 | select HAVE_OPROFILE | 91 | select HAVE_OPROFILE |
91 | select HAVE_KPROBES | 92 | select HAVE_KPROBES |
92 | 93 | ||
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 531156f8919c..abc877faf123 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -42,6 +42,7 @@ config GENERIC_CALIBRATE_DELAY | |||
42 | config PPC | 42 | config PPC |
43 | bool | 43 | bool |
44 | default y | 44 | default y |
45 | select HAVE_IDE | ||
45 | select HAVE_OPROFILE | 46 | select HAVE_OPROFILE |
46 | select HAVE_KPROBES | 47 | select HAVE_KPROBES |
47 | 48 | ||
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index ece7b99da895..39921f3a9685 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,12 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.23 | 3 | # Linux kernel version: 2.6.24 |
4 | # Mon Oct 22 12:10:44 2007 | 4 | # Sat Feb 9 12:13:01 2008 |
5 | # | 5 | # |
6 | CONFIG_MMU=y | 6 | CONFIG_MMU=y |
7 | CONFIG_ZONE_DMA=y | 7 | CONFIG_ZONE_DMA=y |
8 | CONFIG_LOCKDEP_SUPPORT=y | 8 | CONFIG_LOCKDEP_SUPPORT=y |
9 | CONFIG_STACKTRACE_SUPPORT=y | 9 | CONFIG_STACKTRACE_SUPPORT=y |
10 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | ||
10 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
11 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set | 12 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set |
12 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set | 13 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set |
@@ -15,6 +16,7 @@ CONFIG_GENERIC_TIME=y | |||
15 | CONFIG_GENERIC_BUG=y | 16 | CONFIG_GENERIC_BUG=y |
16 | CONFIG_NO_IOMEM=y | 17 | CONFIG_NO_IOMEM=y |
17 | CONFIG_NO_DMA=y | 18 | CONFIG_NO_DMA=y |
19 | CONFIG_GENERIC_LOCKBREAK=y | ||
18 | CONFIG_S390=y | 20 | CONFIG_S390=y |
19 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 21 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
20 | 22 | ||
@@ -32,7 +34,6 @@ CONFIG_SYSVIPC_SYSCTL=y | |||
32 | CONFIG_POSIX_MQUEUE=y | 34 | CONFIG_POSIX_MQUEUE=y |
33 | # CONFIG_BSD_PROCESS_ACCT is not set | 35 | # CONFIG_BSD_PROCESS_ACCT is not set |
34 | # CONFIG_TASKSTATS is not set | 36 | # CONFIG_TASKSTATS is not set |
35 | # CONFIG_USER_NS is not set | ||
36 | CONFIG_AUDIT=y | 37 | CONFIG_AUDIT=y |
37 | # CONFIG_AUDITSYSCALL is not set | 38 | # CONFIG_AUDITSYSCALL is not set |
38 | CONFIG_IKCONFIG=y | 39 | CONFIG_IKCONFIG=y |
@@ -41,13 +42,19 @@ CONFIG_LOG_BUF_SHIFT=17 | |||
41 | CONFIG_CGROUPS=y | 42 | CONFIG_CGROUPS=y |
42 | # CONFIG_CGROUP_DEBUG is not set | 43 | # CONFIG_CGROUP_DEBUG is not set |
43 | CONFIG_CGROUP_NS=y | 44 | CONFIG_CGROUP_NS=y |
44 | CONFIG_CGROUP_CPUACCT=y | ||
45 | # CONFIG_CPUSETS is not set | 45 | # CONFIG_CPUSETS is not set |
46 | CONFIG_FAIR_GROUP_SCHED=y | 46 | CONFIG_FAIR_GROUP_SCHED=y |
47 | CONFIG_FAIR_USER_SCHED=y | 47 | CONFIG_FAIR_USER_SCHED=y |
48 | # CONFIG_FAIR_CGROUP_SCHED is not set | 48 | # CONFIG_FAIR_CGROUP_SCHED is not set |
49 | # CONFIG_CGROUP_CPUACCT is not set | ||
50 | # CONFIG_RESOURCE_COUNTERS is not set | ||
49 | CONFIG_SYSFS_DEPRECATED=y | 51 | CONFIG_SYSFS_DEPRECATED=y |
50 | # CONFIG_RELAY is not set | 52 | # CONFIG_RELAY is not set |
53 | CONFIG_NAMESPACES=y | ||
54 | CONFIG_UTS_NS=y | ||
55 | CONFIG_IPC_NS=y | ||
56 | # CONFIG_USER_NS is not set | ||
57 | # CONFIG_PID_NS is not set | ||
51 | CONFIG_BLK_DEV_INITRD=y | 58 | CONFIG_BLK_DEV_INITRD=y |
52 | CONFIG_INITRAMFS_SOURCE="" | 59 | CONFIG_INITRAMFS_SOURCE="" |
53 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 60 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
@@ -61,17 +68,26 @@ CONFIG_HOTPLUG=y | |||
61 | CONFIG_PRINTK=y | 68 | CONFIG_PRINTK=y |
62 | CONFIG_BUG=y | 69 | CONFIG_BUG=y |
63 | CONFIG_ELF_CORE=y | 70 | CONFIG_ELF_CORE=y |
71 | # CONFIG_COMPAT_BRK is not set | ||
64 | CONFIG_BASE_FULL=y | 72 | CONFIG_BASE_FULL=y |
65 | CONFIG_FUTEX=y | 73 | CONFIG_FUTEX=y |
66 | CONFIG_ANON_INODES=y | 74 | CONFIG_ANON_INODES=y |
67 | CONFIG_EPOLL=y | 75 | CONFIG_EPOLL=y |
68 | CONFIG_SIGNALFD=y | 76 | CONFIG_SIGNALFD=y |
77 | CONFIG_TIMERFD=y | ||
69 | CONFIG_EVENTFD=y | 78 | CONFIG_EVENTFD=y |
70 | CONFIG_SHMEM=y | 79 | CONFIG_SHMEM=y |
71 | CONFIG_VM_EVENT_COUNTERS=y | 80 | CONFIG_VM_EVENT_COUNTERS=y |
72 | CONFIG_SLAB=y | 81 | CONFIG_SLAB=y |
73 | # CONFIG_SLUB is not set | 82 | # CONFIG_SLUB is not set |
74 | # CONFIG_SLOB is not set | 83 | # CONFIG_SLOB is not set |
84 | # CONFIG_PROFILING is not set | ||
85 | # CONFIG_MARKERS is not set | ||
86 | CONFIG_HAVE_OPROFILE=y | ||
87 | CONFIG_KPROBES=y | ||
88 | CONFIG_HAVE_KPROBES=y | ||
89 | CONFIG_PROC_PAGE_MONITOR=y | ||
90 | CONFIG_SLABINFO=y | ||
75 | CONFIG_RT_MUTEXES=y | 91 | CONFIG_RT_MUTEXES=y |
76 | # CONFIG_TINY_SHMEM is not set | 92 | # CONFIG_TINY_SHMEM is not set |
77 | CONFIG_BASE_SMALL=0 | 93 | CONFIG_BASE_SMALL=0 |
@@ -99,6 +115,8 @@ CONFIG_DEFAULT_DEADLINE=y | |||
99 | # CONFIG_DEFAULT_CFQ is not set | 115 | # CONFIG_DEFAULT_CFQ is not set |
100 | # CONFIG_DEFAULT_NOOP is not set | 116 | # CONFIG_DEFAULT_NOOP is not set |
101 | CONFIG_DEFAULT_IOSCHED="deadline" | 117 | CONFIG_DEFAULT_IOSCHED="deadline" |
118 | CONFIG_CLASSIC_RCU=y | ||
119 | # CONFIG_PREEMPT_RCU is not set | ||
102 | 120 | ||
103 | # | 121 | # |
104 | # Base setup | 122 | # Base setup |
@@ -137,7 +155,7 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y | |||
137 | # CONFIG_PREEMPT_NONE is not set | 155 | # CONFIG_PREEMPT_NONE is not set |
138 | # CONFIG_PREEMPT_VOLUNTARY is not set | 156 | # CONFIG_PREEMPT_VOLUNTARY is not set |
139 | CONFIG_PREEMPT=y | 157 | CONFIG_PREEMPT=y |
140 | CONFIG_PREEMPT_BKL=y | 158 | # CONFIG_RCU_TRACE is not set |
141 | CONFIG_SELECT_MEMORY_MODEL=y | 159 | CONFIG_SELECT_MEMORY_MODEL=y |
142 | CONFIG_FLATMEM_MANUAL=y | 160 | CONFIG_FLATMEM_MANUAL=y |
143 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 161 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -151,7 +169,6 @@ CONFIG_RESOURCES_64BIT=y | |||
151 | CONFIG_ZONE_DMA_FLAG=1 | 169 | CONFIG_ZONE_DMA_FLAG=1 |
152 | CONFIG_BOUNCE=y | 170 | CONFIG_BOUNCE=y |
153 | CONFIG_VIRT_TO_BUS=y | 171 | CONFIG_VIRT_TO_BUS=y |
154 | CONFIG_HOLES_IN_ZONE=y | ||
155 | 172 | ||
156 | # | 173 | # |
157 | # I/O subsystem configuration | 174 | # I/O subsystem configuration |
@@ -180,6 +197,7 @@ CONFIG_HZ_100=y | |||
180 | # CONFIG_HZ_300 is not set | 197 | # CONFIG_HZ_300 is not set |
181 | # CONFIG_HZ_1000 is not set | 198 | # CONFIG_HZ_1000 is not set |
182 | CONFIG_HZ=100 | 199 | CONFIG_HZ=100 |
200 | # CONFIG_SCHED_HRTICK is not set | ||
183 | CONFIG_NO_IDLE_HZ=y | 201 | CONFIG_NO_IDLE_HZ=y |
184 | CONFIG_NO_IDLE_HZ_INIT=y | 202 | CONFIG_NO_IDLE_HZ_INIT=y |
185 | CONFIG_S390_HYPFS_FS=y | 203 | CONFIG_S390_HYPFS_FS=y |
@@ -201,6 +219,7 @@ CONFIG_XFRM=y | |||
201 | # CONFIG_XFRM_USER is not set | 219 | # CONFIG_XFRM_USER is not set |
202 | # CONFIG_XFRM_SUB_POLICY is not set | 220 | # CONFIG_XFRM_SUB_POLICY is not set |
203 | # CONFIG_XFRM_MIGRATE is not set | 221 | # CONFIG_XFRM_MIGRATE is not set |
222 | # CONFIG_XFRM_STATISTICS is not set | ||
204 | CONFIG_NET_KEY=y | 223 | CONFIG_NET_KEY=y |
205 | # CONFIG_NET_KEY_MIGRATE is not set | 224 | # CONFIG_NET_KEY_MIGRATE is not set |
206 | CONFIG_IUCV=m | 225 | CONFIG_IUCV=m |
@@ -251,6 +270,7 @@ CONFIG_IPV6_SIT=y | |||
251 | # CONFIG_NETWORK_SECMARK is not set | 270 | # CONFIG_NETWORK_SECMARK is not set |
252 | CONFIG_NETFILTER=y | 271 | CONFIG_NETFILTER=y |
253 | # CONFIG_NETFILTER_DEBUG is not set | 272 | # CONFIG_NETFILTER_DEBUG is not set |
273 | CONFIG_NETFILTER_ADVANCED=y | ||
254 | 274 | ||
255 | # | 275 | # |
256 | # Core Netfilter Configuration | 276 | # Core Netfilter Configuration |
@@ -258,7 +278,6 @@ CONFIG_NETFILTER=y | |||
258 | CONFIG_NETFILTER_NETLINK=m | 278 | CONFIG_NETFILTER_NETLINK=m |
259 | CONFIG_NETFILTER_NETLINK_QUEUE=m | 279 | CONFIG_NETFILTER_NETLINK_QUEUE=m |
260 | CONFIG_NETFILTER_NETLINK_LOG=m | 280 | CONFIG_NETFILTER_NETLINK_LOG=m |
261 | CONFIG_NF_CONNTRACK_ENABLED=m | ||
262 | CONFIG_NF_CONNTRACK=m | 281 | CONFIG_NF_CONNTRACK=m |
263 | # CONFIG_NF_CT_ACCT is not set | 282 | # CONFIG_NF_CT_ACCT is not set |
264 | # CONFIG_NF_CONNTRACK_MARK is not set | 283 | # CONFIG_NF_CONNTRACK_MARK is not set |
@@ -286,7 +305,7 @@ CONFIG_NF_CONNTRACK=m | |||
286 | # CONFIG_IP_NF_ARPTABLES is not set | 305 | # CONFIG_IP_NF_ARPTABLES is not set |
287 | 306 | ||
288 | # | 307 | # |
289 | # IPv6: Netfilter Configuration (EXPERIMENTAL) | 308 | # IPv6: Netfilter Configuration |
290 | # | 309 | # |
291 | # CONFIG_NF_CONNTRACK_IPV6 is not set | 310 | # CONFIG_NF_CONNTRACK_IPV6 is not set |
292 | # CONFIG_IP6_NF_QUEUE is not set | 311 | # CONFIG_IP6_NF_QUEUE is not set |
@@ -343,6 +362,7 @@ CONFIG_NET_CLS_U32=m | |||
343 | CONFIG_CLS_U32_MARK=y | 362 | CONFIG_CLS_U32_MARK=y |
344 | CONFIG_NET_CLS_RSVP=m | 363 | CONFIG_NET_CLS_RSVP=m |
345 | CONFIG_NET_CLS_RSVP6=m | 364 | CONFIG_NET_CLS_RSVP6=m |
365 | CONFIG_NET_CLS_FLOW=m | ||
346 | # CONFIG_NET_EMATCH is not set | 366 | # CONFIG_NET_EMATCH is not set |
347 | CONFIG_NET_CLS_ACT=y | 367 | CONFIG_NET_CLS_ACT=y |
348 | CONFIG_NET_ACT_POLICE=y | 368 | CONFIG_NET_ACT_POLICE=y |
@@ -351,7 +371,6 @@ CONFIG_NET_ACT_POLICE=y | |||
351 | CONFIG_NET_ACT_NAT=m | 371 | CONFIG_NET_ACT_NAT=m |
352 | # CONFIG_NET_ACT_PEDIT is not set | 372 | # CONFIG_NET_ACT_PEDIT is not set |
353 | # CONFIG_NET_ACT_SIMP is not set | 373 | # CONFIG_NET_ACT_SIMP is not set |
354 | CONFIG_NET_CLS_POLICE=y | ||
355 | # CONFIG_NET_CLS_IND is not set | 374 | # CONFIG_NET_CLS_IND is not set |
356 | CONFIG_NET_SCH_FIFO=y | 375 | CONFIG_NET_SCH_FIFO=y |
357 | 376 | ||
@@ -360,6 +379,15 @@ CONFIG_NET_SCH_FIFO=y | |||
360 | # | 379 | # |
361 | # CONFIG_NET_PKTGEN is not set | 380 | # CONFIG_NET_PKTGEN is not set |
362 | # CONFIG_NET_TCPPROBE is not set | 381 | # CONFIG_NET_TCPPROBE is not set |
382 | CONFIG_CAN=m | ||
383 | CONFIG_CAN_RAW=m | ||
384 | CONFIG_CAN_BCM=m | ||
385 | |||
386 | # | ||
387 | # CAN Device Drivers | ||
388 | # | ||
389 | CONFIG_CAN_VCAN=m | ||
390 | # CONFIG_CAN_DEBUG_DEVICES is not set | ||
363 | # CONFIG_AF_RXRPC is not set | 391 | # CONFIG_AF_RXRPC is not set |
364 | # CONFIG_RFKILL is not set | 392 | # CONFIG_RFKILL is not set |
365 | # CONFIG_NET_9P is not set | 393 | # CONFIG_NET_9P is not set |
@@ -389,7 +417,7 @@ CONFIG_BLK_DEV_NBD=m | |||
389 | CONFIG_BLK_DEV_RAM=y | 417 | CONFIG_BLK_DEV_RAM=y |
390 | CONFIG_BLK_DEV_RAM_COUNT=16 | 418 | CONFIG_BLK_DEV_RAM_COUNT=16 |
391 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 419 | CONFIG_BLK_DEV_RAM_SIZE=4096 |
392 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | 420 | CONFIG_BLK_DEV_XIP=y |
393 | # CONFIG_CDROM_PKTCDVD is not set | 421 | # CONFIG_CDROM_PKTCDVD is not set |
394 | # CONFIG_ATA_OVER_ETH is not set | 422 | # CONFIG_ATA_OVER_ETH is not set |
395 | 423 | ||
@@ -406,6 +434,7 @@ CONFIG_DASD_DIAG=y | |||
406 | CONFIG_DASD_EER=y | 434 | CONFIG_DASD_EER=y |
407 | CONFIG_MISC_DEVICES=y | 435 | CONFIG_MISC_DEVICES=y |
408 | # CONFIG_EEPROM_93CX6 is not set | 436 | # CONFIG_EEPROM_93CX6 is not set |
437 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
409 | 438 | ||
410 | # | 439 | # |
411 | # SCSI device support | 440 | # SCSI device support |
@@ -487,6 +516,7 @@ CONFIG_NET_ETHERNET=y | |||
487 | # CONFIG_IBM_NEW_EMAC_TAH is not set | 516 | # CONFIG_IBM_NEW_EMAC_TAH is not set |
488 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | 517 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set |
489 | CONFIG_NETDEV_1000=y | 518 | CONFIG_NETDEV_1000=y |
519 | # CONFIG_E1000E_ENABLED is not set | ||
490 | CONFIG_NETDEV_10000=y | 520 | CONFIG_NETDEV_10000=y |
491 | # CONFIG_TR is not set | 521 | # CONFIG_TR is not set |
492 | # CONFIG_WAN is not set | 522 | # CONFIG_WAN is not set |
@@ -508,7 +538,6 @@ CONFIG_QETH=y | |||
508 | CONFIG_CCWGROUP=y | 538 | CONFIG_CCWGROUP=y |
509 | # CONFIG_PPP is not set | 539 | # CONFIG_PPP is not set |
510 | # CONFIG_SLIP is not set | 540 | # CONFIG_SLIP is not set |
511 | # CONFIG_SHAPER is not set | ||
512 | # CONFIG_NETCONSOLE is not set | 541 | # CONFIG_NETCONSOLE is not set |
513 | # CONFIG_NETPOLL is not set | 542 | # CONFIG_NETPOLL is not set |
514 | # CONFIG_NET_POLL_CONTROLLER is not set | 543 | # CONFIG_NET_POLL_CONTROLLER is not set |
@@ -558,6 +587,7 @@ CONFIG_S390_TAPE_34XX=m | |||
558 | CONFIG_MONWRITER=m | 587 | CONFIG_MONWRITER=m |
559 | CONFIG_S390_VMUR=m | 588 | CONFIG_S390_VMUR=m |
560 | # CONFIG_POWER_SUPPLY is not set | 589 | # CONFIG_POWER_SUPPLY is not set |
590 | # CONFIG_THERMAL is not set | ||
561 | # CONFIG_WATCHDOG is not set | 591 | # CONFIG_WATCHDOG is not set |
562 | 592 | ||
563 | # | 593 | # |
@@ -584,12 +614,10 @@ CONFIG_FS_POSIX_ACL=y | |||
584 | # CONFIG_XFS_FS is not set | 614 | # CONFIG_XFS_FS is not set |
585 | # CONFIG_GFS2_FS is not set | 615 | # CONFIG_GFS2_FS is not set |
586 | # CONFIG_OCFS2_FS is not set | 616 | # CONFIG_OCFS2_FS is not set |
587 | # CONFIG_MINIX_FS is not set | 617 | CONFIG_DNOTIFY=y |
588 | # CONFIG_ROMFS_FS is not set | ||
589 | CONFIG_INOTIFY=y | 618 | CONFIG_INOTIFY=y |
590 | CONFIG_INOTIFY_USER=y | 619 | CONFIG_INOTIFY_USER=y |
591 | # CONFIG_QUOTA is not set | 620 | # CONFIG_QUOTA is not set |
592 | CONFIG_DNOTIFY=y | ||
593 | # CONFIG_AUTOFS_FS is not set | 621 | # CONFIG_AUTOFS_FS is not set |
594 | # CONFIG_AUTOFS4_FS is not set | 622 | # CONFIG_AUTOFS4_FS is not set |
595 | # CONFIG_FUSE_FS is not set | 623 | # CONFIG_FUSE_FS is not set |
@@ -632,8 +660,10 @@ CONFIG_CONFIGFS_FS=m | |||
632 | # CONFIG_EFS_FS is not set | 660 | # CONFIG_EFS_FS is not set |
633 | # CONFIG_CRAMFS is not set | 661 | # CONFIG_CRAMFS is not set |
634 | # CONFIG_VXFS_FS is not set | 662 | # CONFIG_VXFS_FS is not set |
663 | # CONFIG_MINIX_FS is not set | ||
635 | # CONFIG_HPFS_FS is not set | 664 | # CONFIG_HPFS_FS is not set |
636 | # CONFIG_QNX4FS_FS is not set | 665 | # CONFIG_QNX4FS_FS is not set |
666 | # CONFIG_ROMFS_FS is not set | ||
637 | # CONFIG_SYSV_FS is not set | 667 | # CONFIG_SYSV_FS is not set |
638 | # CONFIG_UFS_FS is not set | 668 | # CONFIG_UFS_FS is not set |
639 | CONFIG_NETWORK_FILESYSTEMS=y | 669 | CONFIG_NETWORK_FILESYSTEMS=y |
@@ -686,16 +716,13 @@ CONFIG_MSDOS_PARTITION=y | |||
686 | # CONFIG_NLS is not set | 716 | # CONFIG_NLS is not set |
687 | CONFIG_DLM=m | 717 | CONFIG_DLM=m |
688 | # CONFIG_DLM_DEBUG is not set | 718 | # CONFIG_DLM_DEBUG is not set |
689 | CONFIG_INSTRUMENTATION=y | ||
690 | # CONFIG_PROFILING is not set | ||
691 | CONFIG_KPROBES=y | ||
692 | # CONFIG_MARKERS is not set | ||
693 | 719 | ||
694 | # | 720 | # |
695 | # Kernel hacking | 721 | # Kernel hacking |
696 | # | 722 | # |
697 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | 723 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y |
698 | # CONFIG_PRINTK_TIME is not set | 724 | # CONFIG_PRINTK_TIME is not set |
725 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
699 | CONFIG_ENABLE_MUST_CHECK=y | 726 | CONFIG_ENABLE_MUST_CHECK=y |
700 | CONFIG_MAGIC_SYSRQ=y | 727 | CONFIG_MAGIC_SYSRQ=y |
701 | # CONFIG_UNUSED_SYMBOLS is not set | 728 | # CONFIG_UNUSED_SYMBOLS is not set |
@@ -721,12 +748,18 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
721 | # CONFIG_DEBUG_INFO is not set | 748 | # CONFIG_DEBUG_INFO is not set |
722 | # CONFIG_DEBUG_VM is not set | 749 | # CONFIG_DEBUG_VM is not set |
723 | # CONFIG_DEBUG_LIST is not set | 750 | # CONFIG_DEBUG_LIST is not set |
751 | # CONFIG_DEBUG_SG is not set | ||
724 | # CONFIG_FRAME_POINTER is not set | 752 | # CONFIG_FRAME_POINTER is not set |
725 | CONFIG_FORCED_INLINING=y | 753 | CONFIG_FORCED_INLINING=y |
726 | # CONFIG_RCU_TORTURE_TEST is not set | 754 | # CONFIG_RCU_TORTURE_TEST is not set |
755 | # CONFIG_KPROBES_SANITY_TEST is not set | ||
756 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
727 | # CONFIG_LKDTM is not set | 757 | # CONFIG_LKDTM is not set |
728 | # CONFIG_FAULT_INJECTION is not set | 758 | # CONFIG_FAULT_INJECTION is not set |
759 | # CONFIG_LATENCYTOP is not set | ||
729 | CONFIG_SAMPLES=y | 760 | CONFIG_SAMPLES=y |
761 | # CONFIG_SAMPLE_KOBJECT is not set | ||
762 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
730 | 763 | ||
731 | # | 764 | # |
732 | # Security options | 765 | # Security options |
@@ -738,6 +771,7 @@ CONFIG_CRYPTO=y | |||
738 | CONFIG_CRYPTO_ALGAPI=y | 771 | CONFIG_CRYPTO_ALGAPI=y |
739 | CONFIG_CRYPTO_AEAD=m | 772 | CONFIG_CRYPTO_AEAD=m |
740 | CONFIG_CRYPTO_BLKCIPHER=y | 773 | CONFIG_CRYPTO_BLKCIPHER=y |
774 | CONFIG_CRYPTO_SEQIV=m | ||
741 | CONFIG_CRYPTO_HASH=m | 775 | CONFIG_CRYPTO_HASH=m |
742 | CONFIG_CRYPTO_MANAGER=y | 776 | CONFIG_CRYPTO_MANAGER=y |
743 | CONFIG_CRYPTO_HMAC=m | 777 | CONFIG_CRYPTO_HMAC=m |
@@ -745,17 +779,20 @@ CONFIG_CRYPTO_HMAC=m | |||
745 | # CONFIG_CRYPTO_NULL is not set | 779 | # CONFIG_CRYPTO_NULL is not set |
746 | # CONFIG_CRYPTO_MD4 is not set | 780 | # CONFIG_CRYPTO_MD4 is not set |
747 | CONFIG_CRYPTO_MD5=m | 781 | CONFIG_CRYPTO_MD5=m |
748 | # CONFIG_CRYPTO_SHA1 is not set | 782 | CONFIG_CRYPTO_SHA1=m |
749 | # CONFIG_CRYPTO_SHA256 is not set | 783 | # CONFIG_CRYPTO_SHA256 is not set |
750 | # CONFIG_CRYPTO_SHA512 is not set | 784 | # CONFIG_CRYPTO_SHA512 is not set |
751 | # CONFIG_CRYPTO_WP512 is not set | 785 | # CONFIG_CRYPTO_WP512 is not set |
752 | # CONFIG_CRYPTO_TGR192 is not set | 786 | # CONFIG_CRYPTO_TGR192 is not set |
753 | # CONFIG_CRYPTO_GF128MUL is not set | 787 | CONFIG_CRYPTO_GF128MUL=m |
754 | CONFIG_CRYPTO_ECB=m | 788 | CONFIG_CRYPTO_ECB=m |
755 | CONFIG_CRYPTO_CBC=y | 789 | CONFIG_CRYPTO_CBC=y |
756 | CONFIG_CRYPTO_PCBC=m | 790 | CONFIG_CRYPTO_PCBC=m |
757 | # CONFIG_CRYPTO_LRW is not set | 791 | # CONFIG_CRYPTO_LRW is not set |
758 | # CONFIG_CRYPTO_XTS is not set | 792 | # CONFIG_CRYPTO_XTS is not set |
793 | CONFIG_CRYPTO_CTR=m | ||
794 | CONFIG_CRYPTO_GCM=m | ||
795 | CONFIG_CRYPTO_CCM=m | ||
759 | # CONFIG_CRYPTO_CRYPTD is not set | 796 | # CONFIG_CRYPTO_CRYPTD is not set |
760 | # CONFIG_CRYPTO_DES is not set | 797 | # CONFIG_CRYPTO_DES is not set |
761 | CONFIG_CRYPTO_FCRYPT=m | 798 | CONFIG_CRYPTO_FCRYPT=m |
@@ -770,20 +807,22 @@ CONFIG_CRYPTO_FCRYPT=m | |||
770 | # CONFIG_CRYPTO_KHAZAD is not set | 807 | # CONFIG_CRYPTO_KHAZAD is not set |
771 | # CONFIG_CRYPTO_ANUBIS is not set | 808 | # CONFIG_CRYPTO_ANUBIS is not set |
772 | CONFIG_CRYPTO_SEED=m | 809 | CONFIG_CRYPTO_SEED=m |
810 | CONFIG_CRYPTO_SALSA20=m | ||
773 | # CONFIG_CRYPTO_DEFLATE is not set | 811 | # CONFIG_CRYPTO_DEFLATE is not set |
774 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | 812 | # CONFIG_CRYPTO_MICHAEL_MIC is not set |
775 | # CONFIG_CRYPTO_CRC32C is not set | 813 | # CONFIG_CRYPTO_CRC32C is not set |
776 | CONFIG_CRYPTO_CAMELLIA=m | 814 | CONFIG_CRYPTO_CAMELLIA=m |
777 | # CONFIG_CRYPTO_TEST is not set | 815 | # CONFIG_CRYPTO_TEST is not set |
778 | CONFIG_CRYPTO_AUTHENC=m | 816 | CONFIG_CRYPTO_AUTHENC=m |
817 | CONFIG_CRYPTO_LZO=m | ||
779 | CONFIG_CRYPTO_HW=y | 818 | CONFIG_CRYPTO_HW=y |
819 | CONFIG_ZCRYPT=m | ||
820 | # CONFIG_ZCRYPT_MONOLITHIC is not set | ||
780 | # CONFIG_CRYPTO_SHA1_S390 is not set | 821 | # CONFIG_CRYPTO_SHA1_S390 is not set |
781 | # CONFIG_CRYPTO_SHA256_S390 is not set | 822 | # CONFIG_CRYPTO_SHA256_S390 is not set |
782 | # CONFIG_CRYPTO_DES_S390 is not set | 823 | # CONFIG_CRYPTO_DES_S390 is not set |
783 | # CONFIG_CRYPTO_AES_S390 is not set | 824 | # CONFIG_CRYPTO_AES_S390 is not set |
784 | CONFIG_S390_PRNG=m | 825 | CONFIG_S390_PRNG=m |
785 | CONFIG_ZCRYPT=m | ||
786 | # CONFIG_ZCRYPT_MONOLITHIC is not set | ||
787 | 826 | ||
788 | # | 827 | # |
789 | # Library routines | 828 | # Library routines |
@@ -794,5 +833,7 @@ CONFIG_BITREVERSE=m | |||
794 | # CONFIG_CRC_ITU_T is not set | 833 | # CONFIG_CRC_ITU_T is not set |
795 | CONFIG_CRC32=m | 834 | CONFIG_CRC32=m |
796 | CONFIG_CRC7=m | 835 | CONFIG_CRC7=m |
797 | # CONFIG_LIBCRC32C is not set | 836 | CONFIG_LIBCRC32C=m |
837 | CONFIG_LZO_COMPRESS=m | ||
838 | CONFIG_LZO_DECOMPRESS=m | ||
798 | CONFIG_PLIST=y | 839 | CONFIG_PLIST=y |
diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c index f1e40ca00d8d..3e1c315b736d 100644 --- a/arch/s390/kernel/binfmt_elf32.c +++ b/arch/s390/kernel/binfmt_elf32.c | |||
@@ -134,6 +134,7 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | #include <asm/processor.h> | 136 | #include <asm/processor.h> |
137 | #include <asm/pgalloc.h> | ||
137 | #include <linux/module.h> | 138 | #include <linux/module.h> |
138 | #include <linux/elfcore.h> | 139 | #include <linux/elfcore.h> |
139 | #include <linux/binfmts.h> | 140 | #include <linux/binfmts.h> |
@@ -183,6 +184,16 @@ struct elf_prpsinfo32 | |||
183 | #undef start_thread | 184 | #undef start_thread |
184 | #define start_thread start_thread31 | 185 | #define start_thread start_thread31 |
185 | 186 | ||
187 | static inline void start_thread31(struct pt_regs *regs, unsigned long new_psw, | ||
188 | unsigned long new_stackp) | ||
189 | { | ||
190 | set_fs(USER_DS); | ||
191 | regs->psw.mask = psw_user32_bits; | ||
192 | regs->psw.addr = new_psw; | ||
193 | regs->gprs[15] = new_stackp; | ||
194 | crst_table_downgrade(current->mm, 1UL << 31); | ||
195 | } | ||
196 | |||
186 | MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," | 197 | MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," |
187 | " Copyright 2000 IBM Corporation"); | 198 | " Copyright 2000 IBM Corporation"); |
188 | MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>"); | 199 | MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>"); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 062c3d4c0394..743d54f0b8db 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1712,3 +1712,23 @@ sys_fallocate_wrapper: | |||
1712 | sllg %r5,%r6,32 # get high word of 64bit loff_t | 1712 | sllg %r5,%r6,32 # get high word of 64bit loff_t |
1713 | l %r5,164(%r15) # get low word of 64bit loff_t | 1713 | l %r5,164(%r15) # get low word of 64bit loff_t |
1714 | jg sys_fallocate | 1714 | jg sys_fallocate |
1715 | |||
1716 | .globl sys_timerfd_create_wrapper | ||
1717 | sys_timerfd_create_wrapper: | ||
1718 | lgfr %r2,%r2 # int | ||
1719 | lgfr %r3,%r3 # int | ||
1720 | jg sys_timerfd_create | ||
1721 | |||
1722 | .globl compat_sys_timerfd_settime_wrapper | ||
1723 | compat_sys_timerfd_settime_wrapper: | ||
1724 | lgfr %r2,%r2 # int | ||
1725 | lgfr %r3,%r3 # int | ||
1726 | llgtr %r4,%r4 # struct compat_itimerspec * | ||
1727 | llgtr %r5,%r5 # struct compat_itimerspec * | ||
1728 | jg compat_sys_timerfd_settime | ||
1729 | |||
1730 | .globl compat_sys_timerfd_gettime_wrapper | ||
1731 | compat_sys_timerfd_gettime_wrapper: | ||
1732 | lgfr %r2,%r2 # int | ||
1733 | llgtr %r3,%r3 # struct compat_itimerspec * | ||
1734 | jg compat_sys_timerfd_gettime | ||
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 0e7aca039307..a6a4729e0e94 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
31 | #include <linux/user.h> | 31 | #include <linux/user.h> |
32 | #include <linux/a.out.h> | ||
33 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
35 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f9f8779022a0..290e504061a3 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/user.h> | 26 | #include <linux/user.h> |
27 | #include <linux/a.out.h> | ||
28 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
29 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 25eac7802fc4..c87ec687d4c6 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -327,3 +327,6 @@ SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ | |||
327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) | 327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) |
328 | NI_SYSCALL /* 317 old sys_timer_fd */ | 328 | NI_SYSCALL /* 317 old sys_timer_fd */ |
329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) | 329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) |
330 | SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) | ||
331 | SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */ | ||
332 | SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper) | ||
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index a4d29025ddbd..60f728aeaf12 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -60,6 +60,7 @@ int sysctl_userprocess_debug = 0; | |||
60 | extern pgm_check_handler_t do_protection_exception; | 60 | extern pgm_check_handler_t do_protection_exception; |
61 | extern pgm_check_handler_t do_dat_exception; | 61 | extern pgm_check_handler_t do_dat_exception; |
62 | extern pgm_check_handler_t do_monitor_call; | 62 | extern pgm_check_handler_t do_monitor_call; |
63 | extern pgm_check_handler_t do_asce_exception; | ||
63 | 64 | ||
64 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) | 65 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) |
65 | 66 | ||
@@ -730,7 +731,7 @@ void __init trap_init(void) | |||
730 | pgm_check_table[0x12] = &translation_exception; | 731 | pgm_check_table[0x12] = &translation_exception; |
731 | pgm_check_table[0x13] = &special_op_exception; | 732 | pgm_check_table[0x13] = &special_op_exception; |
732 | #ifdef CONFIG_64BIT | 733 | #ifdef CONFIG_64BIT |
733 | pgm_check_table[0x38] = &do_dat_exception; | 734 | pgm_check_table[0x38] = &do_asce_exception; |
734 | pgm_check_table[0x39] = &do_dat_exception; | 735 | pgm_check_table[0x39] = &do_dat_exception; |
735 | pgm_check_table[0x3A] = &do_dat_exception; | 736 | pgm_check_table[0x3A] = &do_dat_exception; |
736 | pgm_check_table[0x3B] = &do_dat_exception; | 737 | pgm_check_table[0x3B] = &do_dat_exception; |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 2456b52ed068..ed13d429a487 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
34 | #include <asm/s390_ext.h> | 34 | #include <asm/s390_ext.h> |
35 | #include <asm/mmu_context.h> | ||
35 | 36 | ||
36 | #ifndef CONFIG_64BIT | 37 | #ifndef CONFIG_64BIT |
37 | #define __FAIL_ADDR_MASK 0x7ffff000 | 38 | #define __FAIL_ADDR_MASK 0x7ffff000 |
@@ -444,6 +445,45 @@ void __kprobes do_dat_exception(struct pt_regs *regs, unsigned long error_code) | |||
444 | do_exception(regs, error_code & 0xff, 0); | 445 | do_exception(regs, error_code & 0xff, 0); |
445 | } | 446 | } |
446 | 447 | ||
448 | #ifdef CONFIG_64BIT | ||
449 | void __kprobes do_asce_exception(struct pt_regs *regs, unsigned long error_code) | ||
450 | { | ||
451 | struct mm_struct *mm; | ||
452 | struct vm_area_struct *vma; | ||
453 | unsigned long address; | ||
454 | int space; | ||
455 | |||
456 | mm = current->mm; | ||
457 | address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK; | ||
458 | space = check_space(current); | ||
459 | |||
460 | if (unlikely(space == 0 || in_atomic() || !mm)) | ||
461 | goto no_context; | ||
462 | |||
463 | local_irq_enable(); | ||
464 | |||
465 | down_read(&mm->mmap_sem); | ||
466 | vma = find_vma(mm, address); | ||
467 | up_read(&mm->mmap_sem); | ||
468 | |||
469 | if (vma) { | ||
470 | update_mm(mm, current); | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | /* User mode accesses just cause a SIGSEGV */ | ||
475 | if (regs->psw.mask & PSW_MASK_PSTATE) { | ||
476 | current->thread.prot_addr = address; | ||
477 | current->thread.trap_no = error_code; | ||
478 | do_sigsegv(regs, error_code, SEGV_MAPERR, address); | ||
479 | return; | ||
480 | } | ||
481 | |||
482 | no_context: | ||
483 | do_no_context(regs, error_code, address); | ||
484 | } | ||
485 | #endif | ||
486 | |||
447 | #ifdef CONFIG_PFAULT | 487 | #ifdef CONFIG_PFAULT |
448 | /* | 488 | /* |
449 | * 'pfault' pseudo page faults routines. | 489 | * 'pfault' pseudo page faults routines. |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 983ec6ec0e7c..8053245fe259 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -112,6 +112,7 @@ void __init paging_init(void) | |||
112 | init_mm.pgd = swapper_pg_dir; | 112 | init_mm.pgd = swapper_pg_dir; |
113 | S390_lowcore.kernel_asce = __pa(init_mm.pgd) & PAGE_MASK; | 113 | S390_lowcore.kernel_asce = __pa(init_mm.pgd) & PAGE_MASK; |
114 | #ifdef CONFIG_64BIT | 114 | #ifdef CONFIG_64BIT |
115 | /* A three level page table (4TB) is enough for the kernel space. */ | ||
115 | S390_lowcore.kernel_asce |= _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH; | 116 | S390_lowcore.kernel_asce |= _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH; |
116 | pgd_type = _REGION3_ENTRY_EMPTY; | 117 | pgd_type = _REGION3_ENTRY_EMPTY; |
117 | #else | 118 | #else |
@@ -184,7 +185,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
184 | pmd = pmd_offset(pud, address); | 185 | pmd = pmd_offset(pud, address); |
185 | pte = pte_offset_kernel(pmd, address); | 186 | pte = pte_offset_kernel(pmd, address); |
186 | if (!enable) { | 187 | if (!enable) { |
187 | ptep_invalidate(address, pte); | 188 | ptep_invalidate(&init_mm, address, pte); |
188 | continue; | 189 | continue; |
189 | } | 190 | } |
190 | *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW)); | 191 | *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW)); |
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index 356257c171de..5932a824547a 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/personality.h> | 27 | #include <linux/personality.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <asm/pgalloc.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Top of mmap area (just below the process stack). | 33 | * Top of mmap area (just below the process stack). |
@@ -62,6 +63,8 @@ static inline int mmap_is_legacy(void) | |||
62 | current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; | 63 | current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; |
63 | } | 64 | } |
64 | 65 | ||
66 | #ifndef CONFIG_64BIT | ||
67 | |||
65 | /* | 68 | /* |
66 | * This function, called very early during the creation of a new | 69 | * This function, called very early during the creation of a new |
67 | * process VM image, sets up which VM layout function to use: | 70 | * process VM image, sets up which VM layout function to use: |
@@ -84,3 +87,65 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
84 | } | 87 | } |
85 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); | 88 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); |
86 | 89 | ||
90 | #else | ||
91 | |||
92 | static unsigned long | ||
93 | s390_get_unmapped_area(struct file *filp, unsigned long addr, | ||
94 | unsigned long len, unsigned long pgoff, unsigned long flags) | ||
95 | { | ||
96 | struct mm_struct *mm = current->mm; | ||
97 | int rc; | ||
98 | |||
99 | addr = arch_get_unmapped_area(filp, addr, len, pgoff, flags); | ||
100 | if (addr & ~PAGE_MASK) | ||
101 | return addr; | ||
102 | if (unlikely(mm->context.asce_limit < addr + len)) { | ||
103 | rc = crst_table_upgrade(mm, addr + len); | ||
104 | if (rc) | ||
105 | return (unsigned long) rc; | ||
106 | } | ||
107 | return addr; | ||
108 | } | ||
109 | |||
110 | static unsigned long | ||
111 | s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | ||
112 | const unsigned long len, const unsigned long pgoff, | ||
113 | const unsigned long flags) | ||
114 | { | ||
115 | struct mm_struct *mm = current->mm; | ||
116 | unsigned long addr = addr0; | ||
117 | int rc; | ||
118 | |||
119 | addr = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags); | ||
120 | if (addr & ~PAGE_MASK) | ||
121 | return addr; | ||
122 | if (unlikely(mm->context.asce_limit < addr + len)) { | ||
123 | rc = crst_table_upgrade(mm, addr + len); | ||
124 | if (rc) | ||
125 | return (unsigned long) rc; | ||
126 | } | ||
127 | return addr; | ||
128 | } | ||
129 | /* | ||
130 | * This function, called very early during the creation of a new | ||
131 | * process VM image, sets up which VM layout function to use: | ||
132 | */ | ||
133 | void arch_pick_mmap_layout(struct mm_struct *mm) | ||
134 | { | ||
135 | /* | ||
136 | * Fall back to the standard layout if the personality | ||
137 | * bit is set, or if the expected stack growth is unlimited: | ||
138 | */ | ||
139 | if (mmap_is_legacy()) { | ||
140 | mm->mmap_base = TASK_UNMAPPED_BASE; | ||
141 | mm->get_unmapped_area = s390_get_unmapped_area; | ||
142 | mm->unmap_area = arch_unmap_area; | ||
143 | } else { | ||
144 | mm->mmap_base = mmap_base(); | ||
145 | mm->get_unmapped_area = s390_get_unmapped_area_topdown; | ||
146 | mm->unmap_area = arch_unmap_area_topdown; | ||
147 | } | ||
148 | } | ||
149 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); | ||
150 | |||
151 | #endif | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 019f518cd5a0..fd072013f88c 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -23,11 +23,18 @@ | |||
23 | #include <asm/pgalloc.h> | 23 | #include <asm/pgalloc.h> |
24 | #include <asm/tlb.h> | 24 | #include <asm/tlb.h> |
25 | #include <asm/tlbflush.h> | 25 | #include <asm/tlbflush.h> |
26 | #include <asm/mmu_context.h> | ||
26 | 27 | ||
27 | #ifndef CONFIG_64BIT | 28 | #ifndef CONFIG_64BIT |
28 | #define ALLOC_ORDER 1 | 29 | #define ALLOC_ORDER 1 |
30 | #define TABLES_PER_PAGE 4 | ||
31 | #define FRAG_MASK 15UL | ||
32 | #define SECOND_HALVES 10UL | ||
29 | #else | 33 | #else |
30 | #define ALLOC_ORDER 2 | 34 | #define ALLOC_ORDER 2 |
35 | #define TABLES_PER_PAGE 2 | ||
36 | #define FRAG_MASK 3UL | ||
37 | #define SECOND_HALVES 2UL | ||
31 | #endif | 38 | #endif |
32 | 39 | ||
33 | unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) | 40 | unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) |
@@ -45,52 +52,179 @@ unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) | |||
45 | } | 52 | } |
46 | page->index = page_to_phys(shadow); | 53 | page->index = page_to_phys(shadow); |
47 | } | 54 | } |
55 | spin_lock(&mm->page_table_lock); | ||
56 | list_add(&page->lru, &mm->context.crst_list); | ||
57 | spin_unlock(&mm->page_table_lock); | ||
48 | return (unsigned long *) page_to_phys(page); | 58 | return (unsigned long *) page_to_phys(page); |
49 | } | 59 | } |
50 | 60 | ||
51 | void crst_table_free(unsigned long *table) | 61 | void crst_table_free(struct mm_struct *mm, unsigned long *table) |
52 | { | 62 | { |
53 | unsigned long *shadow = get_shadow_table(table); | 63 | unsigned long *shadow = get_shadow_table(table); |
64 | struct page *page = virt_to_page(table); | ||
54 | 65 | ||
66 | spin_lock(&mm->page_table_lock); | ||
67 | list_del(&page->lru); | ||
68 | spin_unlock(&mm->page_table_lock); | ||
55 | if (shadow) | 69 | if (shadow) |
56 | free_pages((unsigned long) shadow, ALLOC_ORDER); | 70 | free_pages((unsigned long) shadow, ALLOC_ORDER); |
57 | free_pages((unsigned long) table, ALLOC_ORDER); | 71 | free_pages((unsigned long) table, ALLOC_ORDER); |
58 | } | 72 | } |
59 | 73 | ||
74 | #ifdef CONFIG_64BIT | ||
75 | int crst_table_upgrade(struct mm_struct *mm, unsigned long limit) | ||
76 | { | ||
77 | unsigned long *table, *pgd; | ||
78 | unsigned long entry; | ||
79 | |||
80 | BUG_ON(limit > (1UL << 53)); | ||
81 | repeat: | ||
82 | table = crst_table_alloc(mm, mm->context.noexec); | ||
83 | if (!table) | ||
84 | return -ENOMEM; | ||
85 | spin_lock(&mm->page_table_lock); | ||
86 | if (mm->context.asce_limit < limit) { | ||
87 | pgd = (unsigned long *) mm->pgd; | ||
88 | if (mm->context.asce_limit <= (1UL << 31)) { | ||
89 | entry = _REGION3_ENTRY_EMPTY; | ||
90 | mm->context.asce_limit = 1UL << 42; | ||
91 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
92 | _ASCE_USER_BITS | | ||
93 | _ASCE_TYPE_REGION3; | ||
94 | } else { | ||
95 | entry = _REGION2_ENTRY_EMPTY; | ||
96 | mm->context.asce_limit = 1UL << 53; | ||
97 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
98 | _ASCE_USER_BITS | | ||
99 | _ASCE_TYPE_REGION2; | ||
100 | } | ||
101 | crst_table_init(table, entry); | ||
102 | pgd_populate(mm, (pgd_t *) table, (pud_t *) pgd); | ||
103 | mm->pgd = (pgd_t *) table; | ||
104 | table = NULL; | ||
105 | } | ||
106 | spin_unlock(&mm->page_table_lock); | ||
107 | if (table) | ||
108 | crst_table_free(mm, table); | ||
109 | if (mm->context.asce_limit < limit) | ||
110 | goto repeat; | ||
111 | update_mm(mm, current); | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | void crst_table_downgrade(struct mm_struct *mm, unsigned long limit) | ||
116 | { | ||
117 | pgd_t *pgd; | ||
118 | |||
119 | if (mm->context.asce_limit <= limit) | ||
120 | return; | ||
121 | __tlb_flush_mm(mm); | ||
122 | while (mm->context.asce_limit > limit) { | ||
123 | pgd = mm->pgd; | ||
124 | switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) { | ||
125 | case _REGION_ENTRY_TYPE_R2: | ||
126 | mm->context.asce_limit = 1UL << 42; | ||
127 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
128 | _ASCE_USER_BITS | | ||
129 | _ASCE_TYPE_REGION3; | ||
130 | break; | ||
131 | case _REGION_ENTRY_TYPE_R3: | ||
132 | mm->context.asce_limit = 1UL << 31; | ||
133 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
134 | _ASCE_USER_BITS | | ||
135 | _ASCE_TYPE_SEGMENT; | ||
136 | break; | ||
137 | default: | ||
138 | BUG(); | ||
139 | } | ||
140 | mm->pgd = (pgd_t *) (pgd_val(*pgd) & _REGION_ENTRY_ORIGIN); | ||
141 | crst_table_free(mm, (unsigned long *) pgd); | ||
142 | } | ||
143 | update_mm(mm, current); | ||
144 | } | ||
145 | #endif | ||
146 | |||
60 | /* | 147 | /* |
61 | * page table entry allocation/free routines. | 148 | * page table entry allocation/free routines. |
62 | */ | 149 | */ |
63 | unsigned long *page_table_alloc(int noexec) | 150 | unsigned long *page_table_alloc(struct mm_struct *mm) |
64 | { | 151 | { |
65 | struct page *page = alloc_page(GFP_KERNEL); | 152 | struct page *page; |
66 | unsigned long *table; | 153 | unsigned long *table; |
154 | unsigned long bits; | ||
67 | 155 | ||
68 | if (!page) | 156 | bits = mm->context.noexec ? 3UL : 1UL; |
69 | return NULL; | 157 | spin_lock(&mm->page_table_lock); |
70 | page->index = 0; | 158 | page = NULL; |
71 | if (noexec) { | 159 | if (!list_empty(&mm->context.pgtable_list)) { |
72 | struct page *shadow = alloc_page(GFP_KERNEL); | 160 | page = list_first_entry(&mm->context.pgtable_list, |
73 | if (!shadow) { | 161 | struct page, lru); |
74 | __free_page(page); | 162 | if ((page->flags & FRAG_MASK) == ((1UL << TABLES_PER_PAGE) - 1)) |
163 | page = NULL; | ||
164 | } | ||
165 | if (!page) { | ||
166 | spin_unlock(&mm->page_table_lock); | ||
167 | page = alloc_page(GFP_KERNEL|__GFP_REPEAT); | ||
168 | if (!page) | ||
75 | return NULL; | 169 | return NULL; |
76 | } | 170 | pgtable_page_ctor(page); |
77 | table = (unsigned long *) page_to_phys(shadow); | 171 | page->flags &= ~FRAG_MASK; |
172 | table = (unsigned long *) page_to_phys(page); | ||
78 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 173 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); |
79 | page->index = (addr_t) table; | 174 | spin_lock(&mm->page_table_lock); |
175 | list_add(&page->lru, &mm->context.pgtable_list); | ||
80 | } | 176 | } |
81 | pgtable_page_ctor(page); | ||
82 | table = (unsigned long *) page_to_phys(page); | 177 | table = (unsigned long *) page_to_phys(page); |
83 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 178 | while (page->flags & bits) { |
179 | table += 256; | ||
180 | bits <<= 1; | ||
181 | } | ||
182 | page->flags |= bits; | ||
183 | if ((page->flags & FRAG_MASK) == ((1UL << TABLES_PER_PAGE) - 1)) | ||
184 | list_move_tail(&page->lru, &mm->context.pgtable_list); | ||
185 | spin_unlock(&mm->page_table_lock); | ||
84 | return table; | 186 | return table; |
85 | } | 187 | } |
86 | 188 | ||
87 | void page_table_free(unsigned long *table) | 189 | void page_table_free(struct mm_struct *mm, unsigned long *table) |
88 | { | 190 | { |
89 | unsigned long *shadow = get_shadow_pte(table); | 191 | struct page *page; |
192 | unsigned long bits; | ||
90 | 193 | ||
91 | pgtable_page_dtor(virt_to_page(table)); | 194 | bits = mm->context.noexec ? 3UL : 1UL; |
92 | if (shadow) | 195 | bits <<= (__pa(table) & (PAGE_SIZE - 1)) / 256 / sizeof(unsigned long); |
93 | free_page((unsigned long) shadow); | 196 | page = pfn_to_page(__pa(table) >> PAGE_SHIFT); |
94 | free_page((unsigned long) table); | 197 | spin_lock(&mm->page_table_lock); |
198 | page->flags ^= bits; | ||
199 | if (page->flags & FRAG_MASK) { | ||
200 | /* Page now has some free pgtable fragments. */ | ||
201 | list_move(&page->lru, &mm->context.pgtable_list); | ||
202 | page = NULL; | ||
203 | } else | ||
204 | /* All fragments of the 4K page have been freed. */ | ||
205 | list_del(&page->lru); | ||
206 | spin_unlock(&mm->page_table_lock); | ||
207 | if (page) { | ||
208 | pgtable_page_dtor(page); | ||
209 | __free_page(page); | ||
210 | } | ||
211 | } | ||
95 | 212 | ||
213 | void disable_noexec(struct mm_struct *mm, struct task_struct *tsk) | ||
214 | { | ||
215 | struct page *page; | ||
216 | |||
217 | spin_lock(&mm->page_table_lock); | ||
218 | /* Free shadow region and segment tables. */ | ||
219 | list_for_each_entry(page, &mm->context.crst_list, lru) | ||
220 | if (page->index) { | ||
221 | free_pages((unsigned long) page->index, ALLOC_ORDER); | ||
222 | page->index = 0; | ||
223 | } | ||
224 | /* "Free" second halves of page tables. */ | ||
225 | list_for_each_entry(page, &mm->context.pgtable_list, lru) | ||
226 | page->flags &= ~SECOND_HALVES; | ||
227 | spin_unlock(&mm->page_table_lock); | ||
228 | mm->context.noexec = 0; | ||
229 | update_mm(mm, tsk); | ||
96 | } | 230 | } |
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c index 7c1287ccf788..35d90a4720fd 100644 --- a/arch/s390/mm/vmem.c +++ b/arch/s390/mm/vmem.c | |||
@@ -69,7 +69,19 @@ static void __ref *vmem_alloc_pages(unsigned int order) | |||
69 | return alloc_bootmem_pages((1 << order) * PAGE_SIZE); | 69 | return alloc_bootmem_pages((1 << order) * PAGE_SIZE); |
70 | } | 70 | } |
71 | 71 | ||
72 | #define vmem_pud_alloc() ({ BUG(); ((pud_t *) NULL); }) | 72 | static inline pud_t *vmem_pud_alloc(void) |
73 | { | ||
74 | pud_t *pud = NULL; | ||
75 | |||
76 | #ifdef CONFIG_64BIT | ||
77 | pud = vmem_alloc_pages(2); | ||
78 | if (!pud) | ||
79 | return NULL; | ||
80 | pud_val(*pud) = _REGION3_ENTRY_EMPTY; | ||
81 | memcpy(pud + 1, pud, (PTRS_PER_PUD - 1)*sizeof(pud_t)); | ||
82 | #endif | ||
83 | return pud; | ||
84 | } | ||
73 | 85 | ||
74 | static inline pmd_t *vmem_pmd_alloc(void) | 86 | static inline pmd_t *vmem_pmd_alloc(void) |
75 | { | 87 | { |
@@ -84,13 +96,18 @@ static inline pmd_t *vmem_pmd_alloc(void) | |||
84 | return pmd; | 96 | return pmd; |
85 | } | 97 | } |
86 | 98 | ||
87 | static inline pte_t *vmem_pte_alloc(void) | 99 | static pte_t __init_refok *vmem_pte_alloc(void) |
88 | { | 100 | { |
89 | pte_t *pte = vmem_alloc_pages(0); | 101 | pte_t *pte; |
90 | 102 | ||
103 | if (slab_is_available()) | ||
104 | pte = (pte_t *) page_table_alloc(&init_mm); | ||
105 | else | ||
106 | pte = alloc_bootmem(PTRS_PER_PTE * sizeof(pte_t)); | ||
91 | if (!pte) | 107 | if (!pte) |
92 | return NULL; | 108 | return NULL; |
93 | clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 109 | clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY, |
110 | PTRS_PER_PTE * sizeof(pte_t)); | ||
94 | return pte; | 111 | return pte; |
95 | } | 112 | } |
96 | 113 | ||
@@ -360,6 +377,9 @@ void __init vmem_map_init(void) | |||
360 | { | 377 | { |
361 | int i; | 378 | int i; |
362 | 379 | ||
380 | INIT_LIST_HEAD(&init_mm.context.crst_list); | ||
381 | INIT_LIST_HEAD(&init_mm.context.pgtable_list); | ||
382 | init_mm.context.noexec = 0; | ||
363 | NODE_DATA(0)->node_mem_map = VMEM_MAP; | 383 | NODE_DATA(0)->node_mem_map = VMEM_MAP; |
364 | for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) | 384 | for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) |
365 | vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); | 385 | vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 6e035d1cf789..d87d4bf88803 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/SuperH Kernel Configuration" | |||
8 | config SUPERH | 8 | config SUPERH |
9 | def_bool y | 9 | def_bool y |
10 | select EMBEDDED | 10 | select EMBEDDED |
11 | select HAVE_IDE | ||
11 | select HAVE_OPROFILE | 12 | select HAVE_OPROFILE |
12 | help | 13 | help |
13 | The SuperH is a RISC processor targeted for use in embedded systems | 14 | The SuperH is a RISC processor targeted for use in embedded systems |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 7c674a3503b6..c40343c54920 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -69,6 +69,7 @@ config NR_CPUS | |||
69 | config SPARC | 69 | config SPARC |
70 | bool | 70 | bool |
71 | default y | 71 | default y |
72 | select HAVE_IDE | ||
72 | select HAVE_OPROFILE | 73 | select HAVE_OPROFILE |
73 | 74 | ||
74 | # Identify this as a Sparc32 build | 75 | # Identify this as a Sparc32 build |
diff --git a/arch/sparc/kernel/errtbls.c b/arch/sparc/kernel/errtbls.c index bb36f6eadfee..ed14df7116e9 100644 --- a/arch/sparc/kernel/errtbls.c +++ b/arch/sparc/kernel/errtbls.c | |||
@@ -1,21 +1,18 @@ | |||
1 | /* $Id: errtbls.c,v 1.2 1995/11/25 00:57:55 davem Exp $ | 1 | /* errtbls.c: Error number conversion tables. |
2 | * errtbls.c: Error number conversion tables between various syscall | ||
3 | * OS semantics. | ||
4 | * | 2 | * |
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) |
6 | * | 4 | * |
7 | * Based upon preliminary work which is: | 5 | * Based upon preliminary work which is: |
8 | * | 6 | * |
9 | * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) | 7 | * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) |
10 | */ | 8 | */ |
11 | 9 | ||
12 | #include <asm/bsderrno.h> /* NetBSD (bsd4.4) errnos */ | ||
13 | #include <asm/solerrno.h> /* Solaris errnos */ | 10 | #include <asm/solerrno.h> /* Solaris errnos */ |
14 | 11 | ||
15 | /* Here are tables which convert between Linux/SunOS error number | 12 | /* Here is the table which converts between Linux error number values |
16 | * values to the equivalent in other OSs. Note that since the Linux | 13 | * to the equivalent under Solaris. Note that since the Linux ones |
17 | * ones have been set up to match exactly those of SunOS, no | 14 | * have been set up to match exactly those of SunOS, no translation |
18 | * translation table is needed for that OS. | 15 | * table is needed for that OS. |
19 | */ | 16 | */ |
20 | 17 | ||
21 | int solaris_errno[] = { | 18 | int solaris_errno[] = { |
@@ -145,132 +142,3 @@ int solaris_errno[] = { | |||
145 | SOL_ELIBMAX, | 142 | SOL_ELIBMAX, |
146 | SOL_ELIBSCN, | 143 | SOL_ELIBSCN, |
147 | }; | 144 | }; |
148 | |||
149 | int netbsd_errno[] = { | ||
150 | 0, | ||
151 | BSD_EPERM, | ||
152 | BSD_ENOENT, | ||
153 | BSD_ESRCH, | ||
154 | BSD_EINTR, | ||
155 | BSD_EIO, | ||
156 | BSD_ENXIO, | ||
157 | BSD_E2BIG, | ||
158 | BSD_ENOEXEC, | ||
159 | BSD_EBADF, | ||
160 | BSD_ECHILD, | ||
161 | BSD_EAGAIN, | ||
162 | BSD_ENOMEM, | ||
163 | BSD_EACCES, | ||
164 | BSD_EFAULT, | ||
165 | BSD_NOTBLK, | ||
166 | BSD_EBUSY, | ||
167 | BSD_EEXIST, | ||
168 | BSD_EXDEV, | ||
169 | BSD_ENODEV, | ||
170 | BSD_ENOTDIR, | ||
171 | BSD_EISDIR, | ||
172 | BSD_EINVAL, | ||
173 | BSD_ENFILE, | ||
174 | BSD_EMFILE, | ||
175 | BSD_ENOTTY, | ||
176 | BSD_ETXTBSY, | ||
177 | BSD_EFBIG, | ||
178 | BSD_ENOSPC, | ||
179 | BSD_ESPIPE, | ||
180 | BSD_EROFS, | ||
181 | BSD_EMLINK, | ||
182 | BSD_EPIPE, | ||
183 | BSD_EDOM, | ||
184 | BSD_ERANGE, | ||
185 | BSD_EWOULDBLOCK, | ||
186 | BSD_EINPROGRESS, | ||
187 | BSD_EALREADY, | ||
188 | BSD_ENOTSOCK, | ||
189 | BSD_EDESTADDRREQ, | ||
190 | BSD_EMSGSIZE, | ||
191 | BSD_EPROTOTYPE, | ||
192 | BSD_ENOPROTOOPT, | ||
193 | BSD_EPROTONOSUPPORT, | ||
194 | BSD_ESOCKTNOSUPPORT, | ||
195 | BSD_EOPNOTSUPP, | ||
196 | BSD_EPFNOSUPPORT, | ||
197 | BSD_EAFNOSUPPORT, | ||
198 | BSD_EADDRINUSE, | ||
199 | BSD_EADDRNOTAVAIL, | ||
200 | BSD_ENETDOWN, | ||
201 | BSD_ENETUNREACH, | ||
202 | BSD_ENETRESET, | ||
203 | BSD_ECONNABORTED, | ||
204 | BSD_ECONNRESET, | ||
205 | BSD_ENOBUFS, | ||
206 | BSD_EISCONN, | ||
207 | BSD_ENOTONN, | ||
208 | BSD_ESHUTDOWN, | ||
209 | BSD_ETOOMANYREFS, | ||
210 | BSD_ETIMEDOUT, | ||
211 | BSD_ECONNREFUSED, | ||
212 | BSD_ELOOP, | ||
213 | BSD_ENAMETOOLONG, | ||
214 | BSD_EHOSTDOWN, | ||
215 | BSD_EHOSTUNREACH, | ||
216 | BSD_ENOTEMPTY, | ||
217 | BSD_EPROCLIM, | ||
218 | BSD_EUSERS, | ||
219 | BSD_EDQUOT, | ||
220 | BSD_ESTALE, | ||
221 | BSD_EREMOTE, | ||
222 | BSD_ENOSTR, | ||
223 | BSD_ETIME, | ||
224 | BSD_ENOSR, | ||
225 | BSD_ENOMSG, | ||
226 | BSD_EBADMSG, | ||
227 | BSD_IDRM, | ||
228 | BSD_EDEADLK, | ||
229 | BSD_ENOLCK, | ||
230 | BSD_ENONET, | ||
231 | BSD_ERREMOTE, | ||
232 | BSD_ENOLINK, | ||
233 | BSD_EADV, | ||
234 | BSD_ESRMNT, | ||
235 | BSD_ECOMM, | ||
236 | BSD_EPROTO, | ||
237 | BSD_EMULTIHOP, | ||
238 | BSD_EINVAL, /* EDOTDOT XXX??? */ | ||
239 | BSD_REMCHG, | ||
240 | BSD_NOSYS, | ||
241 | BSD_STRPIPE, | ||
242 | BSD_EOVERFLOW, | ||
243 | BSD_EBADFD, | ||
244 | BSD_ECHRNG, | ||
245 | BSD_EL2NSYNC, | ||
246 | BSD_EL3HLT, | ||
247 | BSD_EL3RST, | ||
248 | BSD_NRNG, | ||
249 | BSD_EUNATCH, | ||
250 | BSD_ENOCSI, | ||
251 | BSD_EL2HLT, | ||
252 | BSD_EBADE, | ||
253 | BSD_EBADR, | ||
254 | BSD_EXFULL, | ||
255 | BSD_ENOANO, | ||
256 | BSD_EBADRQC, | ||
257 | BSD_EBADSLT, | ||
258 | BSD_EDEADLOCK, | ||
259 | BSD_EBFONT, | ||
260 | BSD_ELIBEXEC, | ||
261 | BSD_ENODATA, | ||
262 | BSD_ELIBBAD, | ||
263 | BSD_ENOPKG, | ||
264 | BSD_ELIBACC, | ||
265 | BSD_ENOTUNIQ, | ||
266 | BSD_ERESTART, | ||
267 | BSD_EUCLEAN, | ||
268 | BSD_ENOTNAM, | ||
269 | BSD_ENAVAIL, | ||
270 | BSD_EISNAM, | ||
271 | BSD_EREMOTEIO, | ||
272 | BSD_EILSEQ, | ||
273 | BSD_ELIBMAX, | ||
274 | BSD_ELIBSCN, | ||
275 | }; | ||
276 | |||
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index 3ea000d15e3a..cc4c235c4f59 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c | |||
@@ -584,30 +584,3 @@ static int __init of_debug(char *str) | |||
584 | } | 584 | } |
585 | 585 | ||
586 | __setup("of_debug=", of_debug); | 586 | __setup("of_debug=", of_debug); |
587 | |||
588 | struct of_device* of_platform_device_create(struct device_node *np, | ||
589 | const char *bus_id, | ||
590 | struct device *parent, | ||
591 | struct bus_type *bus) | ||
592 | { | ||
593 | struct of_device *dev; | ||
594 | |||
595 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
596 | if (!dev) | ||
597 | return NULL; | ||
598 | |||
599 | dev->dev.parent = parent; | ||
600 | dev->dev.bus = bus; | ||
601 | dev->dev.release = of_release_dev; | ||
602 | |||
603 | strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); | ||
604 | |||
605 | if (of_device_register(dev) != 0) { | ||
606 | kfree(dev); | ||
607 | return NULL; | ||
608 | } | ||
609 | |||
610 | return dev; | ||
611 | } | ||
612 | |||
613 | EXPORT_SYMBOL(of_platform_device_create); | ||
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 216147d6e61f..b1002c607196 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -89,6 +89,10 @@ SECTIONS | |||
89 | .data.cacheline_aligned : { | 89 | .data.cacheline_aligned : { |
90 | *(.data.cacheline_aligned) | 90 | *(.data.cacheline_aligned) |
91 | } | 91 | } |
92 | . = ALIGN(32); | ||
93 | .data.read_mostly : { | ||
94 | *(.data.read_mostly) | ||
95 | } | ||
92 | 96 | ||
93 | __bss_start = .; | 97 | __bss_start = .; |
94 | .sbss : { | 98 | .sbss : { |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index b810f2b7526a..3af378ddb6ae 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -14,6 +14,7 @@ config SPARC | |||
14 | config SPARC64 | 14 | config SPARC64 |
15 | bool | 15 | bool |
16 | default y | 16 | default y |
17 | select HAVE_IDE | ||
17 | help | 18 | help |
18 | SPARC is a family of RISC microprocessors designed and marketed by | 19 | SPARC is a family of RISC microprocessors designed and marketed by |
19 | Sun Microsystems, incorporated. This port covers the newer 64-bit | 20 | Sun Microsystems, incorporated. This port covers the newer 64-bit |
@@ -40,6 +41,10 @@ config MMU | |||
40 | bool | 41 | bool |
41 | default y | 42 | default y |
42 | 43 | ||
44 | config IOMMU_HELPER | ||
45 | bool | ||
46 | default y | ||
47 | |||
43 | config QUICKLIST | 48 | config QUICKLIST |
44 | bool | 49 | bool |
45 | default y | 50 | default y |
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c index 5623a4d59dff..d3276ebcfb47 100644 --- a/arch/sparc64/kernel/iommu.c +++ b/arch/sparc64/kernel/iommu.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* iommu.c: Generic sparc64 IOMMU support. | 1 | /* iommu.c: Generic sparc64 IOMMU support. |
2 | * | 2 | * |
3 | * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 1999, 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) | 4 | * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) |
5 | */ | 5 | */ |
6 | 6 | ||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/dma-mapping.h> | 11 | #include <linux/dma-mapping.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/iommu-helper.h> | ||
13 | 14 | ||
14 | #ifdef CONFIG_PCI | 15 | #ifdef CONFIG_PCI |
15 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
@@ -41,7 +42,7 @@ | |||
41 | "i" (ASI_PHYS_BYPASS_EC_E)) | 42 | "i" (ASI_PHYS_BYPASS_EC_E)) |
42 | 43 | ||
43 | /* Must be invoked under the IOMMU lock. */ | 44 | /* Must be invoked under the IOMMU lock. */ |
44 | static void __iommu_flushall(struct iommu *iommu) | 45 | static void iommu_flushall(struct iommu *iommu) |
45 | { | 46 | { |
46 | if (iommu->iommu_flushinv) { | 47 | if (iommu->iommu_flushinv) { |
47 | iommu_write(iommu->iommu_flushinv, ~(u64)0); | 48 | iommu_write(iommu->iommu_flushinv, ~(u64)0); |
@@ -83,54 +84,91 @@ static inline void iopte_make_dummy(struct iommu *iommu, iopte_t *iopte) | |||
83 | iopte_val(*iopte) = val; | 84 | iopte_val(*iopte) = val; |
84 | } | 85 | } |
85 | 86 | ||
86 | /* Based largely upon the ppc64 iommu allocator. */ | 87 | /* Based almost entirely upon the ppc64 iommu allocator. If you use the 'handle' |
87 | static long arena_alloc(struct iommu *iommu, unsigned long npages) | 88 | * facility it must all be done in one pass while under the iommu lock. |
89 | * | ||
90 | * On sun4u platforms, we only flush the IOMMU once every time we've passed | ||
91 | * over the entire page table doing allocations. Therefore we only ever advance | ||
92 | * the hint and cannot backtrack it. | ||
93 | */ | ||
94 | unsigned long iommu_range_alloc(struct device *dev, | ||
95 | struct iommu *iommu, | ||
96 | unsigned long npages, | ||
97 | unsigned long *handle) | ||
88 | { | 98 | { |
99 | unsigned long n, end, start, limit, boundary_size; | ||
89 | struct iommu_arena *arena = &iommu->arena; | 100 | struct iommu_arena *arena = &iommu->arena; |
90 | unsigned long n, i, start, end, limit; | 101 | int pass = 0; |
91 | int pass; | 102 | |
103 | /* This allocator was derived from x86_64's bit string search */ | ||
104 | |||
105 | /* Sanity check */ | ||
106 | if (unlikely(npages == 0)) { | ||
107 | if (printk_ratelimit()) | ||
108 | WARN_ON(1); | ||
109 | return DMA_ERROR_CODE; | ||
110 | } | ||
111 | |||
112 | if (handle && *handle) | ||
113 | start = *handle; | ||
114 | else | ||
115 | start = arena->hint; | ||
92 | 116 | ||
93 | limit = arena->limit; | 117 | limit = arena->limit; |
94 | start = arena->hint; | ||
95 | pass = 0; | ||
96 | 118 | ||
97 | again: | 119 | /* The case below can happen if we have a small segment appended |
98 | n = find_next_zero_bit(arena->map, limit, start); | 120 | * to a large, or when the previous alloc was at the very end of |
99 | end = n + npages; | 121 | * the available space. If so, go back to the beginning and flush. |
100 | if (unlikely(end >= limit)) { | 122 | */ |
123 | if (start >= limit) { | ||
124 | start = 0; | ||
125 | if (iommu->flush_all) | ||
126 | iommu->flush_all(iommu); | ||
127 | } | ||
128 | |||
129 | again: | ||
130 | |||
131 | if (dev) | ||
132 | boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, | ||
133 | 1 << IO_PAGE_SHIFT); | ||
134 | else | ||
135 | boundary_size = ALIGN(1UL << 32, 1 << IO_PAGE_SHIFT); | ||
136 | |||
137 | n = iommu_area_alloc(arena->map, limit, start, npages, 0, | ||
138 | boundary_size >> IO_PAGE_SHIFT, 0); | ||
139 | if (n == -1) { | ||
101 | if (likely(pass < 1)) { | 140 | if (likely(pass < 1)) { |
102 | limit = start; | 141 | /* First failure, rescan from the beginning. */ |
103 | start = 0; | 142 | start = 0; |
104 | __iommu_flushall(iommu); | 143 | if (iommu->flush_all) |
144 | iommu->flush_all(iommu); | ||
105 | pass++; | 145 | pass++; |
106 | goto again; | 146 | goto again; |
107 | } else { | 147 | } else { |
108 | /* Scanned the whole thing, give up. */ | 148 | /* Second failure, give up */ |
109 | return -1; | 149 | return DMA_ERROR_CODE; |
110 | } | ||
111 | } | ||
112 | |||
113 | for (i = n; i < end; i++) { | ||
114 | if (test_bit(i, arena->map)) { | ||
115 | start = i + 1; | ||
116 | goto again; | ||
117 | } | 150 | } |
118 | } | 151 | } |
119 | 152 | ||
120 | for (i = n; i < end; i++) | 153 | end = n + npages; |
121 | __set_bit(i, arena->map); | ||
122 | 154 | ||
123 | arena->hint = end; | 155 | arena->hint = end; |
124 | 156 | ||
157 | /* Update handle for SG allocations */ | ||
158 | if (handle) | ||
159 | *handle = end; | ||
160 | |||
125 | return n; | 161 | return n; |
126 | } | 162 | } |
127 | 163 | ||
128 | static void arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages) | 164 | void iommu_range_free(struct iommu *iommu, dma_addr_t dma_addr, unsigned long npages) |
129 | { | 165 | { |
130 | unsigned long i; | 166 | struct iommu_arena *arena = &iommu->arena; |
167 | unsigned long entry; | ||
131 | 168 | ||
132 | for (i = base; i < (base + npages); i++) | 169 | entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; |
133 | __clear_bit(i, arena->map); | 170 | |
171 | iommu_area_free(arena->map, entry, npages); | ||
134 | } | 172 | } |
135 | 173 | ||
136 | int iommu_table_init(struct iommu *iommu, int tsbsize, | 174 | int iommu_table_init(struct iommu *iommu, int tsbsize, |
@@ -156,6 +194,9 @@ int iommu_table_init(struct iommu *iommu, int tsbsize, | |||
156 | } | 194 | } |
157 | iommu->arena.limit = num_tsb_entries; | 195 | iommu->arena.limit = num_tsb_entries; |
158 | 196 | ||
197 | if (tlb_type != hypervisor) | ||
198 | iommu->flush_all = iommu_flushall; | ||
199 | |||
159 | /* Allocate and initialize the dummy page which we | 200 | /* Allocate and initialize the dummy page which we |
160 | * set inactive IO PTEs to point to. | 201 | * set inactive IO PTEs to point to. |
161 | */ | 202 | */ |
@@ -192,22 +233,18 @@ out_free_map: | |||
192 | return -ENOMEM; | 233 | return -ENOMEM; |
193 | } | 234 | } |
194 | 235 | ||
195 | static inline iopte_t *alloc_npages(struct iommu *iommu, unsigned long npages) | 236 | static inline iopte_t *alloc_npages(struct device *dev, struct iommu *iommu, |
237 | unsigned long npages) | ||
196 | { | 238 | { |
197 | long entry; | 239 | unsigned long entry; |
198 | 240 | ||
199 | entry = arena_alloc(iommu, npages); | 241 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
200 | if (unlikely(entry < 0)) | 242 | if (unlikely(entry == DMA_ERROR_CODE)) |
201 | return NULL; | 243 | return NULL; |
202 | 244 | ||
203 | return iommu->page_table + entry; | 245 | return iommu->page_table + entry; |
204 | } | 246 | } |
205 | 247 | ||
206 | static inline void free_npages(struct iommu *iommu, dma_addr_t base, unsigned long npages) | ||
207 | { | ||
208 | arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages); | ||
209 | } | ||
210 | |||
211 | static int iommu_alloc_ctx(struct iommu *iommu) | 248 | static int iommu_alloc_ctx(struct iommu *iommu) |
212 | { | 249 | { |
213 | int lowest = iommu->ctx_lowest_free; | 250 | int lowest = iommu->ctx_lowest_free; |
@@ -258,7 +295,7 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | |||
258 | iommu = dev->archdata.iommu; | 295 | iommu = dev->archdata.iommu; |
259 | 296 | ||
260 | spin_lock_irqsave(&iommu->lock, flags); | 297 | spin_lock_irqsave(&iommu->lock, flags); |
261 | iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT); | 298 | iopte = alloc_npages(dev, iommu, size >> IO_PAGE_SHIFT); |
262 | spin_unlock_irqrestore(&iommu->lock, flags); | 299 | spin_unlock_irqrestore(&iommu->lock, flags); |
263 | 300 | ||
264 | if (unlikely(iopte == NULL)) { | 301 | if (unlikely(iopte == NULL)) { |
@@ -296,7 +333,7 @@ static void dma_4u_free_coherent(struct device *dev, size_t size, | |||
296 | 333 | ||
297 | spin_lock_irqsave(&iommu->lock, flags); | 334 | spin_lock_irqsave(&iommu->lock, flags); |
298 | 335 | ||
299 | free_npages(iommu, dvma - iommu->page_table_map_base, npages); | 336 | iommu_range_free(iommu, dvma, npages); |
300 | 337 | ||
301 | spin_unlock_irqrestore(&iommu->lock, flags); | 338 | spin_unlock_irqrestore(&iommu->lock, flags); |
302 | 339 | ||
@@ -327,7 +364,7 @@ static dma_addr_t dma_4u_map_single(struct device *dev, void *ptr, size_t sz, | |||
327 | npages >>= IO_PAGE_SHIFT; | 364 | npages >>= IO_PAGE_SHIFT; |
328 | 365 | ||
329 | spin_lock_irqsave(&iommu->lock, flags); | 366 | spin_lock_irqsave(&iommu->lock, flags); |
330 | base = alloc_npages(iommu, npages); | 367 | base = alloc_npages(dev, iommu, npages); |
331 | ctx = 0; | 368 | ctx = 0; |
332 | if (iommu->iommu_ctxflush) | 369 | if (iommu->iommu_ctxflush) |
333 | ctx = iommu_alloc_ctx(iommu); | 370 | ctx = iommu_alloc_ctx(iommu); |
@@ -465,7 +502,7 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
465 | for (i = 0; i < npages; i++) | 502 | for (i = 0; i < npages; i++) |
466 | iopte_make_dummy(iommu, base + i); | 503 | iopte_make_dummy(iommu, base + i); |
467 | 504 | ||
468 | free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); | 505 | iommu_range_free(iommu, bus_addr, npages); |
469 | 506 | ||
470 | iommu_free_ctx(iommu, ctx); | 507 | iommu_free_ctx(iommu, ctx); |
471 | 508 | ||
@@ -475,124 +512,209 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
475 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, | 512 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, |
476 | int nelems, enum dma_data_direction direction) | 513 | int nelems, enum dma_data_direction direction) |
477 | { | 514 | { |
478 | unsigned long flags, ctx, i, npages, iopte_protection; | 515 | struct scatterlist *s, *outs, *segstart; |
479 | struct scatterlist *sg; | 516 | unsigned long flags, handle, prot, ctx; |
517 | dma_addr_t dma_next = 0, dma_addr; | ||
518 | unsigned int max_seg_size; | ||
519 | int outcount, incount, i; | ||
480 | struct strbuf *strbuf; | 520 | struct strbuf *strbuf; |
481 | struct iommu *iommu; | 521 | struct iommu *iommu; |
482 | iopte_t *base; | 522 | |
483 | u32 dma_base; | 523 | BUG_ON(direction == DMA_NONE); |
484 | |||
485 | /* Fast path single entry scatterlists. */ | ||
486 | if (nelems == 1) { | ||
487 | sglist->dma_address = | ||
488 | dma_4u_map_single(dev, sg_virt(sglist), | ||
489 | sglist->length, direction); | ||
490 | if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) | ||
491 | return 0; | ||
492 | sglist->dma_length = sglist->length; | ||
493 | return 1; | ||
494 | } | ||
495 | 524 | ||
496 | iommu = dev->archdata.iommu; | 525 | iommu = dev->archdata.iommu; |
497 | strbuf = dev->archdata.stc; | 526 | strbuf = dev->archdata.stc; |
498 | 527 | if (nelems == 0 || !iommu) | |
499 | if (unlikely(direction == DMA_NONE)) | 528 | return 0; |
500 | goto bad_no_ctx; | ||
501 | |||
502 | npages = calc_npages(sglist, nelems); | ||
503 | 529 | ||
504 | spin_lock_irqsave(&iommu->lock, flags); | 530 | spin_lock_irqsave(&iommu->lock, flags); |
505 | 531 | ||
506 | base = alloc_npages(iommu, npages); | ||
507 | ctx = 0; | 532 | ctx = 0; |
508 | if (iommu->iommu_ctxflush) | 533 | if (iommu->iommu_ctxflush) |
509 | ctx = iommu_alloc_ctx(iommu); | 534 | ctx = iommu_alloc_ctx(iommu); |
510 | 535 | ||
511 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
512 | |||
513 | if (base == NULL) | ||
514 | goto bad; | ||
515 | |||
516 | dma_base = iommu->page_table_map_base + | ||
517 | ((base - iommu->page_table) << IO_PAGE_SHIFT); | ||
518 | |||
519 | if (strbuf->strbuf_enabled) | 536 | if (strbuf->strbuf_enabled) |
520 | iopte_protection = IOPTE_STREAMING(ctx); | 537 | prot = IOPTE_STREAMING(ctx); |
521 | else | 538 | else |
522 | iopte_protection = IOPTE_CONSISTENT(ctx); | 539 | prot = IOPTE_CONSISTENT(ctx); |
523 | if (direction != DMA_TO_DEVICE) | 540 | if (direction != DMA_TO_DEVICE) |
524 | iopte_protection |= IOPTE_WRITE; | 541 | prot |= IOPTE_WRITE; |
525 | 542 | ||
526 | for_each_sg(sglist, sg, nelems, i) { | 543 | outs = s = segstart = &sglist[0]; |
527 | unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg); | 544 | outcount = 1; |
528 | unsigned long slen = sg->length; | 545 | incount = nelems; |
529 | unsigned long this_npages; | 546 | handle = 0; |
547 | |||
548 | /* Init first segment length for backout at failure */ | ||
549 | outs->dma_length = 0; | ||
550 | |||
551 | max_seg_size = dma_get_max_seg_size(dev); | ||
552 | for_each_sg(sglist, s, nelems, i) { | ||
553 | unsigned long paddr, npages, entry, slen; | ||
554 | iopte_t *base; | ||
555 | |||
556 | slen = s->length; | ||
557 | /* Sanity check */ | ||
558 | if (slen == 0) { | ||
559 | dma_next = 0; | ||
560 | continue; | ||
561 | } | ||
562 | /* Allocate iommu entries for that segment */ | ||
563 | paddr = (unsigned long) SG_ENT_PHYS_ADDRESS(s); | ||
564 | npages = iommu_num_pages(paddr, slen); | ||
565 | entry = iommu_range_alloc(dev, iommu, npages, &handle); | ||
566 | |||
567 | /* Handle failure */ | ||
568 | if (unlikely(entry == DMA_ERROR_CODE)) { | ||
569 | if (printk_ratelimit()) | ||
570 | printk(KERN_INFO "iommu_alloc failed, iommu %p paddr %lx" | ||
571 | " npages %lx\n", iommu, paddr, npages); | ||
572 | goto iommu_map_failed; | ||
573 | } | ||
530 | 574 | ||
531 | this_npages = iommu_num_pages(paddr, slen); | 575 | base = iommu->page_table + entry; |
532 | 576 | ||
533 | sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK); | 577 | /* Convert entry to a dma_addr_t */ |
534 | sg->dma_length = slen; | 578 | dma_addr = iommu->page_table_map_base + |
579 | (entry << IO_PAGE_SHIFT); | ||
580 | dma_addr |= (s->offset & ~IO_PAGE_MASK); | ||
535 | 581 | ||
582 | /* Insert into HW table */ | ||
536 | paddr &= IO_PAGE_MASK; | 583 | paddr &= IO_PAGE_MASK; |
537 | while (this_npages--) { | 584 | while (npages--) { |
538 | iopte_val(*base) = iopte_protection | paddr; | 585 | iopte_val(*base) = prot | paddr; |
539 | |||
540 | base++; | 586 | base++; |
541 | paddr += IO_PAGE_SIZE; | 587 | paddr += IO_PAGE_SIZE; |
542 | dma_base += IO_PAGE_SIZE; | ||
543 | } | 588 | } |
589 | |||
590 | /* If we are in an open segment, try merging */ | ||
591 | if (segstart != s) { | ||
592 | /* We cannot merge if: | ||
593 | * - allocated dma_addr isn't contiguous to previous allocation | ||
594 | */ | ||
595 | if ((dma_addr != dma_next) || | ||
596 | (outs->dma_length + s->length > max_seg_size)) { | ||
597 | /* Can't merge: create a new segment */ | ||
598 | segstart = s; | ||
599 | outcount++; | ||
600 | outs = sg_next(outs); | ||
601 | } else { | ||
602 | outs->dma_length += s->length; | ||
603 | } | ||
604 | } | ||
605 | |||
606 | if (segstart == s) { | ||
607 | /* This is a new segment, fill entries */ | ||
608 | outs->dma_address = dma_addr; | ||
609 | outs->dma_length = slen; | ||
610 | } | ||
611 | |||
612 | /* Calculate next page pointer for contiguous check */ | ||
613 | dma_next = dma_addr + slen; | ||
544 | } | 614 | } |
545 | 615 | ||
546 | return nelems; | 616 | spin_unlock_irqrestore(&iommu->lock, flags); |
617 | |||
618 | if (outcount < incount) { | ||
619 | outs = sg_next(outs); | ||
620 | outs->dma_address = DMA_ERROR_CODE; | ||
621 | outs->dma_length = 0; | ||
622 | } | ||
623 | |||
624 | return outcount; | ||
625 | |||
626 | iommu_map_failed: | ||
627 | for_each_sg(sglist, s, nelems, i) { | ||
628 | if (s->dma_length != 0) { | ||
629 | unsigned long vaddr, npages, entry, i; | ||
630 | iopte_t *base; | ||
631 | |||
632 | vaddr = s->dma_address & IO_PAGE_MASK; | ||
633 | npages = iommu_num_pages(s->dma_address, s->dma_length); | ||
634 | iommu_range_free(iommu, vaddr, npages); | ||
635 | |||
636 | entry = (vaddr - iommu->page_table_map_base) | ||
637 | >> IO_PAGE_SHIFT; | ||
638 | base = iommu->page_table + entry; | ||
639 | |||
640 | for (i = 0; i < npages; i++) | ||
641 | iopte_make_dummy(iommu, base + i); | ||
642 | |||
643 | s->dma_address = DMA_ERROR_CODE; | ||
644 | s->dma_length = 0; | ||
645 | } | ||
646 | if (s == outs) | ||
647 | break; | ||
648 | } | ||
649 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
547 | 650 | ||
548 | bad: | ||
549 | iommu_free_ctx(iommu, ctx); | ||
550 | bad_no_ctx: | ||
551 | if (printk_ratelimit()) | ||
552 | WARN_ON(1); | ||
553 | return 0; | 651 | return 0; |
554 | } | 652 | } |
555 | 653 | ||
654 | /* If contexts are being used, they are the same in all of the mappings | ||
655 | * we make for a particular SG. | ||
656 | */ | ||
657 | static unsigned long fetch_sg_ctx(struct iommu *iommu, struct scatterlist *sg) | ||
658 | { | ||
659 | unsigned long ctx = 0; | ||
660 | |||
661 | if (iommu->iommu_ctxflush) { | ||
662 | iopte_t *base; | ||
663 | u32 bus_addr; | ||
664 | |||
665 | bus_addr = sg->dma_address & IO_PAGE_MASK; | ||
666 | base = iommu->page_table + | ||
667 | ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
668 | |||
669 | ctx = (iopte_val(*base) & IOPTE_CONTEXT) >> 47UL; | ||
670 | } | ||
671 | return ctx; | ||
672 | } | ||
673 | |||
556 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, | 674 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, |
557 | int nelems, enum dma_data_direction direction) | 675 | int nelems, enum dma_data_direction direction) |
558 | { | 676 | { |
559 | unsigned long flags, ctx, i, npages; | 677 | unsigned long flags, ctx; |
678 | struct scatterlist *sg; | ||
560 | struct strbuf *strbuf; | 679 | struct strbuf *strbuf; |
561 | struct iommu *iommu; | 680 | struct iommu *iommu; |
562 | iopte_t *base; | ||
563 | u32 bus_addr; | ||
564 | 681 | ||
565 | if (unlikely(direction == DMA_NONE)) { | 682 | BUG_ON(direction == DMA_NONE); |
566 | if (printk_ratelimit()) | ||
567 | WARN_ON(1); | ||
568 | } | ||
569 | 683 | ||
570 | iommu = dev->archdata.iommu; | 684 | iommu = dev->archdata.iommu; |
571 | strbuf = dev->archdata.stc; | 685 | strbuf = dev->archdata.stc; |
572 | 686 | ||
573 | bus_addr = sglist->dma_address & IO_PAGE_MASK; | 687 | ctx = fetch_sg_ctx(iommu, sglist); |
574 | 688 | ||
575 | npages = calc_npages(sglist, nelems); | 689 | spin_lock_irqsave(&iommu->lock, flags); |
576 | 690 | ||
577 | base = iommu->page_table + | 691 | sg = sglist; |
578 | ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | 692 | while (nelems--) { |
693 | dma_addr_t dma_handle = sg->dma_address; | ||
694 | unsigned int len = sg->dma_length; | ||
695 | unsigned long npages, entry; | ||
696 | iopte_t *base; | ||
697 | int i; | ||
579 | 698 | ||
580 | spin_lock_irqsave(&iommu->lock, flags); | 699 | if (!len) |
700 | break; | ||
701 | npages = iommu_num_pages(dma_handle, len); | ||
702 | iommu_range_free(iommu, dma_handle, npages); | ||
581 | 703 | ||
582 | /* Record the context, if any. */ | 704 | entry = ((dma_handle - iommu->page_table_map_base) |
583 | ctx = 0; | 705 | >> IO_PAGE_SHIFT); |
584 | if (iommu->iommu_ctxflush) | 706 | base = iommu->page_table + entry; |
585 | ctx = (iopte_val(*base) & IOPTE_CONTEXT) >> 47UL; | ||
586 | 707 | ||
587 | /* Step 1: Kick data out of streaming buffers if necessary. */ | 708 | dma_handle &= IO_PAGE_MASK; |
588 | if (strbuf->strbuf_enabled) | 709 | if (strbuf->strbuf_enabled) |
589 | strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); | 710 | strbuf_flush(strbuf, iommu, dma_handle, ctx, |
711 | npages, direction); | ||
590 | 712 | ||
591 | /* Step 2: Clear out the TSB entries. */ | 713 | for (i = 0; i < npages; i++) |
592 | for (i = 0; i < npages; i++) | 714 | iopte_make_dummy(iommu, base + i); |
593 | iopte_make_dummy(iommu, base + i); | ||
594 | 715 | ||
595 | free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); | 716 | sg = sg_next(sg); |
717 | } | ||
596 | 718 | ||
597 | iommu_free_ctx(iommu, ctx); | 719 | iommu_free_ctx(iommu, ctx); |
598 | 720 | ||
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h index 4b5cafa2877a..0713bd58499c 100644 --- a/arch/sparc64/kernel/iommu_common.h +++ b/arch/sparc64/kernel/iommu_common.h | |||
@@ -1,9 +1,11 @@ | |||
1 | /* $Id: iommu_common.h,v 1.5 2001/12/11 09:41:01 davem Exp $ | 1 | /* iommu_common.h: UltraSparc SBUS/PCI common iommu declarations. |
2 | * iommu_common.h: UltraSparc SBUS/PCI common iommu declarations. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1999, 2008 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
6 | #ifndef _IOMMU_COMMON_H | ||
7 | #define _IOMMU_COMMON_H | ||
8 | |||
7 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
8 | #include <linux/types.h> | 10 | #include <linux/types.h> |
9 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
@@ -56,21 +58,12 @@ static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems) | |||
56 | return npages; | 58 | return npages; |
57 | } | 59 | } |
58 | 60 | ||
59 | /* You are _strongly_ advised to enable the following debugging code | 61 | extern unsigned long iommu_range_alloc(struct device *dev, |
60 | * any time you make changes to the sg code below, run it for a while | 62 | struct iommu *iommu, |
61 | * with filesystems mounted read-only before buying the farm... -DaveM | 63 | unsigned long npages, |
62 | */ | 64 | unsigned long *handle); |
63 | #undef VERIFY_SG | 65 | extern void iommu_range_free(struct iommu *iommu, |
64 | 66 | dma_addr_t dma_addr, | |
65 | #ifdef VERIFY_SG | 67 | unsigned long npages); |
66 | extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages); | ||
67 | #endif | ||
68 | |||
69 | /* Two addresses are "virtually contiguous" if and only if: | ||
70 | * 1) They are equal, or... | ||
71 | * 2) They are both on a page boundary | ||
72 | */ | ||
73 | #define VCONTIG(__X, __Y) (((__X) == (__Y)) || \ | ||
74 | (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL) | ||
75 | 68 | ||
76 | extern unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents); | 69 | #endif /* _IOMMU_COMMON_H */ |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index d94f901d321e..34fc3ddd5002 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -480,8 +480,117 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
480 | return 0; | 480 | return 0; |
481 | } | 481 | } |
482 | 482 | ||
483 | /* architecture specific initialization */ | 483 | /* Called with kretprobe_lock held. The value stored in the return |
484 | int arch_init_kprobes(void) | 484 | * address register is actually 2 instructions before where the |
485 | * callee will return to. Sequences usually look something like this | ||
486 | * | ||
487 | * call some_function <--- return register points here | ||
488 | * nop <--- call delay slot | ||
489 | * whatever <--- where callee returns to | ||
490 | * | ||
491 | * To keep trampoline_probe_handler logic simpler, we normalize the | ||
492 | * value kept in ri->ret_addr so we don't need to keep adjusting it | ||
493 | * back and forth. | ||
494 | */ | ||
495 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | ||
496 | struct pt_regs *regs) | ||
497 | { | ||
498 | ri->ret_addr = (kprobe_opcode_t *)(regs->u_regs[UREG_RETPC] + 8); | ||
499 | |||
500 | /* Replace the return addr with trampoline addr */ | ||
501 | regs->u_regs[UREG_RETPC] = | ||
502 | ((unsigned long)kretprobe_trampoline) - 8; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | * Called when the probe at kretprobe trampoline is hit | ||
507 | */ | ||
508 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | ||
509 | { | ||
510 | struct kretprobe_instance *ri = NULL; | ||
511 | struct hlist_head *head, empty_rp; | ||
512 | struct hlist_node *node, *tmp; | ||
513 | unsigned long flags, orig_ret_address = 0; | ||
514 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; | ||
515 | |||
516 | INIT_HLIST_HEAD(&empty_rp); | ||
517 | spin_lock_irqsave(&kretprobe_lock, flags); | ||
518 | head = kretprobe_inst_table_head(current); | ||
519 | |||
520 | /* | ||
521 | * It is possible to have multiple instances associated with a given | ||
522 | * task either because an multiple functions in the call path | ||
523 | * have a return probe installed on them, and/or more then one return | ||
524 | * return probe was registered for a target function. | ||
525 | * | ||
526 | * We can handle this because: | ||
527 | * - instances are always inserted at the head of the list | ||
528 | * - when multiple return probes are registered for the same | ||
529 | * function, the first instance's ret_addr will point to the | ||
530 | * real return address, and all the rest will point to | ||
531 | * kretprobe_trampoline | ||
532 | */ | ||
533 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { | ||
534 | if (ri->task != current) | ||
535 | /* another task is sharing our hash bucket */ | ||
536 | continue; | ||
537 | |||
538 | if (ri->rp && ri->rp->handler) | ||
539 | ri->rp->handler(ri, regs); | ||
540 | |||
541 | orig_ret_address = (unsigned long)ri->ret_addr; | ||
542 | recycle_rp_inst(ri, &empty_rp); | ||
543 | |||
544 | if (orig_ret_address != trampoline_address) | ||
545 | /* | ||
546 | * This is the real return address. Any other | ||
547 | * instances associated with this task are for | ||
548 | * other calls deeper on the call stack | ||
549 | */ | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | kretprobe_assert(ri, orig_ret_address, trampoline_address); | ||
554 | regs->tpc = orig_ret_address; | ||
555 | regs->tnpc = orig_ret_address + 4; | ||
556 | |||
557 | reset_current_kprobe(); | ||
558 | spin_unlock_irqrestore(&kretprobe_lock, flags); | ||
559 | preempt_enable_no_resched(); | ||
560 | |||
561 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | ||
562 | hlist_del(&ri->hlist); | ||
563 | kfree(ri); | ||
564 | } | ||
565 | /* | ||
566 | * By returning a non-zero value, we are telling | ||
567 | * kprobe_handler() that we don't want the post_handler | ||
568 | * to run (and have re-enabled preemption) | ||
569 | */ | ||
570 | return 1; | ||
571 | } | ||
572 | |||
573 | void kretprobe_trampoline_holder(void) | ||
574 | { | ||
575 | asm volatile(".global kretprobe_trampoline\n" | ||
576 | "kretprobe_trampoline:\n" | ||
577 | "\tnop\n" | ||
578 | "\tnop\n"); | ||
579 | } | ||
580 | static struct kprobe trampoline_p = { | ||
581 | .addr = (kprobe_opcode_t *) &kretprobe_trampoline, | ||
582 | .pre_handler = trampoline_probe_handler | ||
583 | }; | ||
584 | |||
585 | int __init arch_init_kprobes(void) | ||
485 | { | 586 | { |
587 | return register_kprobe(&trampoline_p); | ||
588 | } | ||
589 | |||
590 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
591 | { | ||
592 | if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) | ||
593 | return 1; | ||
594 | |||
486 | return 0; | 595 | return 0; |
487 | } | 596 | } |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index fc5c0cc793b8..0fd9db95b896 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -868,29 +868,3 @@ static int __init of_debug(char *str) | |||
868 | } | 868 | } |
869 | 869 | ||
870 | __setup("of_debug=", of_debug); | 870 | __setup("of_debug=", of_debug); |
871 | |||
872 | struct of_device* of_platform_device_create(struct device_node *np, | ||
873 | const char *bus_id, | ||
874 | struct device *parent, | ||
875 | struct bus_type *bus) | ||
876 | { | ||
877 | struct of_device *dev; | ||
878 | |||
879 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
880 | if (!dev) | ||
881 | return NULL; | ||
882 | |||
883 | dev->dev.parent = parent; | ||
884 | dev->dev.bus = bus; | ||
885 | dev->dev.release = of_release_dev; | ||
886 | |||
887 | strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); | ||
888 | |||
889 | if (of_device_register(dev) != 0) { | ||
890 | kfree(dev); | ||
891 | return NULL; | ||
892 | } | ||
893 | |||
894 | return dev; | ||
895 | } | ||
896 | EXPORT_SYMBOL(of_platform_device_create); | ||
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 61baf8dc095e..ddca6c6c0b49 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* pci_sun4v.c: SUN4V specific PCI controller support. | 1 | /* pci_sun4v.c: SUN4V specific PCI controller support. |
2 | * | 2 | * |
3 | * Copyright (C) 2006, 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 2006, 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
@@ -89,6 +89,17 @@ static long iommu_batch_flush(struct iommu_batch *p) | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void iommu_batch_new_entry(unsigned long entry) | ||
93 | { | ||
94 | struct iommu_batch *p = &__get_cpu_var(iommu_batch); | ||
95 | |||
96 | if (p->entry + p->npages == entry) | ||
97 | return; | ||
98 | if (p->entry != ~0UL) | ||
99 | iommu_batch_flush(p); | ||
100 | p->entry = entry; | ||
101 | } | ||
102 | |||
92 | /* Interrupts must be disabled. */ | 103 | /* Interrupts must be disabled. */ |
93 | static inline long iommu_batch_add(u64 phys_page) | 104 | static inline long iommu_batch_add(u64 phys_page) |
94 | { | 105 | { |
@@ -113,54 +124,6 @@ static inline long iommu_batch_end(void) | |||
113 | return iommu_batch_flush(p); | 124 | return iommu_batch_flush(p); |
114 | } | 125 | } |
115 | 126 | ||
116 | static long arena_alloc(struct iommu_arena *arena, unsigned long npages) | ||
117 | { | ||
118 | unsigned long n, i, start, end, limit; | ||
119 | int pass; | ||
120 | |||
121 | limit = arena->limit; | ||
122 | start = arena->hint; | ||
123 | pass = 0; | ||
124 | |||
125 | again: | ||
126 | n = find_next_zero_bit(arena->map, limit, start); | ||
127 | end = n + npages; | ||
128 | if (unlikely(end >= limit)) { | ||
129 | if (likely(pass < 1)) { | ||
130 | limit = start; | ||
131 | start = 0; | ||
132 | pass++; | ||
133 | goto again; | ||
134 | } else { | ||
135 | /* Scanned the whole thing, give up. */ | ||
136 | return -1; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | for (i = n; i < end; i++) { | ||
141 | if (test_bit(i, arena->map)) { | ||
142 | start = i + 1; | ||
143 | goto again; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | for (i = n; i < end; i++) | ||
148 | __set_bit(i, arena->map); | ||
149 | |||
150 | arena->hint = end; | ||
151 | |||
152 | return n; | ||
153 | } | ||
154 | |||
155 | static void arena_free(struct iommu_arena *arena, unsigned long base, | ||
156 | unsigned long npages) | ||
157 | { | ||
158 | unsigned long i; | ||
159 | |||
160 | for (i = base; i < (base + npages); i++) | ||
161 | __clear_bit(i, arena->map); | ||
162 | } | ||
163 | |||
164 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | 127 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, |
165 | dma_addr_t *dma_addrp, gfp_t gfp) | 128 | dma_addr_t *dma_addrp, gfp_t gfp) |
166 | { | 129 | { |
@@ -185,11 +148,11 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | |||
185 | iommu = dev->archdata.iommu; | 148 | iommu = dev->archdata.iommu; |
186 | 149 | ||
187 | spin_lock_irqsave(&iommu->lock, flags); | 150 | spin_lock_irqsave(&iommu->lock, flags); |
188 | entry = arena_alloc(&iommu->arena, npages); | 151 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
189 | spin_unlock_irqrestore(&iommu->lock, flags); | 152 | spin_unlock_irqrestore(&iommu->lock, flags); |
190 | 153 | ||
191 | if (unlikely(entry < 0L)) | 154 | if (unlikely(entry == DMA_ERROR_CODE)) |
192 | goto arena_alloc_fail; | 155 | goto range_alloc_fail; |
193 | 156 | ||
194 | *dma_addrp = (iommu->page_table_map_base + | 157 | *dma_addrp = (iommu->page_table_map_base + |
195 | (entry << IO_PAGE_SHIFT)); | 158 | (entry << IO_PAGE_SHIFT)); |
@@ -219,10 +182,10 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | |||
219 | iommu_map_fail: | 182 | iommu_map_fail: |
220 | /* Interrupts are disabled. */ | 183 | /* Interrupts are disabled. */ |
221 | spin_lock(&iommu->lock); | 184 | spin_lock(&iommu->lock); |
222 | arena_free(&iommu->arena, entry, npages); | 185 | iommu_range_free(iommu, *dma_addrp, npages); |
223 | spin_unlock_irqrestore(&iommu->lock, flags); | 186 | spin_unlock_irqrestore(&iommu->lock, flags); |
224 | 187 | ||
225 | arena_alloc_fail: | 188 | range_alloc_fail: |
226 | free_pages(first_page, order); | 189 | free_pages(first_page, order); |
227 | return NULL; | 190 | return NULL; |
228 | } | 191 | } |
@@ -243,7 +206,7 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, | |||
243 | 206 | ||
244 | spin_lock_irqsave(&iommu->lock, flags); | 207 | spin_lock_irqsave(&iommu->lock, flags); |
245 | 208 | ||
246 | arena_free(&iommu->arena, entry, npages); | 209 | iommu_range_free(iommu, dvma, npages); |
247 | 210 | ||
248 | do { | 211 | do { |
249 | unsigned long num; | 212 | unsigned long num; |
@@ -281,10 +244,10 @@ static dma_addr_t dma_4v_map_single(struct device *dev, void *ptr, size_t sz, | |||
281 | npages >>= IO_PAGE_SHIFT; | 244 | npages >>= IO_PAGE_SHIFT; |
282 | 245 | ||
283 | spin_lock_irqsave(&iommu->lock, flags); | 246 | spin_lock_irqsave(&iommu->lock, flags); |
284 | entry = arena_alloc(&iommu->arena, npages); | 247 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
285 | spin_unlock_irqrestore(&iommu->lock, flags); | 248 | spin_unlock_irqrestore(&iommu->lock, flags); |
286 | 249 | ||
287 | if (unlikely(entry < 0L)) | 250 | if (unlikely(entry == DMA_ERROR_CODE)) |
288 | goto bad; | 251 | goto bad; |
289 | 252 | ||
290 | bus_addr = (iommu->page_table_map_base + | 253 | bus_addr = (iommu->page_table_map_base + |
@@ -319,7 +282,7 @@ bad: | |||
319 | iommu_map_fail: | 282 | iommu_map_fail: |
320 | /* Interrupts are disabled. */ | 283 | /* Interrupts are disabled. */ |
321 | spin_lock(&iommu->lock); | 284 | spin_lock(&iommu->lock); |
322 | arena_free(&iommu->arena, entry, npages); | 285 | iommu_range_free(iommu, bus_addr, npages); |
323 | spin_unlock_irqrestore(&iommu->lock, flags); | 286 | spin_unlock_irqrestore(&iommu->lock, flags); |
324 | 287 | ||
325 | return DMA_ERROR_CODE; | 288 | return DMA_ERROR_CODE; |
@@ -350,9 +313,9 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
350 | 313 | ||
351 | spin_lock_irqsave(&iommu->lock, flags); | 314 | spin_lock_irqsave(&iommu->lock, flags); |
352 | 315 | ||
353 | entry = (bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; | 316 | iommu_range_free(iommu, bus_addr, npages); |
354 | arena_free(&iommu->arena, entry, npages); | ||
355 | 317 | ||
318 | entry = (bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; | ||
356 | do { | 319 | do { |
357 | unsigned long num; | 320 | unsigned long num; |
358 | 321 | ||
@@ -368,88 +331,131 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
368 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, | 331 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, |
369 | int nelems, enum dma_data_direction direction) | 332 | int nelems, enum dma_data_direction direction) |
370 | { | 333 | { |
371 | unsigned long flags, npages, i, prot; | 334 | struct scatterlist *s, *outs, *segstart; |
372 | struct scatterlist *sg; | 335 | unsigned long flags, handle, prot; |
336 | dma_addr_t dma_next = 0, dma_addr; | ||
337 | unsigned int max_seg_size; | ||
338 | int outcount, incount, i; | ||
373 | struct iommu *iommu; | 339 | struct iommu *iommu; |
374 | long entry, err; | 340 | long err; |
375 | u32 dma_base; | 341 | |
376 | 342 | BUG_ON(direction == DMA_NONE); | |
377 | /* Fast path single entry scatterlists. */ | ||
378 | if (nelems == 1) { | ||
379 | sglist->dma_address = | ||
380 | dma_4v_map_single(dev, sg_virt(sglist), | ||
381 | sglist->length, direction); | ||
382 | if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) | ||
383 | return 0; | ||
384 | sglist->dma_length = sglist->length; | ||
385 | return 1; | ||
386 | } | ||
387 | 343 | ||
388 | iommu = dev->archdata.iommu; | 344 | iommu = dev->archdata.iommu; |
345 | if (nelems == 0 || !iommu) | ||
346 | return 0; | ||
389 | 347 | ||
390 | if (unlikely(direction == DMA_NONE)) | 348 | prot = HV_PCI_MAP_ATTR_READ; |
391 | goto bad; | 349 | if (direction != DMA_TO_DEVICE) |
392 | 350 | prot |= HV_PCI_MAP_ATTR_WRITE; | |
393 | npages = calc_npages(sglist, nelems); | ||
394 | 351 | ||
395 | spin_lock_irqsave(&iommu->lock, flags); | 352 | outs = s = segstart = &sglist[0]; |
396 | entry = arena_alloc(&iommu->arena, npages); | 353 | outcount = 1; |
397 | spin_unlock_irqrestore(&iommu->lock, flags); | 354 | incount = nelems; |
355 | handle = 0; | ||
398 | 356 | ||
399 | if (unlikely(entry < 0L)) | 357 | /* Init first segment length for backout at failure */ |
400 | goto bad; | 358 | outs->dma_length = 0; |
401 | 359 | ||
402 | dma_base = iommu->page_table_map_base + | 360 | spin_lock_irqsave(&iommu->lock, flags); |
403 | (entry << IO_PAGE_SHIFT); | ||
404 | 361 | ||
405 | prot = HV_PCI_MAP_ATTR_READ; | 362 | iommu_batch_start(dev, prot, ~0UL); |
406 | if (direction != DMA_TO_DEVICE) | ||
407 | prot |= HV_PCI_MAP_ATTR_WRITE; | ||
408 | 363 | ||
409 | local_irq_save(flags); | 364 | max_seg_size = dma_get_max_seg_size(dev); |
365 | for_each_sg(sglist, s, nelems, i) { | ||
366 | unsigned long paddr, npages, entry, slen; | ||
410 | 367 | ||
411 | iommu_batch_start(dev, prot, entry); | 368 | slen = s->length; |
369 | /* Sanity check */ | ||
370 | if (slen == 0) { | ||
371 | dma_next = 0; | ||
372 | continue; | ||
373 | } | ||
374 | /* Allocate iommu entries for that segment */ | ||
375 | paddr = (unsigned long) SG_ENT_PHYS_ADDRESS(s); | ||
376 | npages = iommu_num_pages(paddr, slen); | ||
377 | entry = iommu_range_alloc(dev, iommu, npages, &handle); | ||
412 | 378 | ||
413 | for_each_sg(sglist, sg, nelems, i) { | 379 | /* Handle failure */ |
414 | unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg); | 380 | if (unlikely(entry == DMA_ERROR_CODE)) { |
415 | unsigned long slen = sg->length; | 381 | if (printk_ratelimit()) |
416 | unsigned long this_npages; | 382 | printk(KERN_INFO "iommu_alloc failed, iommu %p paddr %lx" |
383 | " npages %lx\n", iommu, paddr, npages); | ||
384 | goto iommu_map_failed; | ||
385 | } | ||
417 | 386 | ||
418 | this_npages = iommu_num_pages(paddr, slen); | 387 | iommu_batch_new_entry(entry); |
419 | 388 | ||
420 | sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK); | 389 | /* Convert entry to a dma_addr_t */ |
421 | sg->dma_length = slen; | 390 | dma_addr = iommu->page_table_map_base + |
391 | (entry << IO_PAGE_SHIFT); | ||
392 | dma_addr |= (s->offset & ~IO_PAGE_MASK); | ||
422 | 393 | ||
394 | /* Insert into HW table */ | ||
423 | paddr &= IO_PAGE_MASK; | 395 | paddr &= IO_PAGE_MASK; |
424 | while (this_npages--) { | 396 | while (npages--) { |
425 | err = iommu_batch_add(paddr); | 397 | err = iommu_batch_add(paddr); |
426 | if (unlikely(err < 0L)) { | 398 | if (unlikely(err < 0L)) |
427 | local_irq_restore(flags); | ||
428 | goto iommu_map_failed; | 399 | goto iommu_map_failed; |
400 | paddr += IO_PAGE_SIZE; | ||
401 | } | ||
402 | |||
403 | /* If we are in an open segment, try merging */ | ||
404 | if (segstart != s) { | ||
405 | /* We cannot merge if: | ||
406 | * - allocated dma_addr isn't contiguous to previous allocation | ||
407 | */ | ||
408 | if ((dma_addr != dma_next) || | ||
409 | (outs->dma_length + s->length > max_seg_size)) { | ||
410 | /* Can't merge: create a new segment */ | ||
411 | segstart = s; | ||
412 | outcount++; | ||
413 | outs = sg_next(outs); | ||
414 | } else { | ||
415 | outs->dma_length += s->length; | ||
429 | } | 416 | } |
417 | } | ||
430 | 418 | ||
431 | paddr += IO_PAGE_SIZE; | 419 | if (segstart == s) { |
432 | dma_base += IO_PAGE_SIZE; | 420 | /* This is a new segment, fill entries */ |
421 | outs->dma_address = dma_addr; | ||
422 | outs->dma_length = slen; | ||
433 | } | 423 | } |
424 | |||
425 | /* Calculate next page pointer for contiguous check */ | ||
426 | dma_next = dma_addr + slen; | ||
434 | } | 427 | } |
435 | 428 | ||
436 | err = iommu_batch_end(); | 429 | err = iommu_batch_end(); |
437 | 430 | ||
438 | local_irq_restore(flags); | ||
439 | |||
440 | if (unlikely(err < 0L)) | 431 | if (unlikely(err < 0L)) |
441 | goto iommu_map_failed; | 432 | goto iommu_map_failed; |
442 | 433 | ||
443 | return nelems; | 434 | spin_unlock_irqrestore(&iommu->lock, flags); |
444 | 435 | ||
445 | bad: | 436 | if (outcount < incount) { |
446 | if (printk_ratelimit()) | 437 | outs = sg_next(outs); |
447 | WARN_ON(1); | 438 | outs->dma_address = DMA_ERROR_CODE; |
448 | return 0; | 439 | outs->dma_length = 0; |
440 | } | ||
441 | |||
442 | return outcount; | ||
449 | 443 | ||
450 | iommu_map_failed: | 444 | iommu_map_failed: |
451 | spin_lock_irqsave(&iommu->lock, flags); | 445 | for_each_sg(sglist, s, nelems, i) { |
452 | arena_free(&iommu->arena, entry, npages); | 446 | if (s->dma_length != 0) { |
447 | unsigned long vaddr, npages; | ||
448 | |||
449 | vaddr = s->dma_address & IO_PAGE_MASK; | ||
450 | npages = iommu_num_pages(s->dma_address, s->dma_length); | ||
451 | iommu_range_free(iommu, vaddr, npages); | ||
452 | /* XXX demap? XXX */ | ||
453 | s->dma_address = DMA_ERROR_CODE; | ||
454 | s->dma_length = 0; | ||
455 | } | ||
456 | if (s == outs) | ||
457 | break; | ||
458 | } | ||
453 | spin_unlock_irqrestore(&iommu->lock, flags); | 459 | spin_unlock_irqrestore(&iommu->lock, flags); |
454 | 460 | ||
455 | return 0; | 461 | return 0; |
@@ -458,39 +464,43 @@ iommu_map_failed: | |||
458 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, | 464 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, |
459 | int nelems, enum dma_data_direction direction) | 465 | int nelems, enum dma_data_direction direction) |
460 | { | 466 | { |
461 | unsigned long flags, npages; | ||
462 | struct pci_pbm_info *pbm; | 467 | struct pci_pbm_info *pbm; |
463 | u32 devhandle, bus_addr; | 468 | struct scatterlist *sg; |
464 | struct iommu *iommu; | 469 | struct iommu *iommu; |
465 | long entry; | 470 | unsigned long flags; |
471 | u32 devhandle; | ||
466 | 472 | ||
467 | if (unlikely(direction == DMA_NONE)) { | 473 | BUG_ON(direction == DMA_NONE); |
468 | if (printk_ratelimit()) | ||
469 | WARN_ON(1); | ||
470 | } | ||
471 | 474 | ||
472 | iommu = dev->archdata.iommu; | 475 | iommu = dev->archdata.iommu; |
473 | pbm = dev->archdata.host_controller; | 476 | pbm = dev->archdata.host_controller; |
474 | devhandle = pbm->devhandle; | 477 | devhandle = pbm->devhandle; |
475 | 478 | ||
476 | bus_addr = sglist->dma_address & IO_PAGE_MASK; | ||
477 | |||
478 | npages = calc_npages(sglist, nelems); | ||
479 | |||
480 | entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
481 | |||
482 | spin_lock_irqsave(&iommu->lock, flags); | 479 | spin_lock_irqsave(&iommu->lock, flags); |
483 | 480 | ||
484 | arena_free(&iommu->arena, entry, npages); | 481 | sg = sglist; |
485 | 482 | while (nelems--) { | |
486 | do { | 483 | dma_addr_t dma_handle = sg->dma_address; |
487 | unsigned long num; | 484 | unsigned int len = sg->dma_length; |
485 | unsigned long npages, entry; | ||
486 | |||
487 | if (!len) | ||
488 | break; | ||
489 | npages = iommu_num_pages(dma_handle, len); | ||
490 | iommu_range_free(iommu, dma_handle, npages); | ||
491 | |||
492 | entry = ((dma_handle - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
493 | while (npages) { | ||
494 | unsigned long num; | ||
495 | |||
496 | num = pci_sun4v_iommu_demap(devhandle, HV_PCI_TSBID(0, entry), | ||
497 | npages); | ||
498 | entry += num; | ||
499 | npages -= num; | ||
500 | } | ||
488 | 501 | ||
489 | num = pci_sun4v_iommu_demap(devhandle, HV_PCI_TSBID(0, entry), | 502 | sg = sg_next(sg); |
490 | npages); | 503 | } |
491 | entry += num; | ||
492 | npages -= num; | ||
493 | } while (npages != 0); | ||
494 | 504 | ||
495 | spin_unlock_irqrestore(&iommu->lock, flags); | 505 | spin_unlock_irqrestore(&iommu->lock, flags); |
496 | } | 506 | } |
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig index 7b6d3716efca..4379f43505ef 100644 --- a/arch/v850/Kconfig +++ b/arch/v850/Kconfig | |||
@@ -78,6 +78,7 @@ config MCA | |||
78 | config V850 | 78 | config V850 |
79 | bool | 79 | bool |
80 | default y | 80 | default y |
81 | select HAVE_IDE | ||
81 | 82 | ||
82 | menu "Processor type and features" | 83 | menu "Processor type and features" |
83 | 84 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 65a70b777c12..aaed1a3b92d6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -18,6 +18,7 @@ config X86_64 | |||
18 | ### Arch settings | 18 | ### Arch settings |
19 | config X86 | 19 | config X86 |
20 | def_bool y | 20 | def_bool y |
21 | select HAVE_IDE | ||
21 | select HAVE_OPROFILE | 22 | select HAVE_OPROFILE |
22 | select HAVE_KPROBES | 23 | select HAVE_KPROBES |
23 | 24 | ||
@@ -102,6 +103,9 @@ config ARCH_HAS_ILOG2_U32 | |||
102 | config ARCH_HAS_ILOG2_U64 | 103 | config ARCH_HAS_ILOG2_U64 |
103 | def_bool n | 104 | def_bool n |
104 | 105 | ||
106 | config ARCH_HAS_CPU_IDLE_WAIT | ||
107 | def_bool y | ||
108 | |||
105 | config GENERIC_CALIBRATE_DELAY | 109 | config GENERIC_CALIBRATE_DELAY |
106 | def_bool y | 110 | def_bool y |
107 | 111 | ||
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index fa555148823d..864affc9a7b0 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -34,13 +34,9 @@ config DEBUG_STACK_USAGE | |||
34 | 34 | ||
35 | This option will slow down process creation somewhat. | 35 | This option will slow down process creation somewhat. |
36 | 36 | ||
37 | comment "Page alloc debug is incompatible with Software Suspend on i386" | ||
38 | depends on DEBUG_KERNEL && HIBERNATION | ||
39 | depends on X86_32 | ||
40 | |||
41 | config DEBUG_PAGEALLOC | 37 | config DEBUG_PAGEALLOC |
42 | bool "Debug page memory allocations" | 38 | bool "Debug page memory allocations" |
43 | depends on DEBUG_KERNEL && X86_32 | 39 | depends on DEBUG_KERNEL |
44 | help | 40 | help |
45 | Unmap pages from the kernel linear mapping after free_pages(). | 41 | Unmap pages from the kernel linear mapping after free_pages(). |
46 | This results in a large slowdown, but helps to find certain types | 42 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 364865b1b08d..204af43535c5 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -191,8 +191,10 @@ drivers-$(CONFIG_PCI) += arch/x86/pci/ | |||
191 | # must be linked after kernel/ | 191 | # must be linked after kernel/ |
192 | drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ | 192 | drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ |
193 | 193 | ||
194 | ifeq ($(CONFIG_X86_32),y) | 194 | # suspend and hibernation support |
195 | drivers-$(CONFIG_PM) += arch/x86/power/ | 195 | drivers-$(CONFIG_PM) += arch/x86/power/ |
196 | |||
197 | ifeq ($(CONFIG_X86_32),y) | ||
196 | drivers-$(CONFIG_FB) += arch/x86/video/ | 198 | drivers-$(CONFIG_FB) += arch/x86/video/ |
197 | endif | 199 | endif |
198 | 200 | ||
diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore index 18465143cfa2..b1bdc4c6f9f2 100644 --- a/arch/x86/boot/.gitignore +++ b/arch/x86/boot/.gitignore | |||
@@ -3,3 +3,5 @@ bzImage | |||
3 | setup | 3 | setup |
4 | setup.bin | 4 | setup.bin |
5 | setup.elf | 5 | setup.elf |
6 | cpustr.h | ||
7 | mkcpustr | ||
diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c index 1a09f9309d3c..7e7e890699be 100644 --- a/arch/x86/boot/printf.c +++ b/arch/x86/boot/printf.c | |||
@@ -33,8 +33,8 @@ static int skip_atoi(const char **s) | |||
33 | #define PLUS 4 /* show plus */ | 33 | #define PLUS 4 /* show plus */ |
34 | #define SPACE 8 /* space if plus */ | 34 | #define SPACE 8 /* space if plus */ |
35 | #define LEFT 16 /* left justified */ | 35 | #define LEFT 16 /* left justified */ |
36 | #define SPECIAL 32 /* 0x */ | 36 | #define SMALL 32 /* Must be 32 == 0x20 */ |
37 | #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ | 37 | #define SPECIAL 64 /* 0x */ |
38 | 38 | ||
39 | #define do_div(n,base) ({ \ | 39 | #define do_div(n,base) ({ \ |
40 | int __res; \ | 40 | int __res; \ |
@@ -45,12 +45,16 @@ __res; }) | |||
45 | static char *number(char *str, long num, int base, int size, int precision, | 45 | static char *number(char *str, long num, int base, int size, int precision, |
46 | int type) | 46 | int type) |
47 | { | 47 | { |
48 | char c, sign, tmp[66]; | 48 | /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ |
49 | const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; | 49 | static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ |
50 | |||
51 | char tmp[66]; | ||
52 | char c, sign, locase; | ||
50 | int i; | 53 | int i; |
51 | 54 | ||
52 | if (type & LARGE) | 55 | /* locase = 0 or 0x20. ORing digits or letters with 'locase' |
53 | digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 56 | * produces same digits or (maybe lowercased) letters */ |
57 | locase = (type & SMALL); | ||
54 | if (type & LEFT) | 58 | if (type & LEFT) |
55 | type &= ~ZEROPAD; | 59 | type &= ~ZEROPAD; |
56 | if (base < 2 || base > 36) | 60 | if (base < 2 || base > 36) |
@@ -81,7 +85,7 @@ static char *number(char *str, long num, int base, int size, int precision, | |||
81 | tmp[i++] = '0'; | 85 | tmp[i++] = '0'; |
82 | else | 86 | else |
83 | while (num != 0) | 87 | while (num != 0) |
84 | tmp[i++] = digits[do_div(num, base)]; | 88 | tmp[i++] = (digits[do_div(num, base)] | locase); |
85 | if (i > precision) | 89 | if (i > precision) |
86 | precision = i; | 90 | precision = i; |
87 | size -= precision; | 91 | size -= precision; |
@@ -95,7 +99,7 @@ static char *number(char *str, long num, int base, int size, int precision, | |||
95 | *str++ = '0'; | 99 | *str++ = '0'; |
96 | else if (base == 16) { | 100 | else if (base == 16) { |
97 | *str++ = '0'; | 101 | *str++ = '0'; |
98 | *str++ = digits[33]; | 102 | *str++ = ('X' | locase); |
99 | } | 103 | } |
100 | } | 104 | } |
101 | if (!(type & LEFT)) | 105 | if (!(type & LEFT)) |
@@ -244,9 +248,9 @@ int vsprintf(char *buf, const char *fmt, va_list args) | |||
244 | base = 8; | 248 | base = 8; |
245 | break; | 249 | break; |
246 | 250 | ||
247 | case 'X': | ||
248 | flags |= LARGE; | ||
249 | case 'x': | 251 | case 'x': |
252 | flags |= SMALL; | ||
253 | case 'X': | ||
250 | base = 16; | 254 | base = 16; |
251 | break; | 255 | break; |
252 | 256 | ||
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index 77562e7cdab6..3df340b54e57 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
@@ -1421,7 +1421,6 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1421 | # CONFIG_DEBUG_VM is not set | 1421 | # CONFIG_DEBUG_VM is not set |
1422 | # CONFIG_DEBUG_LIST is not set | 1422 | # CONFIG_DEBUG_LIST is not set |
1423 | # CONFIG_FRAME_POINTER is not set | 1423 | # CONFIG_FRAME_POINTER is not set |
1424 | # CONFIG_FORCED_INLINING is not set | ||
1425 | # CONFIG_RCU_TORTURE_TEST is not set | 1424 | # CONFIG_RCU_TORTURE_TEST is not set |
1426 | # CONFIG_LKDTM is not set | 1425 | # CONFIG_LKDTM is not set |
1427 | # CONFIG_FAULT_INJECTION is not set | 1426 | # CONFIG_FAULT_INJECTION is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index 9e2b0ef851de..eef98cb00c62 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
@@ -1346,7 +1346,6 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1346 | # CONFIG_DEBUG_VM is not set | 1346 | # CONFIG_DEBUG_VM is not set |
1347 | # CONFIG_DEBUG_LIST is not set | 1347 | # CONFIG_DEBUG_LIST is not set |
1348 | # CONFIG_FRAME_POINTER is not set | 1348 | # CONFIG_FRAME_POINTER is not set |
1349 | # CONFIG_FORCED_INLINING is not set | ||
1350 | # CONFIG_RCU_TORTURE_TEST is not set | 1349 | # CONFIG_RCU_TORTURE_TEST is not set |
1351 | # CONFIG_LKDTM is not set | 1350 | # CONFIG_LKDTM is not set |
1352 | # CONFIG_FAULT_INJECTION is not set | 1351 | # CONFIG_FAULT_INJECTION is not set |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 21dc1a061bf1..76ec0f8f138a 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -84,8 +84,6 @@ ifeq ($(CONFIG_X86_64),y) | |||
84 | obj-y += genapic_64.o genapic_flat_64.o | 84 | obj-y += genapic_64.o genapic_flat_64.o |
85 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 85 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
86 | obj-$(CONFIG_AUDIT) += audit_64.o | 86 | obj-$(CONFIG_AUDIT) += audit_64.o |
87 | obj-$(CONFIG_PM) += suspend_64.o | ||
88 | obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o | ||
89 | 87 | ||
90 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o | 88 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o |
91 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o | 89 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o |
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 24885be5c48c..9b7e01daa1ca 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -118,7 +118,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev) | |||
118 | 118 | ||
119 | static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) | 119 | static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) |
120 | { | 120 | { |
121 | return sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); | 121 | sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); |
122 | } | 122 | } |
123 | 123 | ||
124 | /* Mutex protecting device creation against CPU hotplug */ | 124 | /* Mutex protecting device creation against CPU hotplug */ |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index be5c31d04884..824e21b80aad 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -409,7 +409,8 @@ restore_nocheck_notrace: | |||
409 | RESTORE_REGS | 409 | RESTORE_REGS |
410 | addl $4, %esp # skip orig_eax/error_code | 410 | addl $4, %esp # skip orig_eax/error_code |
411 | CFI_ADJUST_CFA_OFFSET -4 | 411 | CFI_ADJUST_CFA_OFFSET -4 |
412 | 1: INTERRUPT_RETURN | 412 | ENTRY(irq_return) |
413 | INTERRUPT_RETURN | ||
413 | .section .fixup,"ax" | 414 | .section .fixup,"ax" |
414 | iret_exc: | 415 | iret_exc: |
415 | pushl $0 # no error code | 416 | pushl $0 # no error code |
@@ -418,7 +419,7 @@ iret_exc: | |||
418 | .previous | 419 | .previous |
419 | .section __ex_table,"a" | 420 | .section __ex_table,"a" |
420 | .align 4 | 421 | .align 4 |
421 | .long 1b,iret_exc | 422 | .long irq_return,iret_exc |
422 | .previous | 423 | .previous |
423 | 424 | ||
424 | CFI_RESTORE_STATE | 425 | CFI_RESTORE_STATE |
@@ -865,20 +866,16 @@ nmi_espfix_stack: | |||
865 | RESTORE_REGS | 866 | RESTORE_REGS |
866 | lss 12+4(%esp), %esp # back to espfix stack | 867 | lss 12+4(%esp), %esp # back to espfix stack |
867 | CFI_ADJUST_CFA_OFFSET -24 | 868 | CFI_ADJUST_CFA_OFFSET -24 |
868 | 1: INTERRUPT_RETURN | 869 | jmp irq_return |
869 | CFI_ENDPROC | 870 | CFI_ENDPROC |
870 | .section __ex_table,"a" | ||
871 | .align 4 | ||
872 | .long 1b,iret_exc | ||
873 | .previous | ||
874 | KPROBE_END(nmi) | 871 | KPROBE_END(nmi) |
875 | 872 | ||
876 | #ifdef CONFIG_PARAVIRT | 873 | #ifdef CONFIG_PARAVIRT |
877 | ENTRY(native_iret) | 874 | ENTRY(native_iret) |
878 | 1: iret | 875 | iret |
879 | .section __ex_table,"a" | 876 | .section __ex_table,"a" |
880 | .align 4 | 877 | .align 4 |
881 | .long 1b,iret_exc | 878 | .long native_iret, iret_exc |
882 | .previous | 879 | .previous |
883 | END(native_iret) | 880 | END(native_iret) |
884 | 881 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index c7341e81941c..6be39a387c5a 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -581,16 +581,24 @@ retint_restore_args: /* return to kernel space */ | |||
581 | */ | 581 | */ |
582 | TRACE_IRQS_IRETQ | 582 | TRACE_IRQS_IRETQ |
583 | restore_args: | 583 | restore_args: |
584 | RESTORE_ARGS 0,8,0 | 584 | RESTORE_ARGS 0,8,0 |
585 | #ifdef CONFIG_PARAVIRT | 585 | |
586 | ENTRY(irq_return) | ||
586 | INTERRUPT_RETURN | 587 | INTERRUPT_RETURN |
587 | #endif | 588 | |
589 | .section __ex_table, "a" | ||
590 | .quad irq_return, bad_iret | ||
591 | .previous | ||
592 | |||
593 | #ifdef CONFIG_PARAVIRT | ||
588 | ENTRY(native_iret) | 594 | ENTRY(native_iret) |
589 | iretq | 595 | iretq |
590 | 596 | ||
591 | .section __ex_table,"a" | 597 | .section __ex_table,"a" |
592 | .quad native_iret, bad_iret | 598 | .quad native_iret, bad_iret |
593 | .previous | 599 | .previous |
600 | #endif | ||
601 | |||
594 | .section .fixup,"ax" | 602 | .section .fixup,"ax" |
595 | bad_iret: | 603 | bad_iret: |
596 | /* | 604 | /* |
@@ -804,7 +812,7 @@ paranoid_swapgs\trace: | |||
804 | SWAPGS_UNSAFE_STACK | 812 | SWAPGS_UNSAFE_STACK |
805 | paranoid_restore\trace: | 813 | paranoid_restore\trace: |
806 | RESTORE_ALL 8 | 814 | RESTORE_ALL 8 |
807 | INTERRUPT_RETURN | 815 | jmp irq_return |
808 | paranoid_userspace\trace: | 816 | paranoid_userspace\trace: |
809 | GET_THREAD_INFO(%rcx) | 817 | GET_THREAD_INFO(%rcx) |
810 | movl threadinfo_flags(%rcx),%ebx | 818 | movl threadinfo_flags(%rcx),%ebx |
@@ -919,7 +927,7 @@ error_kernelspace: | |||
919 | iret run with kernel gs again, so don't set the user space flag. | 927 | iret run with kernel gs again, so don't set the user space flag. |
920 | B stepping K8s sometimes report an truncated RIP for IRET | 928 | B stepping K8s sometimes report an truncated RIP for IRET |
921 | exceptions returning to compat mode. Check for these here too. */ | 929 | exceptions returning to compat mode. Check for these here too. */ |
922 | leaq native_iret(%rip),%rbp | 930 | leaq irq_return(%rip),%rbp |
923 | cmpq %rbp,RIP(%rsp) | 931 | cmpq %rbp,RIP(%rsp) |
924 | je error_swapgs | 932 | je error_swapgs |
925 | movl %ebp,%ebp /* zero extend */ | 933 | movl %ebp,%ebp /* zero extend */ |
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c index 9c7f7d395968..9dad6ca6cd70 100644 --- a/arch/x86/kernel/geode_32.c +++ b/arch/x86/kernel/geode_32.c | |||
@@ -163,14 +163,11 @@ EXPORT_SYMBOL_GPL(geode_gpio_setup_event); | |||
163 | 163 | ||
164 | static int __init geode_southbridge_init(void) | 164 | static int __init geode_southbridge_init(void) |
165 | { | 165 | { |
166 | int timers; | ||
167 | |||
168 | if (!is_geode()) | 166 | if (!is_geode()) |
169 | return -ENODEV; | 167 | return -ENODEV; |
170 | 168 | ||
171 | init_lbars(); | 169 | init_lbars(); |
172 | timers = geode_mfgpt_detect(); | 170 | (void) mfgpt_timer_setup(); |
173 | printk(KERN_INFO "geode: %d MFGPT timers available.\n", timers); | ||
174 | return 0; | 171 | return 0; |
175 | } | 172 | } |
176 | 173 | ||
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 5d8c5730686b..74ef4a41f224 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -19,6 +19,10 @@ | |||
19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
20 | #include <asm/asm-offsets.h> | 20 | #include <asm/asm-offsets.h> |
21 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
22 | #include <asm/processor-flags.h> | ||
23 | |||
24 | /* Physical address */ | ||
25 | #define pa(X) ((X) - __PAGE_OFFSET) | ||
22 | 26 | ||
23 | /* | 27 | /* |
24 | * References to members of the new_cpu_data structure. | 28 | * References to members of the new_cpu_data structure. |
@@ -80,10 +84,6 @@ INIT_MAP_BEYOND_END = BOOTBITMAP_SIZE + (PAGE_TABLE_SIZE + ALLOCATOR_SLOP)*PAGE_ | |||
80 | */ | 84 | */ |
81 | .section .text.head,"ax",@progbits | 85 | .section .text.head,"ax",@progbits |
82 | ENTRY(startup_32) | 86 | ENTRY(startup_32) |
83 | /* check to see if KEEP_SEGMENTS flag is meaningful */ | ||
84 | cmpw $0x207, BP_version(%esi) | ||
85 | jb 1f | ||
86 | |||
87 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking | 87 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking |
88 | us to not reload segments */ | 88 | us to not reload segments */ |
89 | testb $(1<<6), BP_loadflags(%esi) | 89 | testb $(1<<6), BP_loadflags(%esi) |
@@ -92,7 +92,7 @@ ENTRY(startup_32) | |||
92 | /* | 92 | /* |
93 | * Set segments to known values. | 93 | * Set segments to known values. |
94 | */ | 94 | */ |
95 | 1: lgdt boot_gdt_descr - __PAGE_OFFSET | 95 | lgdt pa(boot_gdt_descr) |
96 | movl $(__BOOT_DS),%eax | 96 | movl $(__BOOT_DS),%eax |
97 | movl %eax,%ds | 97 | movl %eax,%ds |
98 | movl %eax,%es | 98 | movl %eax,%es |
@@ -105,8 +105,8 @@ ENTRY(startup_32) | |||
105 | */ | 105 | */ |
106 | cld | 106 | cld |
107 | xorl %eax,%eax | 107 | xorl %eax,%eax |
108 | movl $__bss_start - __PAGE_OFFSET,%edi | 108 | movl $pa(__bss_start),%edi |
109 | movl $__bss_stop - __PAGE_OFFSET,%ecx | 109 | movl $pa(__bss_stop),%ecx |
110 | subl %edi,%ecx | 110 | subl %edi,%ecx |
111 | shrl $2,%ecx | 111 | shrl $2,%ecx |
112 | rep ; stosl | 112 | rep ; stosl |
@@ -118,31 +118,32 @@ ENTRY(startup_32) | |||
118 | * (kexec on panic case). Hence copy out the parameters before initializing | 118 | * (kexec on panic case). Hence copy out the parameters before initializing |
119 | * page tables. | 119 | * page tables. |
120 | */ | 120 | */ |
121 | movl $(boot_params - __PAGE_OFFSET),%edi | 121 | movl $pa(boot_params),%edi |
122 | movl $(PARAM_SIZE/4),%ecx | 122 | movl $(PARAM_SIZE/4),%ecx |
123 | cld | 123 | cld |
124 | rep | 124 | rep |
125 | movsl | 125 | movsl |
126 | movl boot_params - __PAGE_OFFSET + NEW_CL_POINTER,%esi | 126 | movl pa(boot_params) + NEW_CL_POINTER,%esi |
127 | andl %esi,%esi | 127 | andl %esi,%esi |
128 | jz 1f # No comand line | 128 | jz 1f # No comand line |
129 | movl $(boot_command_line - __PAGE_OFFSET),%edi | 129 | movl $pa(boot_command_line),%edi |
130 | movl $(COMMAND_LINE_SIZE/4),%ecx | 130 | movl $(COMMAND_LINE_SIZE/4),%ecx |
131 | rep | 131 | rep |
132 | movsl | 132 | movsl |
133 | 1: | 133 | 1: |
134 | 134 | ||
135 | #ifdef CONFIG_PARAVIRT | 135 | #ifdef CONFIG_PARAVIRT |
136 | cmpw $0x207, (boot_params + BP_version - __PAGE_OFFSET) | 136 | /* This is can only trip for a broken bootloader... */ |
137 | cmpw $0x207, pa(boot_params + BP_version) | ||
137 | jb default_entry | 138 | jb default_entry |
138 | 139 | ||
139 | /* Paravirt-compatible boot parameters. Look to see what architecture | 140 | /* Paravirt-compatible boot parameters. Look to see what architecture |
140 | we're booting under. */ | 141 | we're booting under. */ |
141 | movl (boot_params + BP_hardware_subarch - __PAGE_OFFSET), %eax | 142 | movl pa(boot_params + BP_hardware_subarch), %eax |
142 | cmpl $num_subarch_entries, %eax | 143 | cmpl $num_subarch_entries, %eax |
143 | jae bad_subarch | 144 | jae bad_subarch |
144 | 145 | ||
145 | movl subarch_entries - __PAGE_OFFSET(,%eax,4), %eax | 146 | movl pa(subarch_entries)(,%eax,4), %eax |
146 | subl $__PAGE_OFFSET, %eax | 147 | subl $__PAGE_OFFSET, %eax |
147 | jmp *%eax | 148 | jmp *%eax |
148 | 149 | ||
@@ -170,17 +171,68 @@ num_subarch_entries = (. - subarch_entries) / 4 | |||
170 | * Mappings are created both at virtual address 0 (identity mapping) | 171 | * Mappings are created both at virtual address 0 (identity mapping) |
171 | * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END. | 172 | * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END. |
172 | * | 173 | * |
173 | * Warning: don't use %esi or the stack in this code. However, %esp | 174 | * Note that the stack is not yet set up! |
174 | * can be used as a GPR if you really need it... | ||
175 | */ | 175 | */ |
176 | page_pde_offset = (__PAGE_OFFSET >> 20); | 176 | #define PTE_ATTR 0x007 /* PRESENT+RW+USER */ |
177 | #define PDE_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */ | ||
178 | #define PGD_ATTR 0x001 /* PRESENT (no other attributes) */ | ||
177 | 179 | ||
178 | default_entry: | 180 | default_entry: |
179 | movl $(pg0 - __PAGE_OFFSET), %edi | 181 | #ifdef CONFIG_X86_PAE |
180 | movl $(swapper_pg_dir - __PAGE_OFFSET), %edx | 182 | |
181 | movl $0x007, %eax /* 0x007 = PRESENT+RW+USER */ | 183 | /* |
184 | * In PAE mode swapper_pg_dir is statically defined to contain enough | ||
185 | * entries to cover the VMSPLIT option (that is the top 1, 2 or 3 | ||
186 | * entries). The identity mapping is handled by pointing two PGD | ||
187 | * entries to the first kernel PMD. | ||
188 | * | ||
189 | * Note the upper half of each PMD or PTE are always zero at | ||
190 | * this stage. | ||
191 | */ | ||
192 | |||
193 | #define KPMDS ((0x100000000-__PAGE_OFFSET) >> 30) /* Number of kernel PMDs */ | ||
194 | |||
195 | xorl %ebx,%ebx /* %ebx is kept at zero */ | ||
196 | |||
197 | movl $pa(pg0), %edi | ||
198 | movl $pa(swapper_pg_pmd), %edx | ||
199 | movl $PTE_ATTR, %eax | ||
200 | 10: | ||
201 | leal PDE_ATTR(%edi),%ecx /* Create PMD entry */ | ||
202 | movl %ecx,(%edx) /* Store PMD entry */ | ||
203 | /* Upper half already zero */ | ||
204 | addl $8,%edx | ||
205 | movl $512,%ecx | ||
206 | 11: | ||
207 | stosl | ||
208 | xchgl %eax,%ebx | ||
209 | stosl | ||
210 | xchgl %eax,%ebx | ||
211 | addl $0x1000,%eax | ||
212 | loop 11b | ||
213 | |||
214 | /* | ||
215 | * End condition: we must map up to and including INIT_MAP_BEYOND_END | ||
216 | * bytes beyond the end of our own page tables. | ||
217 | */ | ||
218 | leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp | ||
219 | cmpl %ebp,%eax | ||
220 | jb 10b | ||
221 | 1: | ||
222 | movl %edi,pa(init_pg_tables_end) | ||
223 | |||
224 | /* Do early initialization of the fixmap area */ | ||
225 | movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax | ||
226 | movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) | ||
227 | #else /* Not PAE */ | ||
228 | |||
229 | page_pde_offset = (__PAGE_OFFSET >> 20); | ||
230 | |||
231 | movl $pa(pg0), %edi | ||
232 | movl $pa(swapper_pg_dir), %edx | ||
233 | movl $PTE_ATTR, %eax | ||
182 | 10: | 234 | 10: |
183 | leal 0x007(%edi),%ecx /* Create PDE entry */ | 235 | leal PDE_ATTR(%edi),%ecx /* Create PDE entry */ |
184 | movl %ecx,(%edx) /* Store identity PDE entry */ | 236 | movl %ecx,(%edx) /* Store identity PDE entry */ |
185 | movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ | 237 | movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ |
186 | addl $4,%edx | 238 | addl $4,%edx |
@@ -189,19 +241,20 @@ default_entry: | |||
189 | stosl | 241 | stosl |
190 | addl $0x1000,%eax | 242 | addl $0x1000,%eax |
191 | loop 11b | 243 | loop 11b |
192 | /* End condition: we must map up to and including INIT_MAP_BEYOND_END */ | 244 | /* |
193 | /* bytes beyond the end of our own page tables; the +0x007 is the attribute bits */ | 245 | * End condition: we must map up to and including INIT_MAP_BEYOND_END |
194 | leal (INIT_MAP_BEYOND_END+0x007)(%edi),%ebp | 246 | * bytes beyond the end of our own page tables; the +0x007 is |
247 | * the attribute bits | ||
248 | */ | ||
249 | leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp | ||
195 | cmpl %ebp,%eax | 250 | cmpl %ebp,%eax |
196 | jb 10b | 251 | jb 10b |
197 | movl %edi,(init_pg_tables_end - __PAGE_OFFSET) | 252 | movl %edi,pa(init_pg_tables_end) |
198 | |||
199 | /* Do an early initialization of the fixmap area */ | ||
200 | movl $(swapper_pg_dir - __PAGE_OFFSET), %edx | ||
201 | movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax | ||
202 | addl $0x67, %eax /* 0x67 == _PAGE_TABLE */ | ||
203 | movl %eax, 4092(%edx) | ||
204 | 253 | ||
254 | /* Do early initialization of the fixmap area */ | ||
255 | movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax | ||
256 | movl %eax,pa(swapper_pg_dir+0xffc) | ||
257 | #endif | ||
205 | jmp 3f | 258 | jmp 3f |
206 | /* | 259 | /* |
207 | * Non-boot CPU entry point; entered from trampoline.S | 260 | * Non-boot CPU entry point; entered from trampoline.S |
@@ -241,7 +294,7 @@ ENTRY(startup_32_smp) | |||
241 | * NOTE! We have to correct for the fact that we're | 294 | * NOTE! We have to correct for the fact that we're |
242 | * not yet offset PAGE_OFFSET.. | 295 | * not yet offset PAGE_OFFSET.. |
243 | */ | 296 | */ |
244 | #define cr4_bits mmu_cr4_features-__PAGE_OFFSET | 297 | #define cr4_bits pa(mmu_cr4_features) |
245 | movl cr4_bits,%edx | 298 | movl cr4_bits,%edx |
246 | andl %edx,%edx | 299 | andl %edx,%edx |
247 | jz 6f | 300 | jz 6f |
@@ -276,10 +329,10 @@ ENTRY(startup_32_smp) | |||
276 | /* | 329 | /* |
277 | * Enable paging | 330 | * Enable paging |
278 | */ | 331 | */ |
279 | movl $swapper_pg_dir-__PAGE_OFFSET,%eax | 332 | movl $pa(swapper_pg_dir),%eax |
280 | movl %eax,%cr3 /* set the page table pointer.. */ | 333 | movl %eax,%cr3 /* set the page table pointer.. */ |
281 | movl %cr0,%eax | 334 | movl %cr0,%eax |
282 | orl $0x80000000,%eax | 335 | orl $X86_CR0_PG,%eax |
283 | movl %eax,%cr0 /* ..and set paging (PG) bit */ | 336 | movl %eax,%cr0 /* ..and set paging (PG) bit */ |
284 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ | 337 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ |
285 | 1: | 338 | 1: |
@@ -552,16 +605,44 @@ ENTRY(_stext) | |||
552 | */ | 605 | */ |
553 | .section ".bss.page_aligned","wa" | 606 | .section ".bss.page_aligned","wa" |
554 | .align PAGE_SIZE_asm | 607 | .align PAGE_SIZE_asm |
608 | #ifdef CONFIG_X86_PAE | ||
609 | ENTRY(swapper_pg_pmd) | ||
610 | .fill 1024*KPMDS,4,0 | ||
611 | #else | ||
555 | ENTRY(swapper_pg_dir) | 612 | ENTRY(swapper_pg_dir) |
556 | .fill 1024,4,0 | 613 | .fill 1024,4,0 |
557 | ENTRY(swapper_pg_pmd) | 614 | #endif |
615 | ENTRY(swapper_pg_fixmap) | ||
558 | .fill 1024,4,0 | 616 | .fill 1024,4,0 |
559 | ENTRY(empty_zero_page) | 617 | ENTRY(empty_zero_page) |
560 | .fill 4096,1,0 | 618 | .fill 4096,1,0 |
561 | |||
562 | /* | 619 | /* |
563 | * This starts the data section. | 620 | * This starts the data section. |
564 | */ | 621 | */ |
622 | #ifdef CONFIG_X86_PAE | ||
623 | .section ".data.page_aligned","wa" | ||
624 | /* Page-aligned for the benefit of paravirt? */ | ||
625 | .align PAGE_SIZE_asm | ||
626 | ENTRY(swapper_pg_dir) | ||
627 | .long pa(swapper_pg_pmd+PGD_ATTR),0 /* low identity map */ | ||
628 | # if KPMDS == 3 | ||
629 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
630 | .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 | ||
631 | .long pa(swapper_pg_pmd+PGD_ATTR+0x2000),0 | ||
632 | # elif KPMDS == 2 | ||
633 | .long 0,0 | ||
634 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
635 | .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 | ||
636 | # elif KPMDS == 1 | ||
637 | .long 0,0 | ||
638 | .long 0,0 | ||
639 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
640 | # else | ||
641 | # error "Kernel PMDs should be 1, 2 or 3" | ||
642 | # endif | ||
643 | .align PAGE_SIZE_asm /* needs to be page-sized too */ | ||
644 | #endif | ||
645 | |||
565 | .data | 646 | .data |
566 | ENTRY(stack_start) | 647 | ENTRY(stack_start) |
567 | .long init_thread_union+THREAD_SIZE | 648 | .long init_thread_union+THREAD_SIZE |
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c index 219f86eb6123..027fc067b399 100644 --- a/arch/x86/kernel/mfgpt_32.c +++ b/arch/x86/kernel/mfgpt_32.c | |||
@@ -12,48 +12,37 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * We are using the 32Khz input clock - its the only one that has the | 15 | * We are using the 32.768kHz input clock - it's the only one that has the |
16 | * ranges we find desirable. The following table lists the suitable | 16 | * ranges we find desirable. The following table lists the suitable |
17 | * divisors and the associated hz, minimum interval | 17 | * divisors and the associated Hz, minimum interval and the maximum interval: |
18 | * and the maximum interval: | ||
19 | * | 18 | * |
20 | * Divisor Hz Min Delta (S) Max Delta (S) | 19 | * Divisor Hz Min Delta (s) Max Delta (s) |
21 | * 1 32000 .0005 2.048 | 20 | * 1 32768 .00048828125 2.000 |
22 | * 2 16000 .001 4.096 | 21 | * 2 16384 .0009765625 4.000 |
23 | * 4 8000 .002 8.192 | 22 | * 4 8192 .001953125 8.000 |
24 | * 8 4000 .004 16.384 | 23 | * 8 4096 .00390625 16.000 |
25 | * 16 2000 .008 32.768 | 24 | * 16 2048 .0078125 32.000 |
26 | * 32 1000 .016 65.536 | 25 | * 32 1024 .015625 64.000 |
27 | * 64 500 .032 131.072 | 26 | * 64 512 .03125 128.000 |
28 | * 128 250 .064 262.144 | 27 | * 128 256 .0625 256.000 |
29 | * 256 125 .128 524.288 | 28 | * 256 128 .125 512.000 |
30 | */ | 29 | */ |
31 | 30 | ||
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
34 | #include <linux/module.h> | ||
35 | #include <asm/geode.h> | 33 | #include <asm/geode.h> |
36 | 34 | ||
37 | #define F_AVAIL 0x01 | ||
38 | |||
39 | static struct mfgpt_timer_t { | 35 | static struct mfgpt_timer_t { |
40 | int flags; | 36 | unsigned int avail:1; |
41 | struct module *owner; | ||
42 | } mfgpt_timers[MFGPT_MAX_TIMERS]; | 37 | } mfgpt_timers[MFGPT_MAX_TIMERS]; |
43 | 38 | ||
44 | /* Selected from the table above */ | 39 | /* Selected from the table above */ |
45 | 40 | ||
46 | #define MFGPT_DIVISOR 16 | 41 | #define MFGPT_DIVISOR 16 |
47 | #define MFGPT_SCALE 4 /* divisor = 2^(scale) */ | 42 | #define MFGPT_SCALE 4 /* divisor = 2^(scale) */ |
48 | #define MFGPT_HZ (32000 / MFGPT_DIVISOR) | 43 | #define MFGPT_HZ (32768 / MFGPT_DIVISOR) |
49 | #define MFGPT_PERIODIC (MFGPT_HZ / HZ) | 44 | #define MFGPT_PERIODIC (MFGPT_HZ / HZ) |
50 | 45 | ||
51 | #ifdef CONFIG_GEODE_MFGPT_TIMER | ||
52 | static int __init mfgpt_timer_setup(void); | ||
53 | #else | ||
54 | #define mfgpt_timer_setup() (0) | ||
55 | #endif | ||
56 | |||
57 | /* Allow for disabling of MFGPTs */ | 46 | /* Allow for disabling of MFGPTs */ |
58 | static int disable; | 47 | static int disable; |
59 | static int __init mfgpt_disable(char *s) | 48 | static int __init mfgpt_disable(char *s) |
@@ -85,28 +74,37 @@ __setup("mfgptfix", mfgpt_fix); | |||
85 | * In other cases (such as with VSAless OpenFirmware), the system firmware | 74 | * In other cases (such as with VSAless OpenFirmware), the system firmware |
86 | * leaves timers available for us to use. | 75 | * leaves timers available for us to use. |
87 | */ | 76 | */ |
88 | int __init geode_mfgpt_detect(void) | 77 | |
78 | |||
79 | static int timers = -1; | ||
80 | |||
81 | static void geode_mfgpt_detect(void) | ||
89 | { | 82 | { |
90 | int count = 0, i; | 83 | int i; |
91 | u16 val; | 84 | u16 val; |
92 | 85 | ||
86 | timers = 0; | ||
87 | |||
93 | if (disable) { | 88 | if (disable) { |
94 | printk(KERN_INFO "geode-mfgpt: Skipping MFGPT setup\n"); | 89 | printk(KERN_INFO "geode-mfgpt: MFGPT support is disabled\n"); |
95 | return 0; | 90 | goto done; |
91 | } | ||
92 | |||
93 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) { | ||
94 | printk(KERN_INFO "geode-mfgpt: MFGPT LBAR is not set up\n"); | ||
95 | goto done; | ||
96 | } | 96 | } |
97 | 97 | ||
98 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { | 98 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { |
99 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); | 99 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); |
100 | if (!(val & MFGPT_SETUP_SETUP)) { | 100 | if (!(val & MFGPT_SETUP_SETUP)) { |
101 | mfgpt_timers[i].flags = F_AVAIL; | 101 | mfgpt_timers[i].avail = 1; |
102 | count++; | 102 | timers++; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | /* set up clock event device, if desired */ | 106 | done: |
107 | i = mfgpt_timer_setup(); | 107 | printk(KERN_INFO "geode-mfgpt: %d MFGPT timers available.\n", timers); |
108 | |||
109 | return count; | ||
110 | } | 108 | } |
111 | 109 | ||
112 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) | 110 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) |
@@ -183,36 +181,41 @@ int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable) | |||
183 | return 0; | 181 | return 0; |
184 | } | 182 | } |
185 | 183 | ||
186 | static int mfgpt_get(int timer, struct module *owner) | 184 | static int mfgpt_get(int timer) |
187 | { | 185 | { |
188 | mfgpt_timers[timer].flags &= ~F_AVAIL; | 186 | mfgpt_timers[timer].avail = 0; |
189 | mfgpt_timers[timer].owner = owner; | ||
190 | printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer); | 187 | printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer); |
191 | return timer; | 188 | return timer; |
192 | } | 189 | } |
193 | 190 | ||
194 | int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner) | 191 | int geode_mfgpt_alloc_timer(int timer, int domain) |
195 | { | 192 | { |
196 | int i; | 193 | int i; |
197 | 194 | ||
198 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) | 195 | if (timers == -1) { |
199 | return -ENODEV; | 196 | /* timers haven't been detected yet */ |
197 | geode_mfgpt_detect(); | ||
198 | } | ||
199 | |||
200 | if (!timers) | ||
201 | return -1; | ||
202 | |||
200 | if (timer >= MFGPT_MAX_TIMERS) | 203 | if (timer >= MFGPT_MAX_TIMERS) |
201 | return -EIO; | 204 | return -1; |
202 | 205 | ||
203 | if (timer < 0) { | 206 | if (timer < 0) { |
204 | /* Try to find an available timer */ | 207 | /* Try to find an available timer */ |
205 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { | 208 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { |
206 | if (mfgpt_timers[i].flags & F_AVAIL) | 209 | if (mfgpt_timers[i].avail) |
207 | return mfgpt_get(i, owner); | 210 | return mfgpt_get(i); |
208 | 211 | ||
209 | if (i == 5 && domain == MFGPT_DOMAIN_WORKING) | 212 | if (i == 5 && domain == MFGPT_DOMAIN_WORKING) |
210 | break; | 213 | break; |
211 | } | 214 | } |
212 | } else { | 215 | } else { |
213 | /* If they requested a specific timer, try to honor that */ | 216 | /* If they requested a specific timer, try to honor that */ |
214 | if (mfgpt_timers[timer].flags & F_AVAIL) | 217 | if (mfgpt_timers[timer].avail) |
215 | return mfgpt_get(timer, owner); | 218 | return mfgpt_get(timer); |
216 | } | 219 | } |
217 | 220 | ||
218 | /* No timers available - too bad */ | 221 | /* No timers available - too bad */ |
@@ -244,10 +247,11 @@ static int __init mfgpt_setup(char *str) | |||
244 | } | 247 | } |
245 | __setup("mfgpt_irq=", mfgpt_setup); | 248 | __setup("mfgpt_irq=", mfgpt_setup); |
246 | 249 | ||
247 | static inline void mfgpt_disable_timer(u16 clock) | 250 | static void mfgpt_disable_timer(u16 clock) |
248 | { | 251 | { |
249 | u16 val = geode_mfgpt_read(clock, MFGPT_REG_SETUP); | 252 | /* avoid races by clearing CMP1 and CMP2 unconditionally */ |
250 | geode_mfgpt_write(clock, MFGPT_REG_SETUP, val & ~MFGPT_SETUP_CNTEN); | 253 | geode_mfgpt_write(clock, MFGPT_REG_SETUP, (u16) ~MFGPT_SETUP_CNTEN | |
254 | MFGPT_SETUP_CMP1 | MFGPT_SETUP_CMP2); | ||
251 | } | 255 | } |
252 | 256 | ||
253 | static int mfgpt_next_event(unsigned long, struct clock_event_device *); | 257 | static int mfgpt_next_event(unsigned long, struct clock_event_device *); |
@@ -263,7 +267,7 @@ static struct clock_event_device mfgpt_clockevent = { | |||
263 | .shift = 32 | 267 | .shift = 32 |
264 | }; | 268 | }; |
265 | 269 | ||
266 | static inline void mfgpt_start_timer(u16 clock, u16 delta) | 270 | static void mfgpt_start_timer(u16 delta) |
267 | { | 271 | { |
268 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_CMP2, (u16) delta); | 272 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_CMP2, (u16) delta); |
269 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); | 273 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); |
@@ -278,21 +282,25 @@ static void mfgpt_set_mode(enum clock_event_mode mode, | |||
278 | mfgpt_disable_timer(mfgpt_event_clock); | 282 | mfgpt_disable_timer(mfgpt_event_clock); |
279 | 283 | ||
280 | if (mode == CLOCK_EVT_MODE_PERIODIC) | 284 | if (mode == CLOCK_EVT_MODE_PERIODIC) |
281 | mfgpt_start_timer(mfgpt_event_clock, MFGPT_PERIODIC); | 285 | mfgpt_start_timer(MFGPT_PERIODIC); |
282 | 286 | ||
283 | mfgpt_tick_mode = mode; | 287 | mfgpt_tick_mode = mode; |
284 | } | 288 | } |
285 | 289 | ||
286 | static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) | 290 | static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) |
287 | { | 291 | { |
288 | mfgpt_start_timer(mfgpt_event_clock, delta); | 292 | mfgpt_start_timer(delta); |
289 | return 0; | 293 | return 0; |
290 | } | 294 | } |
291 | 295 | ||
292 | /* Assume (foolishly?), that this interrupt was due to our tick */ | ||
293 | |||
294 | static irqreturn_t mfgpt_tick(int irq, void *dev_id) | 296 | static irqreturn_t mfgpt_tick(int irq, void *dev_id) |
295 | { | 297 | { |
298 | u16 val = geode_mfgpt_read(mfgpt_event_clock, MFGPT_REG_SETUP); | ||
299 | |||
300 | /* See if the interrupt was for us */ | ||
301 | if (!(val & (MFGPT_SETUP_SETUP | MFGPT_SETUP_CMP2 | MFGPT_SETUP_CMP1))) | ||
302 | return IRQ_NONE; | ||
303 | |||
296 | /* Turn off the clock (and clear the event) */ | 304 | /* Turn off the clock (and clear the event) */ |
297 | mfgpt_disable_timer(mfgpt_event_clock); | 305 | mfgpt_disable_timer(mfgpt_event_clock); |
298 | 306 | ||
@@ -320,13 +328,12 @@ static struct irqaction mfgptirq = { | |||
320 | .name = "mfgpt-timer" | 328 | .name = "mfgpt-timer" |
321 | }; | 329 | }; |
322 | 330 | ||
323 | static int __init mfgpt_timer_setup(void) | 331 | int __init mfgpt_timer_setup(void) |
324 | { | 332 | { |
325 | int timer, ret; | 333 | int timer, ret; |
326 | u16 val; | 334 | u16 val; |
327 | 335 | ||
328 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING, | 336 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); |
329 | THIS_MODULE); | ||
330 | if (timer < 0) { | 337 | if (timer < 0) { |
331 | printk(KERN_ERR | 338 | printk(KERN_ERR |
332 | "mfgpt-timer: Could not allocate a MFPGT timer\n"); | 339 | "mfgpt-timer: Could not allocate a MFPGT timer\n"); |
@@ -363,7 +370,7 @@ static int __init mfgpt_timer_setup(void) | |||
363 | &mfgpt_clockevent); | 370 | &mfgpt_clockevent); |
364 | 371 | ||
365 | printk(KERN_INFO | 372 | printk(KERN_INFO |
366 | "mfgpt-timer: registering the MFGT timer as a clock event.\n"); | 373 | "mfgpt-timer: registering the MFGPT timer as a clock event.\n"); |
367 | clockevents_register_device(&mfgpt_clockevent); | 374 | clockevents_register_device(&mfgpt_clockevent); |
368 | 375 | ||
369 | return 0; | 376 | return 0; |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 6ba33ca8715a..1941482d4ca3 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -27,7 +27,7 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
27 | pci_write_config_byte(dev, 0xf4, config|0x2); | 27 | pci_write_config_byte(dev, 0xf4, config|0x2); |
28 | 28 | ||
29 | /* read xTPR register */ | 29 | /* read xTPR register */ |
30 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); | 30 | raw_pci_read(0, 0, 0x40, 0x4c, 2, &word); |
31 | 31 | ||
32 | if (!(word & (1 << 13))) { | 32 | if (!(word & (1 << 13))) { |
33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " | 33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " |
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index d1d8c347cc0b..691ab4cb167b 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -154,7 +154,11 @@ struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; | |||
154 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; | 154 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; |
155 | EXPORT_SYMBOL(boot_cpu_data); | 155 | EXPORT_SYMBOL(boot_cpu_data); |
156 | 156 | ||
157 | #ifndef CONFIG_X86_PAE | ||
157 | unsigned long mmu_cr4_features; | 158 | unsigned long mmu_cr4_features; |
159 | #else | ||
160 | unsigned long mmu_cr4_features = X86_CR4_PAE; | ||
161 | #endif | ||
158 | 162 | ||
159 | /* for MCA, but anyone else can use it if they want */ | 163 | /* for MCA, but anyone else can use it if they want */ |
160 | unsigned int machine_id; | 164 | unsigned int machine_id; |
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c index e6757aaa202b..a40051b71d9b 100644 --- a/arch/x86/kernel/topology.c +++ b/arch/x86/kernel/topology.c | |||
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(arch_register_cpu); | |||
53 | 53 | ||
54 | void arch_unregister_cpu(int num) | 54 | void arch_unregister_cpu(int num) |
55 | { | 55 | { |
56 | return unregister_cpu(&per_cpu(cpu_devices, num).cpu); | 56 | unregister_cpu(&per_cpu(cpu_devices, num).cpu); |
57 | } | 57 | } |
58 | EXPORT_SYMBOL(arch_unregister_cpu); | 58 | EXPORT_SYMBOL(arch_unregister_cpu); |
59 | #else | 59 | #else |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index d1bc04006d16..8106bba41ecb 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/pgalloc.h> | 46 | #include <asm/pgalloc.h> |
47 | #include <asm/sections.h> | 47 | #include <asm/sections.h> |
48 | #include <asm/paravirt.h> | 48 | #include <asm/paravirt.h> |
49 | #include <asm/setup.h> | ||
49 | 50 | ||
50 | unsigned int __VMALLOC_RESERVE = 128 << 20; | 51 | unsigned int __VMALLOC_RESERVE = 128 << 20; |
51 | 52 | ||
@@ -328,44 +329,38 @@ pteval_t __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC; | |||
328 | 329 | ||
329 | void __init native_pagetable_setup_start(pgd_t *base) | 330 | void __init native_pagetable_setup_start(pgd_t *base) |
330 | { | 331 | { |
331 | #ifdef CONFIG_X86_PAE | 332 | unsigned long pfn, va; |
332 | int i; | 333 | pgd_t *pgd; |
334 | pud_t *pud; | ||
335 | pmd_t *pmd; | ||
336 | pte_t *pte; | ||
333 | 337 | ||
334 | /* | 338 | /* |
335 | * Init entries of the first-level page table to the | 339 | * Remove any mappings which extend past the end of physical |
336 | * zero page, if they haven't already been set up. | 340 | * memory from the boot time page table: |
337 | * | ||
338 | * In a normal native boot, we'll be running on a | ||
339 | * pagetable rooted in swapper_pg_dir, but not in PAE | ||
340 | * mode, so this will end up clobbering the mappings | ||
341 | * for the lower 24Mbytes of the address space, | ||
342 | * without affecting the kernel address space. | ||
343 | */ | 341 | */ |
344 | for (i = 0; i < USER_PTRS_PER_PGD; i++) | 342 | for (pfn = max_low_pfn + 1; pfn < 1<<(32-PAGE_SHIFT); pfn++) { |
345 | set_pgd(&base[i], | 343 | va = PAGE_OFFSET + (pfn<<PAGE_SHIFT); |
346 | __pgd(__pa(empty_zero_page) | _PAGE_PRESENT)); | 344 | pgd = base + pgd_index(va); |
347 | 345 | if (!pgd_present(*pgd)) | |
348 | /* Make sure kernel address space is empty so that a pagetable | 346 | break; |
349 | will be allocated for it. */ | 347 | |
350 | memset(&base[USER_PTRS_PER_PGD], 0, | 348 | pud = pud_offset(pgd, va); |
351 | KERNEL_PGD_PTRS * sizeof(pgd_t)); | 349 | pmd = pmd_offset(pud, va); |
352 | #else | 350 | if (!pmd_present(*pmd)) |
351 | break; | ||
352 | |||
353 | pte = pte_offset_kernel(pmd, va); | ||
354 | if (!pte_present(*pte)) | ||
355 | break; | ||
356 | |||
357 | pte_clear(NULL, va, pte); | ||
358 | } | ||
353 | paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT); | 359 | paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT); |
354 | #endif | ||
355 | } | 360 | } |
356 | 361 | ||
357 | void __init native_pagetable_setup_done(pgd_t *base) | 362 | void __init native_pagetable_setup_done(pgd_t *base) |
358 | { | 363 | { |
359 | #ifdef CONFIG_X86_PAE | ||
360 | /* | ||
361 | * Add low memory identity-mappings - SMP needs it when | ||
362 | * starting up on an AP from real-mode. In the non-PAE | ||
363 | * case we already have these mappings through head.S. | ||
364 | * All user-space mappings are explicitly cleared after | ||
365 | * SMP startup. | ||
366 | */ | ||
367 | set_pgd(&base[0], base[USER_PTRS_PER_PGD]); | ||
368 | #endif | ||
369 | } | 364 | } |
370 | 365 | ||
371 | /* | 366 | /* |
@@ -374,9 +369,8 @@ void __init native_pagetable_setup_done(pgd_t *base) | |||
374 | * the boot process. | 369 | * the boot process. |
375 | * | 370 | * |
376 | * If we're booting on native hardware, this will be a pagetable | 371 | * If we're booting on native hardware, this will be a pagetable |
377 | * constructed in arch/i386/kernel/head.S, and not running in PAE mode | 372 | * constructed in arch/x86/kernel/head_32.S. The root of the |
378 | * (even if we'll end up running in PAE). The root of the pagetable | 373 | * pagetable will be swapper_pg_dir. |
379 | * will be swapper_pg_dir. | ||
380 | * | 374 | * |
381 | * If we're booting paravirtualized under a hypervisor, then there are | 375 | * If we're booting paravirtualized under a hypervisor, then there are |
382 | * more options: we may already be running PAE, and the pagetable may | 376 | * more options: we may already be running PAE, and the pagetable may |
@@ -537,14 +531,6 @@ void __init paging_init(void) | |||
537 | 531 | ||
538 | load_cr3(swapper_pg_dir); | 532 | load_cr3(swapper_pg_dir); |
539 | 533 | ||
540 | #ifdef CONFIG_X86_PAE | ||
541 | /* | ||
542 | * We will bail out later - printk doesn't work right now so | ||
543 | * the user would just see a hanging kernel. | ||
544 | */ | ||
545 | if (cpu_has_pae) | ||
546 | set_in_cr4(X86_CR4_PAE); | ||
547 | #endif | ||
548 | __flush_tlb_all(); | 534 | __flush_tlb_all(); |
549 | 535 | ||
550 | kmap_init(); | 536 | kmap_init(); |
@@ -675,13 +661,11 @@ void __init mem_init(void) | |||
675 | BUG_ON((unsigned long)high_memory > VMALLOC_START); | 661 | BUG_ON((unsigned long)high_memory > VMALLOC_START); |
676 | #endif /* double-sanity-check paranoia */ | 662 | #endif /* double-sanity-check paranoia */ |
677 | 663 | ||
678 | #ifdef CONFIG_X86_PAE | ||
679 | if (!cpu_has_pae) | ||
680 | panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); | ||
681 | #endif | ||
682 | if (boot_cpu_data.wp_works_ok < 0) | 664 | if (boot_cpu_data.wp_works_ok < 0) |
683 | test_wp_bit(); | 665 | test_wp_bit(); |
684 | 666 | ||
667 | cpa_init(); | ||
668 | |||
685 | /* | 669 | /* |
686 | * Subtle. SMP is doing it's boot stuff late (because it has to | 670 | * Subtle. SMP is doing it's boot stuff late (because it has to |
687 | * fork idle threads) - but it also needs low mappings for the | 671 | * fork idle threads) - but it also needs low mappings for the |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 5fe880fc305d..b59fc238151f 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -528,13 +528,15 @@ void __init mem_init(void) | |||
528 | reservedpages << (PAGE_SHIFT-10), | 528 | reservedpages << (PAGE_SHIFT-10), |
529 | datasize >> 10, | 529 | datasize >> 10, |
530 | initsize >> 10); | 530 | initsize >> 10); |
531 | |||
532 | cpa_init(); | ||
531 | } | 533 | } |
532 | 534 | ||
533 | void free_init_pages(char *what, unsigned long begin, unsigned long end) | 535 | void free_init_pages(char *what, unsigned long begin, unsigned long end) |
534 | { | 536 | { |
535 | unsigned long addr; | 537 | unsigned long addr = begin; |
536 | 538 | ||
537 | if (begin >= end) | 539 | if (addr >= end) |
538 | return; | 540 | return; |
539 | 541 | ||
540 | /* | 542 | /* |
@@ -549,7 +551,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
549 | #else | 551 | #else |
550 | printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); | 552 | printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); |
551 | 553 | ||
552 | for (addr = begin; addr < end; addr += PAGE_SIZE) { | 554 | for (; addr < end; addr += PAGE_SIZE) { |
553 | ClearPageReserved(virt_to_page(addr)); | 555 | ClearPageReserved(virt_to_page(addr)); |
554 | init_page_count(virt_to_page(addr)); | 556 | init_page_count(virt_to_page(addr)); |
555 | memset((void *)(addr & ~(PAGE_SIZE-1)), | 557 | memset((void *)(addr & ~(PAGE_SIZE-1)), |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index ee6648fe6b15..a4897a85268a 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -260,41 +260,46 @@ static int __init early_ioremap_debug_setup(char *str) | |||
260 | early_param("early_ioremap_debug", early_ioremap_debug_setup); | 260 | early_param("early_ioremap_debug", early_ioremap_debug_setup); |
261 | 261 | ||
262 | static __initdata int after_paging_init; | 262 | static __initdata int after_paging_init; |
263 | static __initdata unsigned long bm_pte[1024] | 263 | static __initdata pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] |
264 | __attribute__((aligned(PAGE_SIZE))); | 264 | __attribute__((aligned(PAGE_SIZE))); |
265 | 265 | ||
266 | static inline unsigned long * __init early_ioremap_pgd(unsigned long addr) | 266 | static inline pmd_t * __init early_ioremap_pmd(unsigned long addr) |
267 | { | 267 | { |
268 | return (unsigned long *)swapper_pg_dir + ((addr >> 22) & 1023); | 268 | pgd_t *pgd = &swapper_pg_dir[pgd_index(addr)]; |
269 | pud_t *pud = pud_offset(pgd, addr); | ||
270 | pmd_t *pmd = pmd_offset(pud, addr); | ||
271 | |||
272 | return pmd; | ||
269 | } | 273 | } |
270 | 274 | ||
271 | static inline unsigned long * __init early_ioremap_pte(unsigned long addr) | 275 | static inline pte_t * __init early_ioremap_pte(unsigned long addr) |
272 | { | 276 | { |
273 | return bm_pte + ((addr >> PAGE_SHIFT) & 1023); | 277 | return &bm_pte[pte_index(addr)]; |
274 | } | 278 | } |
275 | 279 | ||
276 | void __init early_ioremap_init(void) | 280 | void __init early_ioremap_init(void) |
277 | { | 281 | { |
278 | unsigned long *pgd; | 282 | pmd_t *pmd; |
279 | 283 | ||
280 | if (early_ioremap_debug) | 284 | if (early_ioremap_debug) |
281 | printk(KERN_INFO "early_ioremap_init()\n"); | 285 | printk(KERN_INFO "early_ioremap_init()\n"); |
282 | 286 | ||
283 | pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); | 287 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); |
284 | *pgd = __pa(bm_pte) | _PAGE_TABLE; | ||
285 | memset(bm_pte, 0, sizeof(bm_pte)); | 288 | memset(bm_pte, 0, sizeof(bm_pte)); |
289 | pmd_populate_kernel(&init_mm, pmd, bm_pte); | ||
290 | |||
286 | /* | 291 | /* |
287 | * The boot-ioremap range spans multiple pgds, for which | 292 | * The boot-ioremap range spans multiple pmds, for which |
288 | * we are not prepared: | 293 | * we are not prepared: |
289 | */ | 294 | */ |
290 | if (pgd != early_ioremap_pgd(fix_to_virt(FIX_BTMAP_END))) { | 295 | if (pmd != early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))) { |
291 | WARN_ON(1); | 296 | WARN_ON(1); |
292 | printk(KERN_WARNING "pgd %p != %p\n", | 297 | printk(KERN_WARNING "pmd %p != %p\n", |
293 | pgd, early_ioremap_pgd(fix_to_virt(FIX_BTMAP_END))); | 298 | pmd, early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))); |
294 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n", | 299 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n", |
295 | fix_to_virt(FIX_BTMAP_BEGIN)); | 300 | fix_to_virt(FIX_BTMAP_BEGIN)); |
296 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_END): %08lx\n", | 301 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_END): %08lx\n", |
297 | fix_to_virt(FIX_BTMAP_END)); | 302 | fix_to_virt(FIX_BTMAP_END)); |
298 | 303 | ||
299 | printk(KERN_WARNING "FIX_BTMAP_END: %d\n", FIX_BTMAP_END); | 304 | printk(KERN_WARNING "FIX_BTMAP_END: %d\n", FIX_BTMAP_END); |
300 | printk(KERN_WARNING "FIX_BTMAP_BEGIN: %d\n", | 305 | printk(KERN_WARNING "FIX_BTMAP_BEGIN: %d\n", |
@@ -304,28 +309,29 @@ void __init early_ioremap_init(void) | |||
304 | 309 | ||
305 | void __init early_ioremap_clear(void) | 310 | void __init early_ioremap_clear(void) |
306 | { | 311 | { |
307 | unsigned long *pgd; | 312 | pmd_t *pmd; |
308 | 313 | ||
309 | if (early_ioremap_debug) | 314 | if (early_ioremap_debug) |
310 | printk(KERN_INFO "early_ioremap_clear()\n"); | 315 | printk(KERN_INFO "early_ioremap_clear()\n"); |
311 | 316 | ||
312 | pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); | 317 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); |
313 | *pgd = 0; | 318 | pmd_clear(pmd); |
314 | paravirt_release_pt(__pa(pgd) >> PAGE_SHIFT); | 319 | paravirt_release_pt(__pa(bm_pte) >> PAGE_SHIFT); |
315 | __flush_tlb_all(); | 320 | __flush_tlb_all(); |
316 | } | 321 | } |
317 | 322 | ||
318 | void __init early_ioremap_reset(void) | 323 | void __init early_ioremap_reset(void) |
319 | { | 324 | { |
320 | enum fixed_addresses idx; | 325 | enum fixed_addresses idx; |
321 | unsigned long *pte, phys, addr; | 326 | unsigned long addr, phys; |
327 | pte_t *pte; | ||
322 | 328 | ||
323 | after_paging_init = 1; | 329 | after_paging_init = 1; |
324 | for (idx = FIX_BTMAP_BEGIN; idx >= FIX_BTMAP_END; idx--) { | 330 | for (idx = FIX_BTMAP_BEGIN; idx >= FIX_BTMAP_END; idx--) { |
325 | addr = fix_to_virt(idx); | 331 | addr = fix_to_virt(idx); |
326 | pte = early_ioremap_pte(addr); | 332 | pte = early_ioremap_pte(addr); |
327 | if (*pte & _PAGE_PRESENT) { | 333 | if (pte_present(*pte)) { |
328 | phys = *pte & PAGE_MASK; | 334 | phys = pte_val(*pte) & PAGE_MASK; |
329 | set_fixmap(idx, phys); | 335 | set_fixmap(idx, phys); |
330 | } | 336 | } |
331 | } | 337 | } |
@@ -334,7 +340,8 @@ void __init early_ioremap_reset(void) | |||
334 | static void __init __early_set_fixmap(enum fixed_addresses idx, | 340 | static void __init __early_set_fixmap(enum fixed_addresses idx, |
335 | unsigned long phys, pgprot_t flags) | 341 | unsigned long phys, pgprot_t flags) |
336 | { | 342 | { |
337 | unsigned long *pte, addr = __fix_to_virt(idx); | 343 | unsigned long addr = __fix_to_virt(idx); |
344 | pte_t *pte; | ||
338 | 345 | ||
339 | if (idx >= __end_of_fixed_addresses) { | 346 | if (idx >= __end_of_fixed_addresses) { |
340 | BUG(); | 347 | BUG(); |
@@ -342,9 +349,9 @@ static void __init __early_set_fixmap(enum fixed_addresses idx, | |||
342 | } | 349 | } |
343 | pte = early_ioremap_pte(addr); | 350 | pte = early_ioremap_pte(addr); |
344 | if (pgprot_val(flags)) | 351 | if (pgprot_val(flags)) |
345 | *pte = (phys & PAGE_MASK) | pgprot_val(flags); | 352 | set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags)); |
346 | else | 353 | else |
347 | *pte = 0; | 354 | pte_clear(NULL, addr, pte); |
348 | __flush_tlb_one(addr); | 355 | __flush_tlb_one(addr); |
349 | } | 356 | } |
350 | 357 | ||
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8493c855582b..440210a2277d 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/interrupt.h> | ||
11 | 12 | ||
12 | #include <asm/e820.h> | 13 | #include <asm/e820.h> |
13 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
@@ -191,7 +192,7 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) | |||
191 | * or when the present bit is not set. Otherwise we would return a | 192 | * or when the present bit is not set. Otherwise we would return a |
192 | * pointer to a nonexisting mapping. | 193 | * pointer to a nonexisting mapping. |
193 | */ | 194 | */ |
194 | pte_t *lookup_address(unsigned long address, int *level) | 195 | pte_t *lookup_address(unsigned long address, unsigned int *level) |
195 | { | 196 | { |
196 | pgd_t *pgd = pgd_offset_k(address); | 197 | pgd_t *pgd = pgd_offset_k(address); |
197 | pud_t *pud; | 198 | pud_t *pud; |
@@ -252,10 +253,11 @@ static int | |||
252 | try_preserve_large_page(pte_t *kpte, unsigned long address, | 253 | try_preserve_large_page(pte_t *kpte, unsigned long address, |
253 | struct cpa_data *cpa) | 254 | struct cpa_data *cpa) |
254 | { | 255 | { |
255 | unsigned long nextpage_addr, numpages, pmask, psize, flags; | 256 | unsigned long nextpage_addr, numpages, pmask, psize, flags, addr; |
256 | pte_t new_pte, old_pte, *tmp; | 257 | pte_t new_pte, old_pte, *tmp; |
257 | pgprot_t old_prot, new_prot; | 258 | pgprot_t old_prot, new_prot; |
258 | int level, do_split = 1; | 259 | int i, do_split = 1; |
260 | unsigned int level; | ||
259 | 261 | ||
260 | spin_lock_irqsave(&pgd_lock, flags); | 262 | spin_lock_irqsave(&pgd_lock, flags); |
261 | /* | 263 | /* |
@@ -302,6 +304,19 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
302 | new_prot = static_protections(new_prot, address); | 304 | new_prot = static_protections(new_prot, address); |
303 | 305 | ||
304 | /* | 306 | /* |
307 | * We need to check the full range, whether | ||
308 | * static_protection() requires a different pgprot for one of | ||
309 | * the pages in the range we try to preserve: | ||
310 | */ | ||
311 | addr = address + PAGE_SIZE; | ||
312 | for (i = 1; i < cpa->numpages; i++, addr += PAGE_SIZE) { | ||
313 | pgprot_t chk_prot = static_protections(new_prot, addr); | ||
314 | |||
315 | if (pgprot_val(chk_prot) != pgprot_val(new_prot)) | ||
316 | goto out_unlock; | ||
317 | } | ||
318 | |||
319 | /* | ||
305 | * If there are no changes, return. maxpages has been updated | 320 | * If there are no changes, return. maxpages has been updated |
306 | * above: | 321 | * above: |
307 | */ | 322 | */ |
@@ -335,23 +350,103 @@ out_unlock: | |||
335 | return do_split; | 350 | return do_split; |
336 | } | 351 | } |
337 | 352 | ||
353 | static LIST_HEAD(page_pool); | ||
354 | static unsigned long pool_size, pool_pages, pool_low; | ||
355 | static unsigned long pool_used, pool_failed, pool_refill; | ||
356 | |||
357 | static void cpa_fill_pool(void) | ||
358 | { | ||
359 | struct page *p; | ||
360 | gfp_t gfp = GFP_KERNEL; | ||
361 | |||
362 | /* Do not allocate from interrupt context */ | ||
363 | if (in_irq() || irqs_disabled()) | ||
364 | return; | ||
365 | /* | ||
366 | * Check unlocked. I does not matter when we have one more | ||
367 | * page in the pool. The bit lock avoids recursive pool | ||
368 | * allocations: | ||
369 | */ | ||
370 | if (pool_pages >= pool_size || test_and_set_bit_lock(0, &pool_refill)) | ||
371 | return; | ||
372 | |||
373 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
374 | /* | ||
375 | * We could do: | ||
376 | * gfp = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; | ||
377 | * but this fails on !PREEMPT kernels | ||
378 | */ | ||
379 | gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; | ||
380 | #endif | ||
381 | |||
382 | while (pool_pages < pool_size) { | ||
383 | p = alloc_pages(gfp, 0); | ||
384 | if (!p) { | ||
385 | pool_failed++; | ||
386 | break; | ||
387 | } | ||
388 | spin_lock_irq(&pgd_lock); | ||
389 | list_add(&p->lru, &page_pool); | ||
390 | pool_pages++; | ||
391 | spin_unlock_irq(&pgd_lock); | ||
392 | } | ||
393 | clear_bit_unlock(0, &pool_refill); | ||
394 | } | ||
395 | |||
396 | #define SHIFT_MB (20 - PAGE_SHIFT) | ||
397 | #define ROUND_MB_GB ((1 << 10) - 1) | ||
398 | #define SHIFT_MB_GB 10 | ||
399 | #define POOL_PAGES_PER_GB 16 | ||
400 | |||
401 | void __init cpa_init(void) | ||
402 | { | ||
403 | struct sysinfo si; | ||
404 | unsigned long gb; | ||
405 | |||
406 | si_meminfo(&si); | ||
407 | /* | ||
408 | * Calculate the number of pool pages: | ||
409 | * | ||
410 | * Convert totalram (nr of pages) to MiB and round to the next | ||
411 | * GiB. Shift MiB to Gib and multiply the result by | ||
412 | * POOL_PAGES_PER_GB: | ||
413 | */ | ||
414 | gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB; | ||
415 | pool_size = POOL_PAGES_PER_GB * gb; | ||
416 | pool_low = pool_size; | ||
417 | |||
418 | cpa_fill_pool(); | ||
419 | printk(KERN_DEBUG | ||
420 | "CPA: page pool initialized %lu of %lu pages preallocated\n", | ||
421 | pool_pages, pool_size); | ||
422 | } | ||
423 | |||
338 | static int split_large_page(pte_t *kpte, unsigned long address) | 424 | static int split_large_page(pte_t *kpte, unsigned long address) |
339 | { | 425 | { |
340 | unsigned long flags, pfn, pfninc = 1; | 426 | unsigned long flags, pfn, pfninc = 1; |
341 | gfp_t gfp_flags = GFP_KERNEL; | ||
342 | unsigned int i, level; | 427 | unsigned int i, level; |
343 | pte_t *pbase, *tmp; | 428 | pte_t *pbase, *tmp; |
344 | pgprot_t ref_prot; | 429 | pgprot_t ref_prot; |
345 | struct page *base; | 430 | struct page *base; |
346 | 431 | ||
347 | #ifdef CONFIG_DEBUG_PAGEALLOC | 432 | /* |
348 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; | 433 | * Get a page from the pool. The pool list is protected by the |
349 | #endif | 434 | * pgd_lock, which we have to take anyway for the split |
350 | base = alloc_pages(gfp_flags, 0); | 435 | * operation: |
351 | if (!base) | 436 | */ |
437 | spin_lock_irqsave(&pgd_lock, flags); | ||
438 | if (list_empty(&page_pool)) { | ||
439 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
352 | return -ENOMEM; | 440 | return -ENOMEM; |
441 | } | ||
442 | |||
443 | base = list_first_entry(&page_pool, struct page, lru); | ||
444 | list_del(&base->lru); | ||
445 | pool_pages--; | ||
446 | |||
447 | if (pool_pages < pool_low) | ||
448 | pool_low = pool_pages; | ||
353 | 449 | ||
354 | spin_lock_irqsave(&pgd_lock, flags); | ||
355 | /* | 450 | /* |
356 | * Check for races, another CPU might have split this page | 451 | * Check for races, another CPU might have split this page |
357 | * up for us already: | 452 | * up for us already: |
@@ -396,17 +491,24 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
396 | base = NULL; | 491 | base = NULL; |
397 | 492 | ||
398 | out_unlock: | 493 | out_unlock: |
494 | /* | ||
495 | * If we dropped out via the lookup_address check under | ||
496 | * pgd_lock then stick the page back into the pool: | ||
497 | */ | ||
498 | if (base) { | ||
499 | list_add(&base->lru, &page_pool); | ||
500 | pool_pages++; | ||
501 | } else | ||
502 | pool_used++; | ||
399 | spin_unlock_irqrestore(&pgd_lock, flags); | 503 | spin_unlock_irqrestore(&pgd_lock, flags); |
400 | 504 | ||
401 | if (base) | ||
402 | __free_pages(base, 0); | ||
403 | |||
404 | return 0; | 505 | return 0; |
405 | } | 506 | } |
406 | 507 | ||
407 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) | 508 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) |
408 | { | 509 | { |
409 | int level, do_split, err; | 510 | int do_split, err; |
511 | unsigned int level; | ||
410 | struct page *kpte_page; | 512 | struct page *kpte_page; |
411 | pte_t *kpte; | 513 | pte_t *kpte; |
412 | 514 | ||
@@ -598,7 +700,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, | |||
598 | * Check whether we really changed something: | 700 | * Check whether we really changed something: |
599 | */ | 701 | */ |
600 | if (!cpa.flushtlb) | 702 | if (!cpa.flushtlb) |
601 | return ret; | 703 | goto out; |
602 | 704 | ||
603 | /* | 705 | /* |
604 | * No need to flush, when we did not set any of the caching | 706 | * No need to flush, when we did not set any of the caching |
@@ -617,6 +719,8 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, | |||
617 | else | 719 | else |
618 | cpa_flush_all(cache); | 720 | cpa_flush_all(cache); |
619 | 721 | ||
722 | out: | ||
723 | cpa_fill_pool(); | ||
620 | return ret; | 724 | return ret; |
621 | } | 725 | } |
622 | 726 | ||
@@ -770,6 +874,12 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
770 | * but that can deadlock->flush only current cpu: | 874 | * but that can deadlock->flush only current cpu: |
771 | */ | 875 | */ |
772 | __flush_tlb_all(); | 876 | __flush_tlb_all(); |
877 | |||
878 | /* | ||
879 | * Try to refill the page pool here. We can do this only after | ||
880 | * the tlb flush. | ||
881 | */ | ||
882 | cpa_fill_pool(); | ||
773 | } | 883 | } |
774 | #endif | 884 | #endif |
775 | 885 | ||
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 52deabc72a6f..b7c67a187b6b 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -26,16 +26,37 @@ int pcibios_last_bus = -1; | |||
26 | unsigned long pirq_table_addr; | 26 | unsigned long pirq_table_addr; |
27 | struct pci_bus *pci_root_bus; | 27 | struct pci_bus *pci_root_bus; |
28 | struct pci_raw_ops *raw_pci_ops; | 28 | struct pci_raw_ops *raw_pci_ops; |
29 | struct pci_raw_ops *raw_pci_ext_ops; | ||
30 | |||
31 | int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
32 | int reg, int len, u32 *val) | ||
33 | { | ||
34 | if (reg < 256 && raw_pci_ops) | ||
35 | return raw_pci_ops->read(domain, bus, devfn, reg, len, val); | ||
36 | if (raw_pci_ext_ops) | ||
37 | return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val); | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
42 | int reg, int len, u32 val) | ||
43 | { | ||
44 | if (reg < 256 && raw_pci_ops) | ||
45 | return raw_pci_ops->write(domain, bus, devfn, reg, len, val); | ||
46 | if (raw_pci_ext_ops) | ||
47 | return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val); | ||
48 | return -EINVAL; | ||
49 | } | ||
29 | 50 | ||
30 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 51 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
31 | { | 52 | { |
32 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 53 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
33 | devfn, where, size, value); | 54 | devfn, where, size, value); |
34 | } | 55 | } |
35 | 56 | ||
36 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 57 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) |
37 | { | 58 | { |
38 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 59 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
39 | devfn, where, size, value); | 60 | devfn, where, size, value); |
40 | } | 61 | } |
41 | 62 | ||
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c index 431c9a51b157..42f3e4cad179 100644 --- a/arch/x86/pci/direct.c +++ b/arch/x86/pci/direct.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ | 14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ |
15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) | 15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) |
16 | 16 | ||
17 | int pci_conf1_read(unsigned int seg, unsigned int bus, | 17 | static int pci_conf1_read(unsigned int seg, unsigned int bus, |
18 | unsigned int devfn, int reg, int len, u32 *value) | 18 | unsigned int devfn, int reg, int len, u32 *value) |
19 | { | 19 | { |
20 | unsigned long flags; | 20 | unsigned long flags; |
@@ -45,7 +45,7 @@ int pci_conf1_read(unsigned int seg, unsigned int bus, | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | int pci_conf1_write(unsigned int seg, unsigned int bus, | 48 | static int pci_conf1_write(unsigned int seg, unsigned int bus, |
49 | unsigned int devfn, int reg, int len, u32 value) | 49 | unsigned int devfn, int reg, int len, u32 value) |
50 | { | 50 | { |
51 | unsigned long flags; | 51 | unsigned long flags; |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 74d30ff33c49..a5ef5f551373 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -215,7 +215,8 @@ static int quirk_aspm_offset[MAX_PCIEROOT << 3]; | |||
215 | 215 | ||
216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
217 | { | 217 | { |
218 | return raw_pci_ops->read(0, bus->number, devfn, where, size, value); | 218 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
219 | devfn, where, size, value); | ||
219 | } | 220 | } |
220 | 221 | ||
221 | /* | 222 | /* |
@@ -231,7 +232,8 @@ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int wh | |||
231 | if ((offset) && (where == offset)) | 232 | if ((offset) && (where == offset)) |
232 | value = value & 0xfffffffc; | 233 | value = value & 0xfffffffc; |
233 | 234 | ||
234 | return raw_pci_ops->write(0, bus->number, devfn, where, size, value); | 235 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
236 | devfn, where, size, value); | ||
235 | } | 237 | } |
236 | 238 | ||
237 | static struct pci_ops quirk_pcie_aspm_ops = { | 239 | static struct pci_ops quirk_pcie_aspm_ops = { |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index 5565d7016b75..e041ced0ce13 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -22,7 +22,7 @@ static void __devinit pcibios_fixup_peer_bridges(void) | |||
22 | if (pci_find_bus(0, n)) | 22 | if (pci_find_bus(0, n)) |
23 | continue; | 23 | continue; |
24 | for (devfn = 0; devfn < 256; devfn += 8) { | 24 | for (devfn = 0; devfn < 256; devfn += 8) { |
25 | if (!raw_pci_ops->read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && | 25 | if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && |
26 | l != 0x0000 && l != 0xffff) { | 26 | l != 0x0000 && l != 0xffff) { |
27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); | 27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); |
28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); | 28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); |
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 4df637e34f81..8d54df4dfaad 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -22,46 +22,13 @@ | |||
22 | #define MMCONFIG_APER_MIN (2 * 1024*1024) | 22 | #define MMCONFIG_APER_MIN (2 * 1024*1024) |
23 | #define MMCONFIG_APER_MAX (256 * 1024*1024) | 23 | #define MMCONFIG_APER_MAX (256 * 1024*1024) |
24 | 24 | ||
25 | DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); | ||
26 | |||
27 | /* Indicate if the mmcfg resources have been placed into the resource table. */ | 25 | /* Indicate if the mmcfg resources have been placed into the resource table. */ |
28 | static int __initdata pci_mmcfg_resources_inserted; | 26 | static int __initdata pci_mmcfg_resources_inserted; |
29 | 27 | ||
30 | /* K8 systems have some devices (typically in the builtin northbridge) | ||
31 | that are only accessible using type1 | ||
32 | Normally this can be expressed in the MCFG by not listing them | ||
33 | and assigning suitable _SEGs, but this isn't implemented in some BIOS. | ||
34 | Instead try to discover all devices on bus 0 that are unreachable using MM | ||
35 | and fallback for them. */ | ||
36 | static void __init unreachable_devices(void) | ||
37 | { | ||
38 | int i, bus; | ||
39 | /* Use the max bus number from ACPI here? */ | ||
40 | for (bus = 0; bus < PCI_MMCFG_MAX_CHECK_BUS; bus++) { | ||
41 | for (i = 0; i < 32; i++) { | ||
42 | unsigned int devfn = PCI_DEVFN(i, 0); | ||
43 | u32 val1, val2; | ||
44 | |||
45 | pci_conf1_read(0, bus, devfn, 0, 4, &val1); | ||
46 | if (val1 == 0xffffffff) | ||
47 | continue; | ||
48 | |||
49 | if (pci_mmcfg_arch_reachable(0, bus, devfn)) { | ||
50 | raw_pci_ops->read(0, bus, devfn, 0, 4, &val2); | ||
51 | if (val1 == val2) | ||
52 | continue; | ||
53 | } | ||
54 | set_bit(i + 32 * bus, pci_mmcfg_fallback_slots); | ||
55 | printk(KERN_NOTICE "PCI: No mmconfig possible on device" | ||
56 | " %02x:%02x\n", bus, i); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static const char __init *pci_mmcfg_e7520(void) | 28 | static const char __init *pci_mmcfg_e7520(void) |
62 | { | 29 | { |
63 | u32 win; | 30 | u32 win; |
64 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); | 31 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); |
65 | 32 | ||
66 | win = win & 0xf000; | 33 | win = win & 0xf000; |
67 | if(win == 0x0000 || win == 0xf000) | 34 | if(win == 0x0000 || win == 0xf000) |
@@ -86,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void) | |||
86 | 53 | ||
87 | pci_mmcfg_config_num = 1; | 54 | pci_mmcfg_config_num = 1; |
88 | 55 | ||
89 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); | 56 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); |
90 | 57 | ||
91 | /* Enable bit */ | 58 | /* Enable bit */ |
92 | if (!(pciexbar & 1)) | 59 | if (!(pciexbar & 1)) |
@@ -151,7 +118,7 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
151 | int i; | 118 | int i; |
152 | const char *name; | 119 | const char *name; |
153 | 120 | ||
154 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); | 121 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); |
155 | vendor = l & 0xffff; | 122 | vendor = l & 0xffff; |
156 | device = (l >> 16) & 0xffff; | 123 | device = (l >> 16) & 0xffff; |
157 | 124 | ||
@@ -270,8 +237,6 @@ void __init pci_mmcfg_init(int type) | |||
270 | return; | 237 | return; |
271 | 238 | ||
272 | if (pci_mmcfg_arch_init()) { | 239 | if (pci_mmcfg_arch_init()) { |
273 | if (type == 1) | ||
274 | unreachable_devices(); | ||
275 | if (known_bridge) | 240 | if (known_bridge) |
276 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); | 241 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); |
277 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 242 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c index 1bf5816d34c8..081816ada057 100644 --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c | |||
@@ -30,10 +30,6 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) | |||
30 | struct acpi_mcfg_allocation *cfg; | 30 | struct acpi_mcfg_allocation *cfg; |
31 | int cfg_num; | 31 | int cfg_num; |
32 | 32 | ||
33 | if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && | ||
34 | test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots)) | ||
35 | return 0; | ||
36 | |||
37 | for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { | 33 | for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { |
38 | cfg = &pci_mmcfg_config[cfg_num]; | 34 | cfg = &pci_mmcfg_config[cfg_num]; |
39 | if (cfg->pci_segment == seg && | 35 | if (cfg->pci_segment == seg && |
@@ -68,13 +64,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
68 | u32 base; | 64 | u32 base; |
69 | 65 | ||
70 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) { | 66 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) { |
71 | *value = -1; | 67 | err: *value = -1; |
72 | return -EINVAL; | 68 | return -EINVAL; |
73 | } | 69 | } |
74 | 70 | ||
75 | base = get_base_addr(seg, bus, devfn); | 71 | base = get_base_addr(seg, bus, devfn); |
76 | if (!base) | 72 | if (!base) |
77 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | 73 | goto err; |
78 | 74 | ||
79 | spin_lock_irqsave(&pci_config_lock, flags); | 75 | spin_lock_irqsave(&pci_config_lock, flags); |
80 | 76 | ||
@@ -107,7 +103,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
107 | 103 | ||
108 | base = get_base_addr(seg, bus, devfn); | 104 | base = get_base_addr(seg, bus, devfn); |
109 | if (!base) | 105 | if (!base) |
110 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | 106 | return -EINVAL; |
111 | 107 | ||
112 | spin_lock_irqsave(&pci_config_lock, flags); | 108 | spin_lock_irqsave(&pci_config_lock, flags); |
113 | 109 | ||
@@ -134,15 +130,9 @@ static struct pci_raw_ops pci_mmcfg = { | |||
134 | .write = pci_mmcfg_write, | 130 | .write = pci_mmcfg_write, |
135 | }; | 131 | }; |
136 | 132 | ||
137 | int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
138 | unsigned int devfn) | ||
139 | { | ||
140 | return get_base_addr(seg, bus, devfn) != 0; | ||
141 | } | ||
142 | |||
143 | int __init pci_mmcfg_arch_init(void) | 133 | int __init pci_mmcfg_arch_init(void) |
144 | { | 134 | { |
145 | printk(KERN_INFO "PCI: Using MMCONFIG\n"); | 135 | printk(KERN_INFO "PCI: Using MMCONFIG for extended config space\n"); |
146 | raw_pci_ops = &pci_mmcfg; | 136 | raw_pci_ext_ops = &pci_mmcfg; |
147 | return 1; | 137 | return 1; |
148 | } | 138 | } |
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 4095e4d66a1d..9207fd49233c 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
@@ -40,9 +40,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus) | |||
40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) | 40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) |
41 | { | 41 | { |
42 | char __iomem *addr; | 42 | char __iomem *addr; |
43 | if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && | 43 | |
44 | test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots)) | ||
45 | return NULL; | ||
46 | addr = get_virt(seg, bus); | 44 | addr = get_virt(seg, bus); |
47 | if (!addr) | 45 | if (!addr) |
48 | return NULL; | 46 | return NULL; |
@@ -56,13 +54,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
56 | 54 | ||
57 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ | 55 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ |
58 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { | 56 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { |
59 | *value = -1; | 57 | err: *value = -1; |
60 | return -EINVAL; | 58 | return -EINVAL; |
61 | } | 59 | } |
62 | 60 | ||
63 | addr = pci_dev_base(seg, bus, devfn); | 61 | addr = pci_dev_base(seg, bus, devfn); |
64 | if (!addr) | 62 | if (!addr) |
65 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | 63 | goto err; |
66 | 64 | ||
67 | switch (len) { | 65 | switch (len) { |
68 | case 1: | 66 | case 1: |
@@ -90,7 +88,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
90 | 88 | ||
91 | addr = pci_dev_base(seg, bus, devfn); | 89 | addr = pci_dev_base(seg, bus, devfn); |
92 | if (!addr) | 90 | if (!addr) |
93 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | 91 | return -EINVAL; |
94 | 92 | ||
95 | switch (len) { | 93 | switch (len) { |
96 | case 1: | 94 | case 1: |
@@ -126,12 +124,6 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) | |||
126 | return addr; | 124 | return addr; |
127 | } | 125 | } |
128 | 126 | ||
129 | int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
130 | unsigned int devfn) | ||
131 | { | ||
132 | return pci_dev_base(seg, bus, devfn) != NULL; | ||
133 | } | ||
134 | |||
135 | int __init pci_mmcfg_arch_init(void) | 127 | int __init pci_mmcfg_arch_init(void) |
136 | { | 128 | { |
137 | int i; | 129 | int i; |
@@ -152,6 +144,6 @@ int __init pci_mmcfg_arch_init(void) | |||
152 | return 0; | 144 | return 0; |
153 | } | 145 | } |
154 | } | 146 | } |
155 | raw_pci_ops = &pci_mmcfg; | 147 | raw_pci_ext_ops = &pci_mmcfg; |
156 | return 1; | 148 | return 1; |
157 | } | 149 | } |
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index ac56d3916c50..3431518d921a 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
@@ -85,10 +85,17 @@ extern spinlock_t pci_config_lock; | |||
85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); | 85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); |
86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); | 86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); |
87 | 87 | ||
88 | extern int pci_conf1_write(unsigned int seg, unsigned int bus, | 88 | struct pci_raw_ops { |
89 | unsigned int devfn, int reg, int len, u32 value); | 89 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, |
90 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, | 90 | int reg, int len, u32 *val); |
91 | unsigned int devfn, int reg, int len, u32 *value); | 91 | int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn, |
92 | int reg, int len, u32 val); | ||
93 | }; | ||
94 | |||
95 | extern struct pci_raw_ops *raw_pci_ops; | ||
96 | extern struct pci_raw_ops *raw_pci_ext_ops; | ||
97 | |||
98 | extern struct pci_raw_ops pci_direct_conf1; | ||
92 | 99 | ||
93 | extern int pci_direct_probe(void); | 100 | extern int pci_direct_probe(void); |
94 | extern void pci_direct_init(int type); | 101 | extern void pci_direct_init(int type); |
@@ -98,13 +105,6 @@ extern void pcibios_sort(void); | |||
98 | 105 | ||
99 | /* pci-mmconfig.c */ | 106 | /* pci-mmconfig.c */ |
100 | 107 | ||
101 | /* Verify the first 16 busses. We assume that systems with more busses | ||
102 | get MCFG right. */ | ||
103 | #define PCI_MMCFG_MAX_CHECK_BUS 16 | ||
104 | extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); | ||
105 | |||
106 | extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
107 | unsigned int devfn); | ||
108 | extern int __init pci_mmcfg_arch_init(void); | 108 | extern int __init pci_mmcfg_arch_init(void); |
109 | 109 | ||
110 | /* | 110 | /* |
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c index 8ecb1c722594..c2df4e97eed6 100644 --- a/arch/x86/pci/visws.c +++ b/arch/x86/pci/visws.c | |||
@@ -13,9 +13,6 @@ | |||
13 | 13 | ||
14 | #include "pci.h" | 14 | #include "pci.h" |
15 | 15 | ||
16 | |||
17 | extern struct pci_raw_ops pci_direct_conf1; | ||
18 | |||
19 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } | 16 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } |
20 | static void pci_visws_disable_irq(struct pci_dev *dev) { } | 17 | static void pci_visws_disable_irq(struct pci_dev *dev) { } |
21 | 18 | ||
diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile index d764ec950065..9ff4d5b55ad1 100644 --- a/arch/x86/power/Makefile +++ b/arch/x86/power/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-$(CONFIG_PM) += cpu.o | 1 | obj-$(CONFIG_PM_SLEEP) += cpu_$(BITS).o |
2 | obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o | 2 | obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o |
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu_32.c index efcf620d1439..7f9c6da04a4c 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu_32.c | |||
@@ -40,7 +40,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
40 | savesegment(ss, ctxt->ss); | 40 | savesegment(ss, ctxt->ss); |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * control registers | 43 | * control registers |
44 | */ | 44 | */ |
45 | ctxt->cr0 = read_cr0(); | 45 | ctxt->cr0 = read_cr0(); |
46 | ctxt->cr2 = read_cr2(); | 46 | ctxt->cr2 = read_cr2(); |
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/power/cpu_64.c index 7ac7130022f1..66bdfb591fd8 100644 --- a/arch/x86/kernel/suspend_64.c +++ b/arch/x86/power/cpu_64.c | |||
@@ -1,8 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * Suspend support specific for i386. | 2 | * Suspend and hibernation support for x86-64 |
3 | * | 3 | * |
4 | * Distribute under GPLv2 | 4 | * Distribute under GPLv2 |
5 | * | 5 | * |
6 | * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
6 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> | 7 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> |
7 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> | 8 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> |
8 | */ | 9 | */ |
@@ -14,9 +15,6 @@ | |||
14 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
15 | #include <asm/mtrr.h> | 16 | #include <asm/mtrr.h> |
16 | 17 | ||
17 | /* References to section boundaries */ | ||
18 | extern const void __nosave_begin, __nosave_end; | ||
19 | |||
20 | static void fix_processor_context(void); | 18 | static void fix_processor_context(void); |
21 | 19 | ||
22 | struct saved_context saved_context; | 20 | struct saved_context saved_context; |
@@ -63,7 +61,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
63 | mtrr_save_fixed_ranges(NULL); | 61 | mtrr_save_fixed_ranges(NULL); |
64 | 62 | ||
65 | /* | 63 | /* |
66 | * control registers | 64 | * control registers |
67 | */ | 65 | */ |
68 | rdmsrl(MSR_EFER, ctxt->efer); | 66 | rdmsrl(MSR_EFER, ctxt->efer); |
69 | ctxt->cr0 = read_cr0(); | 67 | ctxt->cr0 = read_cr0(); |
@@ -166,155 +164,3 @@ static void fix_processor_context(void) | |||
166 | loaddebug(¤t->thread, 7); | 164 | loaddebug(¤t->thread, 7); |
167 | } | 165 | } |
168 | } | 166 | } |
169 | |||
170 | #ifdef CONFIG_HIBERNATION | ||
171 | /* Defined in arch/x86_64/kernel/suspend_asm.S */ | ||
172 | extern int restore_image(void); | ||
173 | |||
174 | /* | ||
175 | * Address to jump to in the last phase of restore in order to get to the image | ||
176 | * kernel's text (this value is passed in the image header). | ||
177 | */ | ||
178 | unsigned long restore_jump_address; | ||
179 | |||
180 | /* | ||
181 | * Value of the cr3 register from before the hibernation (this value is passed | ||
182 | * in the image header). | ||
183 | */ | ||
184 | unsigned long restore_cr3; | ||
185 | |||
186 | pgd_t *temp_level4_pgt; | ||
187 | |||
188 | void *relocated_restore_code; | ||
189 | |||
190 | static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) | ||
191 | { | ||
192 | long i, j; | ||
193 | |||
194 | i = pud_index(address); | ||
195 | pud = pud + i; | ||
196 | for (; i < PTRS_PER_PUD; pud++, i++) { | ||
197 | unsigned long paddr; | ||
198 | pmd_t *pmd; | ||
199 | |||
200 | paddr = address + i*PUD_SIZE; | ||
201 | if (paddr >= end) | ||
202 | break; | ||
203 | |||
204 | pmd = (pmd_t *)get_safe_page(GFP_ATOMIC); | ||
205 | if (!pmd) | ||
206 | return -ENOMEM; | ||
207 | set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE)); | ||
208 | for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { | ||
209 | unsigned long pe; | ||
210 | |||
211 | if (paddr >= end) | ||
212 | break; | ||
213 | pe = __PAGE_KERNEL_LARGE_EXEC | paddr; | ||
214 | pe &= __supported_pte_mask; | ||
215 | set_pmd(pmd, __pmd(pe)); | ||
216 | } | ||
217 | } | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static int set_up_temporary_mappings(void) | ||
222 | { | ||
223 | unsigned long start, end, next; | ||
224 | int error; | ||
225 | |||
226 | temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); | ||
227 | if (!temp_level4_pgt) | ||
228 | return -ENOMEM; | ||
229 | |||
230 | /* It is safe to reuse the original kernel mapping */ | ||
231 | set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map), | ||
232 | init_level4_pgt[pgd_index(__START_KERNEL_map)]); | ||
233 | |||
234 | /* Set up the direct mapping from scratch */ | ||
235 | start = (unsigned long)pfn_to_kaddr(0); | ||
236 | end = (unsigned long)pfn_to_kaddr(end_pfn); | ||
237 | |||
238 | for (; start < end; start = next) { | ||
239 | pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); | ||
240 | if (!pud) | ||
241 | return -ENOMEM; | ||
242 | next = start + PGDIR_SIZE; | ||
243 | if (next > end) | ||
244 | next = end; | ||
245 | if ((error = res_phys_pud_init(pud, __pa(start), __pa(next)))) | ||
246 | return error; | ||
247 | set_pgd(temp_level4_pgt + pgd_index(start), | ||
248 | mk_kernel_pgd(__pa(pud))); | ||
249 | } | ||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | int swsusp_arch_resume(void) | ||
254 | { | ||
255 | int error; | ||
256 | |||
257 | /* We have got enough memory and from now on we cannot recover */ | ||
258 | if ((error = set_up_temporary_mappings())) | ||
259 | return error; | ||
260 | |||
261 | relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC); | ||
262 | if (!relocated_restore_code) | ||
263 | return -ENOMEM; | ||
264 | memcpy(relocated_restore_code, &core_restore_code, | ||
265 | &restore_registers - &core_restore_code); | ||
266 | |||
267 | restore_image(); | ||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | /* | ||
272 | * pfn_is_nosave - check if given pfn is in the 'nosave' section | ||
273 | */ | ||
274 | |||
275 | int pfn_is_nosave(unsigned long pfn) | ||
276 | { | ||
277 | unsigned long nosave_begin_pfn = __pa_symbol(&__nosave_begin) >> PAGE_SHIFT; | ||
278 | unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT; | ||
279 | return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); | ||
280 | } | ||
281 | |||
282 | struct restore_data_record { | ||
283 | unsigned long jump_address; | ||
284 | unsigned long cr3; | ||
285 | unsigned long magic; | ||
286 | }; | ||
287 | |||
288 | #define RESTORE_MAGIC 0x0123456789ABCDEFUL | ||
289 | |||
290 | /** | ||
291 | * arch_hibernation_header_save - populate the architecture specific part | ||
292 | * of a hibernation image header | ||
293 | * @addr: address to save the data at | ||
294 | */ | ||
295 | int arch_hibernation_header_save(void *addr, unsigned int max_size) | ||
296 | { | ||
297 | struct restore_data_record *rdr = addr; | ||
298 | |||
299 | if (max_size < sizeof(struct restore_data_record)) | ||
300 | return -EOVERFLOW; | ||
301 | rdr->jump_address = restore_jump_address; | ||
302 | rdr->cr3 = restore_cr3; | ||
303 | rdr->magic = RESTORE_MAGIC; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * arch_hibernation_header_restore - read the architecture specific data | ||
309 | * from the hibernation image header | ||
310 | * @addr: address to read the data from | ||
311 | */ | ||
312 | int arch_hibernation_header_restore(void *addr) | ||
313 | { | ||
314 | struct restore_data_record *rdr = addr; | ||
315 | |||
316 | restore_jump_address = rdr->jump_address; | ||
317 | restore_cr3 = rdr->cr3; | ||
318 | return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; | ||
319 | } | ||
320 | #endif /* CONFIG_HIBERNATION */ | ||
diff --git a/arch/x86/power/suspend.c b/arch/x86/power/hibernate_32.c index a0020b913f31..f2b6e3f11bfc 100644 --- a/arch/x86/power/suspend.c +++ b/arch/x86/power/hibernate_32.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Suspend support specific for i386 - temporary page tables | 2 | * Hibernation support specific for i386 - temporary page tables |
3 | * | 3 | * |
4 | * Distribute under GPLv2 | 4 | * Distribute under GPLv2 |
5 | * | 5 | * |
@@ -13,7 +13,7 @@ | |||
13 | #include <asm/page.h> | 13 | #include <asm/page.h> |
14 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
15 | 15 | ||
16 | /* Defined in arch/i386/power/swsusp.S */ | 16 | /* Defined in hibernate_asm_32.S */ |
17 | extern int restore_image(void); | 17 | extern int restore_image(void); |
18 | 18 | ||
19 | /* References to section boundaries */ | 19 | /* References to section boundaries */ |
@@ -23,7 +23,7 @@ extern const void __nosave_begin, __nosave_end; | |||
23 | pgd_t *resume_pg_dir; | 23 | pgd_t *resume_pg_dir; |
24 | 24 | ||
25 | /* The following three functions are based on the analogous code in | 25 | /* The following three functions are based on the analogous code in |
26 | * arch/i386/mm/init.c | 26 | * arch/x86/mm/init_32.c |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* | 29 | /* |
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c new file mode 100644 index 000000000000..b542355e0e34 --- /dev/null +++ b/arch/x86/power/hibernate_64.c | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | * Hibernation support for x86-64 | ||
3 | * | ||
4 | * Distribute under GPLv2 | ||
5 | * | ||
6 | * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
7 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> | ||
8 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> | ||
9 | */ | ||
10 | |||
11 | #include <linux/smp.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <asm/proto.h> | ||
14 | #include <asm/page.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/mtrr.h> | ||
17 | |||
18 | /* References to section boundaries */ | ||
19 | extern const void __nosave_begin, __nosave_end; | ||
20 | |||
21 | /* Defined in hibernate_asm_64.S */ | ||
22 | extern int restore_image(void); | ||
23 | |||
24 | /* | ||
25 | * Address to jump to in the last phase of restore in order to get to the image | ||
26 | * kernel's text (this value is passed in the image header). | ||
27 | */ | ||
28 | unsigned long restore_jump_address; | ||
29 | |||
30 | /* | ||
31 | * Value of the cr3 register from before the hibernation (this value is passed | ||
32 | * in the image header). | ||
33 | */ | ||
34 | unsigned long restore_cr3; | ||
35 | |||
36 | pgd_t *temp_level4_pgt; | ||
37 | |||
38 | void *relocated_restore_code; | ||
39 | |||
40 | static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) | ||
41 | { | ||
42 | long i, j; | ||
43 | |||
44 | i = pud_index(address); | ||
45 | pud = pud + i; | ||
46 | for (; i < PTRS_PER_PUD; pud++, i++) { | ||
47 | unsigned long paddr; | ||
48 | pmd_t *pmd; | ||
49 | |||
50 | paddr = address + i*PUD_SIZE; | ||
51 | if (paddr >= end) | ||
52 | break; | ||
53 | |||
54 | pmd = (pmd_t *)get_safe_page(GFP_ATOMIC); | ||
55 | if (!pmd) | ||
56 | return -ENOMEM; | ||
57 | set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE)); | ||
58 | for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { | ||
59 | unsigned long pe; | ||
60 | |||
61 | if (paddr >= end) | ||
62 | break; | ||
63 | pe = __PAGE_KERNEL_LARGE_EXEC | paddr; | ||
64 | pe &= __supported_pte_mask; | ||
65 | set_pmd(pmd, __pmd(pe)); | ||
66 | } | ||
67 | } | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int set_up_temporary_mappings(void) | ||
72 | { | ||
73 | unsigned long start, end, next; | ||
74 | int error; | ||
75 | |||
76 | temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); | ||
77 | if (!temp_level4_pgt) | ||
78 | return -ENOMEM; | ||
79 | |||
80 | /* It is safe to reuse the original kernel mapping */ | ||
81 | set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map), | ||
82 | init_level4_pgt[pgd_index(__START_KERNEL_map)]); | ||
83 | |||
84 | /* Set up the direct mapping from scratch */ | ||
85 | start = (unsigned long)pfn_to_kaddr(0); | ||
86 | end = (unsigned long)pfn_to_kaddr(end_pfn); | ||
87 | |||
88 | for (; start < end; start = next) { | ||
89 | pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); | ||
90 | if (!pud) | ||
91 | return -ENOMEM; | ||
92 | next = start + PGDIR_SIZE; | ||
93 | if (next > end) | ||
94 | next = end; | ||
95 | if ((error = res_phys_pud_init(pud, __pa(start), __pa(next)))) | ||
96 | return error; | ||
97 | set_pgd(temp_level4_pgt + pgd_index(start), | ||
98 | mk_kernel_pgd(__pa(pud))); | ||
99 | } | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | int swsusp_arch_resume(void) | ||
104 | { | ||
105 | int error; | ||
106 | |||
107 | /* We have got enough memory and from now on we cannot recover */ | ||
108 | if ((error = set_up_temporary_mappings())) | ||
109 | return error; | ||
110 | |||
111 | relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC); | ||
112 | if (!relocated_restore_code) | ||
113 | return -ENOMEM; | ||
114 | memcpy(relocated_restore_code, &core_restore_code, | ||
115 | &restore_registers - &core_restore_code); | ||
116 | |||
117 | restore_image(); | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * pfn_is_nosave - check if given pfn is in the 'nosave' section | ||
123 | */ | ||
124 | |||
125 | int pfn_is_nosave(unsigned long pfn) | ||
126 | { | ||
127 | unsigned long nosave_begin_pfn = __pa_symbol(&__nosave_begin) >> PAGE_SHIFT; | ||
128 | unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT; | ||
129 | return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); | ||
130 | } | ||
131 | |||
132 | struct restore_data_record { | ||
133 | unsigned long jump_address; | ||
134 | unsigned long cr3; | ||
135 | unsigned long magic; | ||
136 | }; | ||
137 | |||
138 | #define RESTORE_MAGIC 0x0123456789ABCDEFUL | ||
139 | |||
140 | /** | ||
141 | * arch_hibernation_header_save - populate the architecture specific part | ||
142 | * of a hibernation image header | ||
143 | * @addr: address to save the data at | ||
144 | */ | ||
145 | int arch_hibernation_header_save(void *addr, unsigned int max_size) | ||
146 | { | ||
147 | struct restore_data_record *rdr = addr; | ||
148 | |||
149 | if (max_size < sizeof(struct restore_data_record)) | ||
150 | return -EOVERFLOW; | ||
151 | rdr->jump_address = restore_jump_address; | ||
152 | rdr->cr3 = restore_cr3; | ||
153 | rdr->magic = RESTORE_MAGIC; | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * arch_hibernation_header_restore - read the architecture specific data | ||
159 | * from the hibernation image header | ||
160 | * @addr: address to read the data from | ||
161 | */ | ||
162 | int arch_hibernation_header_restore(void *addr) | ||
163 | { | ||
164 | struct restore_data_record *rdr = addr; | ||
165 | |||
166 | restore_jump_address = rdr->jump_address; | ||
167 | restore_cr3 = rdr->cr3; | ||
168 | return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; | ||
169 | } | ||
diff --git a/arch/x86/power/swsusp.S b/arch/x86/power/hibernate_asm_32.S index 53662e05b393..b95aa6cfe3cb 100644 --- a/arch/x86/power/swsusp.S +++ b/arch/x86/power/hibernate_asm_32.S | |||
@@ -1,7 +1,6 @@ | |||
1 | .text | 1 | .text |
2 | 2 | ||
3 | /* Originally gcc generated, modified by hand | 3 | /* |
4 | * | ||
5 | * This may not use any stack, nor any variable that is not "NoSave": | 4 | * This may not use any stack, nor any variable that is not "NoSave": |
6 | * | 5 | * |
7 | * Its rewriting one kernel image with another. What is stack in "old" | 6 | * Its rewriting one kernel image with another. What is stack in "old" |
diff --git a/arch/x86/kernel/suspend_asm_64.S b/arch/x86/power/hibernate_asm_64.S index aeb9a4d7681e..1deb3244b99b 100644 --- a/arch/x86/kernel/suspend_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S | |||
@@ -1,7 +1,12 @@ | |||
1 | /* Copyright 2004,2005 Pavel Machek <pavel@suse.cz>, Andi Kleen <ak@suse.de>, Rafael J. Wysocki <rjw@sisk.pl> | 1 | /* |
2 | * Hibernation support for x86-64 | ||
2 | * | 3 | * |
3 | * Distribute under GPLv2. | 4 | * Distribute under GPLv2. |
4 | * | 5 | * |
6 | * Copyright 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
7 | * Copyright 2005 Andi Kleen <ak@suse.de> | ||
8 | * Copyright 2004 Pavel Machek <pavel@suse.cz> | ||
9 | * | ||
5 | * swsusp_arch_resume must not use any stack or any nonlocal variables while | 10 | * swsusp_arch_resume must not use any stack or any nonlocal variables while |
6 | * copying pages: | 11 | * copying pages: |
7 | * | 12 | * |
@@ -9,7 +14,7 @@ | |||
9 | * image could very well be data page in "new" image, and overwriting | 14 | * image could very well be data page in "new" image, and overwriting |
10 | * your own stack under you is bad idea. | 15 | * your own stack under you is bad idea. |
11 | */ | 16 | */ |
12 | 17 | ||
13 | .text | 18 | .text |
14 | #include <linux/linkage.h> | 19 | #include <linux/linkage.h> |
15 | #include <asm/segment.h> | 20 | #include <asm/segment.h> |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 45aa771e73a9..0144395448ae 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | xmaddr_t arbitrary_virt_to_machine(unsigned long address) | 59 | xmaddr_t arbitrary_virt_to_machine(unsigned long address) |
60 | { | 60 | { |
61 | int level; | 61 | unsigned int level; |
62 | pte_t *pte = lookup_address(address, &level); | 62 | pte_t *pte = lookup_address(address, &level); |
63 | unsigned offset = address & PAGE_MASK; | 63 | unsigned offset = address & PAGE_MASK; |
64 | 64 | ||
@@ -71,7 +71,7 @@ void make_lowmem_page_readonly(void *vaddr) | |||
71 | { | 71 | { |
72 | pte_t *pte, ptev; | 72 | pte_t *pte, ptev; |
73 | unsigned long address = (unsigned long)vaddr; | 73 | unsigned long address = (unsigned long)vaddr; |
74 | int level; | 74 | unsigned int level; |
75 | 75 | ||
76 | pte = lookup_address(address, &level); | 76 | pte = lookup_address(address, &level); |
77 | BUG_ON(pte == NULL); | 77 | BUG_ON(pte == NULL); |
@@ -86,7 +86,7 @@ void make_lowmem_page_readwrite(void *vaddr) | |||
86 | { | 86 | { |
87 | pte_t *pte, ptev; | 87 | pte_t *pte, ptev; |
88 | unsigned long address = (unsigned long)vaddr; | 88 | unsigned long address = (unsigned long)vaddr; |
89 | int level; | 89 | unsigned int level; |
90 | 90 | ||
91 | pte = lookup_address(address, &level); | 91 | pte = lookup_address(address, &level); |
92 | BUG_ON(pte == NULL); | 92 | BUG_ON(pte == NULL); |
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index b3721fd6877b..c39e1a5aa241 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -217,17 +217,17 @@ unsigned long long xen_sched_clock(void) | |||
217 | /* Get the CPU speed from Xen */ | 217 | /* Get the CPU speed from Xen */ |
218 | unsigned long xen_cpu_khz(void) | 218 | unsigned long xen_cpu_khz(void) |
219 | { | 219 | { |
220 | u64 cpu_khz = 1000000ULL << 32; | 220 | u64 xen_khz = 1000000ULL << 32; |
221 | const struct vcpu_time_info *info = | 221 | const struct vcpu_time_info *info = |
222 | &HYPERVISOR_shared_info->vcpu_info[0].time; | 222 | &HYPERVISOR_shared_info->vcpu_info[0].time; |
223 | 223 | ||
224 | do_div(cpu_khz, info->tsc_to_system_mul); | 224 | do_div(xen_khz, info->tsc_to_system_mul); |
225 | if (info->tsc_shift < 0) | 225 | if (info->tsc_shift < 0) |
226 | cpu_khz <<= -info->tsc_shift; | 226 | xen_khz <<= -info->tsc_shift; |
227 | else | 227 | else |
228 | cpu_khz >>= info->tsc_shift; | 228 | xen_khz >>= info->tsc_shift; |
229 | 229 | ||
230 | return cpu_khz; | 230 | return xen_khz; |
231 | } | 231 | } |
232 | 232 | ||
233 | /* | 233 | /* |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index fd36764d7fb7..9fc8551a1cf6 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -14,6 +14,7 @@ config ZONE_DMA | |||
14 | config XTENSA | 14 | config XTENSA |
15 | bool | 15 | bool |
16 | default y | 16 | default y |
17 | select HAVE_IDE | ||
17 | help | 18 | help |
18 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 19 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
19 | primarily for embedded systems. These processors are both | 20 | primarily for embedded systems. These processors are both |