diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 169 | ||||
-rw-r--r-- | arch/x86/mach-rdc321x/gpio.c | 199 | ||||
-rw-r--r-- | arch/x86/mach-rdc321x/platform.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/fault.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/hugetlbpage.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 47 | ||||
-rw-r--r-- | arch/x86/xen/xen-asm.S | 9 |
7 files changed, 274 insertions, 157 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index d5904eef1d31..eb92ccbb3502 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -600,21 +600,6 @@ static int ptrace_bts_read_record(struct task_struct *child, | |||
600 | return sizeof(ret); | 600 | return sizeof(ret); |
601 | } | 601 | } |
602 | 602 | ||
603 | static int ptrace_bts_write_record(struct task_struct *child, | ||
604 | const struct bts_struct *in) | ||
605 | { | ||
606 | int retval; | ||
607 | |||
608 | if (!child->thread.ds_area_msr) | ||
609 | return -ENXIO; | ||
610 | |||
611 | retval = ds_write_bts((void *)child->thread.ds_area_msr, in); | ||
612 | if (retval) | ||
613 | return retval; | ||
614 | |||
615 | return sizeof(*in); | ||
616 | } | ||
617 | |||
618 | static int ptrace_bts_clear(struct task_struct *child) | 603 | static int ptrace_bts_clear(struct task_struct *child) |
619 | { | 604 | { |
620 | if (!child->thread.ds_area_msr) | 605 | if (!child->thread.ds_area_msr) |
@@ -657,75 +642,6 @@ static int ptrace_bts_drain(struct task_struct *child, | |||
657 | return end; | 642 | return end; |
658 | } | 643 | } |
659 | 644 | ||
660 | static int ptrace_bts_realloc(struct task_struct *child, | ||
661 | int size, int reduce_size) | ||
662 | { | ||
663 | unsigned long rlim, vm; | ||
664 | int ret, old_size; | ||
665 | |||
666 | if (size < 0) | ||
667 | return -EINVAL; | ||
668 | |||
669 | old_size = ds_get_bts_size((void *)child->thread.ds_area_msr); | ||
670 | if (old_size < 0) | ||
671 | return old_size; | ||
672 | |||
673 | ret = ds_free((void **)&child->thread.ds_area_msr); | ||
674 | if (ret < 0) | ||
675 | goto out; | ||
676 | |||
677 | size >>= PAGE_SHIFT; | ||
678 | old_size >>= PAGE_SHIFT; | ||
679 | |||
680 | current->mm->total_vm -= old_size; | ||
681 | current->mm->locked_vm -= old_size; | ||
682 | |||
683 | if (size == 0) | ||
684 | goto out; | ||
685 | |||
686 | rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; | ||
687 | vm = current->mm->total_vm + size; | ||
688 | if (rlim < vm) { | ||
689 | ret = -ENOMEM; | ||
690 | |||
691 | if (!reduce_size) | ||
692 | goto out; | ||
693 | |||
694 | size = rlim - current->mm->total_vm; | ||
695 | if (size <= 0) | ||
696 | goto out; | ||
697 | } | ||
698 | |||
699 | rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; | ||
700 | vm = current->mm->locked_vm + size; | ||
701 | if (rlim < vm) { | ||
702 | ret = -ENOMEM; | ||
703 | |||
704 | if (!reduce_size) | ||
705 | goto out; | ||
706 | |||
707 | size = rlim - current->mm->locked_vm; | ||
708 | if (size <= 0) | ||
709 | goto out; | ||
710 | } | ||
711 | |||
712 | ret = ds_allocate((void **)&child->thread.ds_area_msr, | ||
713 | size << PAGE_SHIFT); | ||
714 | if (ret < 0) | ||
715 | goto out; | ||
716 | |||
717 | current->mm->total_vm += size; | ||
718 | current->mm->locked_vm += size; | ||
719 | |||
720 | out: | ||
721 | if (child->thread.ds_area_msr) | ||
722 | set_tsk_thread_flag(child, TIF_DS_AREA_MSR); | ||
723 | else | ||
724 | clear_tsk_thread_flag(child, TIF_DS_AREA_MSR); | ||
725 | |||
726 | return ret; | ||
727 | } | ||
728 | |||
729 | static int ptrace_bts_config(struct task_struct *child, | 645 | static int ptrace_bts_config(struct task_struct *child, |
730 | long cfg_size, | 646 | long cfg_size, |
731 | const struct ptrace_bts_config __user *ucfg) | 647 | const struct ptrace_bts_config __user *ucfg) |
@@ -828,6 +744,91 @@ static int ptrace_bts_status(struct task_struct *child, | |||
828 | return sizeof(cfg); | 744 | return sizeof(cfg); |
829 | } | 745 | } |
830 | 746 | ||
747 | |||
748 | static int ptrace_bts_write_record(struct task_struct *child, | ||
749 | const struct bts_struct *in) | ||
750 | { | ||
751 | int retval; | ||
752 | |||
753 | if (!child->thread.ds_area_msr) | ||
754 | return -ENXIO; | ||
755 | |||
756 | retval = ds_write_bts((void *)child->thread.ds_area_msr, in); | ||
757 | if (retval) | ||
758 | return retval; | ||
759 | |||
760 | return sizeof(*in); | ||
761 | } | ||
762 | |||
763 | static int ptrace_bts_realloc(struct task_struct *child, | ||
764 | int size, int reduce_size) | ||
765 | { | ||
766 | unsigned long rlim, vm; | ||
767 | int ret, old_size; | ||
768 | |||
769 | if (size < 0) | ||
770 | return -EINVAL; | ||
771 | |||
772 | old_size = ds_get_bts_size((void *)child->thread.ds_area_msr); | ||
773 | if (old_size < 0) | ||
774 | return old_size; | ||
775 | |||
776 | ret = ds_free((void **)&child->thread.ds_area_msr); | ||
777 | if (ret < 0) | ||
778 | goto out; | ||
779 | |||
780 | size >>= PAGE_SHIFT; | ||
781 | old_size >>= PAGE_SHIFT; | ||
782 | |||
783 | current->mm->total_vm -= old_size; | ||
784 | current->mm->locked_vm -= old_size; | ||
785 | |||
786 | if (size == 0) | ||
787 | goto out; | ||
788 | |||
789 | rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; | ||
790 | vm = current->mm->total_vm + size; | ||
791 | if (rlim < vm) { | ||
792 | ret = -ENOMEM; | ||
793 | |||
794 | if (!reduce_size) | ||
795 | goto out; | ||
796 | |||
797 | size = rlim - current->mm->total_vm; | ||
798 | if (size <= 0) | ||
799 | goto out; | ||
800 | } | ||
801 | |||
802 | rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; | ||
803 | vm = current->mm->locked_vm + size; | ||
804 | if (rlim < vm) { | ||
805 | ret = -ENOMEM; | ||
806 | |||
807 | if (!reduce_size) | ||
808 | goto out; | ||
809 | |||
810 | size = rlim - current->mm->locked_vm; | ||
811 | if (size <= 0) | ||
812 | goto out; | ||
813 | } | ||
814 | |||
815 | ret = ds_allocate((void **)&child->thread.ds_area_msr, | ||
816 | size << PAGE_SHIFT); | ||
817 | if (ret < 0) | ||
818 | goto out; | ||
819 | |||
820 | current->mm->total_vm += size; | ||
821 | current->mm->locked_vm += size; | ||
822 | |||
823 | out: | ||
824 | if (child->thread.ds_area_msr) | ||
825 | set_tsk_thread_flag(child, TIF_DS_AREA_MSR); | ||
826 | else | ||
827 | clear_tsk_thread_flag(child, TIF_DS_AREA_MSR); | ||
828 | |||
829 | return ret; | ||
830 | } | ||
831 | |||
831 | void ptrace_bts_take_timestamp(struct task_struct *tsk, | 832 | void ptrace_bts_take_timestamp(struct task_struct *tsk, |
832 | enum bts_qualifier qualifier) | 833 | enum bts_qualifier qualifier) |
833 | { | 834 | { |
diff --git a/arch/x86/mach-rdc321x/gpio.c b/arch/x86/mach-rdc321x/gpio.c index 031269163bd6..247f33d3a407 100644 --- a/arch/x86/mach-rdc321x/gpio.c +++ b/arch/x86/mach-rdc321x/gpio.c | |||
@@ -1,91 +1,194 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007, OpenWrt.org, Florian Fainelli <florian@openwrt.org> | 2 | * GPIO support for RDC SoC R3210/R8610 |
3 | * RDC321x architecture specific GPIO support | 3 | * |
4 | * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org> | ||
5 | * Copyright (C) 2008, Volker Weiss <dev@tintuc.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
4 | * | 20 | * |
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | 21 | */ |
10 | 22 | ||
11 | #include <linux/autoconf.h> | 23 | |
12 | #include <linux/init.h> | 24 | #include <linux/spinlock.h> |
13 | #include <linux/io.h> | 25 | #include <linux/io.h> |
14 | #include <linux/types.h> | 26 | #include <linux/types.h> |
15 | #include <linux/module.h> | 27 | #include <linux/module.h> |
16 | #include <linux/delay.h> | ||
17 | 28 | ||
29 | #include <asm/gpio.h> | ||
18 | #include <asm/mach-rdc321x/rdc321x_defs.h> | 30 | #include <asm/mach-rdc321x/rdc321x_defs.h> |
19 | 31 | ||
20 | static inline int rdc_gpio_is_valid(unsigned gpio) | 32 | |
33 | /* spin lock to protect our private copy of GPIO data register plus | ||
34 | the access to PCI conf registers. */ | ||
35 | static DEFINE_SPINLOCK(gpio_lock); | ||
36 | |||
37 | /* copy of GPIO data registers */ | ||
38 | static u32 gpio_data_reg1; | ||
39 | static u32 gpio_data_reg2; | ||
40 | |||
41 | static u32 gpio_request_data[2]; | ||
42 | |||
43 | |||
44 | static inline void rdc321x_conf_write(unsigned addr, u32 value) | ||
21 | { | 45 | { |
22 | return (gpio <= RDC_MAX_GPIO); | 46 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); |
47 | outl(value, RDC3210_CFGREG_DATA); | ||
23 | } | 48 | } |
24 | 49 | ||
25 | static unsigned int rdc_gpio_read(unsigned gpio) | 50 | static inline void rdc321x_conf_or(unsigned addr, u32 value) |
26 | { | 51 | { |
27 | unsigned int val; | 52 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); |
28 | 53 | value |= inl(RDC3210_CFGREG_DATA); | |
29 | val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x84:0x48)); | 54 | outl(value, RDC3210_CFGREG_DATA); |
30 | outl(val, RDC3210_CFGREG_ADDR); | ||
31 | udelay(10); | ||
32 | val = inl(RDC3210_CFGREG_DATA); | ||
33 | val |= (0x1 << (gpio & 0x1F)); | ||
34 | outl(val, RDC3210_CFGREG_DATA); | ||
35 | udelay(10); | ||
36 | val = 0x80000000 | (7 << 11) | ((gpio&0x20?0x88:0x4C)); | ||
37 | outl(val, RDC3210_CFGREG_ADDR); | ||
38 | udelay(10); | ||
39 | val = inl(RDC3210_CFGREG_DATA); | ||
40 | |||
41 | return val; | ||
42 | } | 55 | } |
43 | 56 | ||
44 | static void rdc_gpio_write(unsigned int val) | 57 | static inline u32 rdc321x_conf_read(unsigned addr) |
45 | { | 58 | { |
46 | if (val) { | 59 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); |
47 | outl(val, RDC3210_CFGREG_DATA); | 60 | |
48 | udelay(10); | 61 | return inl(RDC3210_CFGREG_DATA); |
49 | } | ||
50 | } | 62 | } |
51 | 63 | ||
52 | int rdc_gpio_get_value(unsigned gpio) | 64 | /* configure pin as GPIO */ |
65 | static void rdc321x_configure_gpio(unsigned gpio) | ||
66 | { | ||
67 | unsigned long flags; | ||
68 | |||
69 | spin_lock_irqsave(&gpio_lock, flags); | ||
70 | rdc321x_conf_or(gpio < 32 | ||
71 | ? RDC321X_GPIO_CTRL_REG1 : RDC321X_GPIO_CTRL_REG2, | ||
72 | 1 << (gpio & 0x1f)); | ||
73 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
74 | } | ||
75 | |||
76 | /* initially setup the 2 copies of the gpio data registers. | ||
77 | This function must be called by the platform setup code. */ | ||
78 | void __init rdc321x_gpio_setup() | ||
79 | { | ||
80 | /* this might not be, what others (BIOS, bootloader, etc.) | ||
81 | wrote to these registers before, but it's a good guess. Still | ||
82 | better than just using 0xffffffff. */ | ||
83 | |||
84 | gpio_data_reg1 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG1); | ||
85 | gpio_data_reg2 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG2); | ||
86 | } | ||
87 | |||
88 | /* determine, if gpio number is valid */ | ||
89 | static inline int rdc321x_is_gpio(unsigned gpio) | ||
90 | { | ||
91 | return gpio <= RDC321X_MAX_GPIO; | ||
92 | } | ||
93 | |||
94 | /* request GPIO */ | ||
95 | int rdc_gpio_request(unsigned gpio, const char *label) | ||
53 | { | 96 | { |
54 | if (rdc_gpio_is_valid(gpio)) | 97 | unsigned long flags; |
55 | return (int)rdc_gpio_read(gpio); | 98 | |
56 | else | 99 | if (!rdc321x_is_gpio(gpio)) |
57 | return -EINVAL; | 100 | return -EINVAL; |
101 | |||
102 | spin_lock_irqsave(&gpio_lock, flags); | ||
103 | if (gpio_request_data[(gpio & 0x20) ? 1 : 0] & (1 << (gpio & 0x1f))) | ||
104 | goto inuse; | ||
105 | gpio_request_data[(gpio & 0x20) ? 1 : 0] |= (1 << (gpio & 0x1f)); | ||
106 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
107 | |||
108 | return 0; | ||
109 | inuse: | ||
110 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
111 | return -EINVAL; | ||
58 | } | 112 | } |
59 | EXPORT_SYMBOL(rdc_gpio_get_value); | 113 | EXPORT_SYMBOL(rdc_gpio_request); |
60 | 114 | ||
61 | void rdc_gpio_set_value(unsigned gpio, int value) | 115 | /* release previously-claimed GPIO */ |
116 | void rdc_gpio_free(unsigned gpio) | ||
62 | { | 117 | { |
63 | unsigned int val; | 118 | unsigned long flags; |
64 | 119 | ||
65 | if (!rdc_gpio_is_valid(gpio)) | 120 | if (!rdc321x_is_gpio(gpio)) |
66 | return; | 121 | return; |
67 | 122 | ||
68 | val = rdc_gpio_read(gpio); | 123 | spin_lock_irqsave(&gpio_lock, flags); |
124 | gpio_request_data[(gpio & 0x20) ? 1 : 0] &= ~(1 << (gpio & 0x1f)); | ||
125 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
126 | } | ||
127 | EXPORT_SYMBOL(rdc_gpio_free); | ||
128 | |||
129 | /* read GPIO pin */ | ||
130 | int rdc_gpio_get_value(unsigned gpio) | ||
131 | { | ||
132 | u32 reg; | ||
133 | unsigned long flags; | ||
134 | |||
135 | spin_lock_irqsave(&gpio_lock, flags); | ||
136 | reg = rdc321x_conf_read(gpio < 32 | ||
137 | ? RDC321X_GPIO_DATA_REG1 : RDC321X_GPIO_DATA_REG2); | ||
138 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
69 | 139 | ||
70 | if (value) | 140 | return (1 << (gpio & 0x1f)) & reg ? 1 : 0; |
71 | val &= ~(0x1 << (gpio & 0x1F)); | 141 | } |
72 | else | 142 | EXPORT_SYMBOL(rdc_gpio_get_value); |
73 | val |= (0x1 << (gpio & 0x1F)); | ||
74 | 143 | ||
75 | rdc_gpio_write(val); | 144 | /* set GPIO pin to value */ |
145 | void rdc_gpio_set_value(unsigned gpio, int value) | ||
146 | { | ||
147 | unsigned long flags; | ||
148 | u32 reg; | ||
149 | |||
150 | reg = 1 << (gpio & 0x1f); | ||
151 | if (gpio < 32) { | ||
152 | spin_lock_irqsave(&gpio_lock, flags); | ||
153 | if (value) | ||
154 | gpio_data_reg1 |= reg; | ||
155 | else | ||
156 | gpio_data_reg1 &= ~reg; | ||
157 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG1, gpio_data_reg1); | ||
158 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
159 | } else { | ||
160 | spin_lock_irqsave(&gpio_lock, flags); | ||
161 | if (value) | ||
162 | gpio_data_reg2 |= reg; | ||
163 | else | ||
164 | gpio_data_reg2 &= ~reg; | ||
165 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG2, gpio_data_reg2); | ||
166 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
167 | } | ||
76 | } | 168 | } |
77 | EXPORT_SYMBOL(rdc_gpio_set_value); | 169 | EXPORT_SYMBOL(rdc_gpio_set_value); |
78 | 170 | ||
171 | /* configure GPIO pin as input */ | ||
79 | int rdc_gpio_direction_input(unsigned gpio) | 172 | int rdc_gpio_direction_input(unsigned gpio) |
80 | { | 173 | { |
174 | if (!rdc321x_is_gpio(gpio)) | ||
175 | return -EINVAL; | ||
176 | |||
177 | rdc321x_configure_gpio(gpio); | ||
178 | |||
81 | return 0; | 179 | return 0; |
82 | } | 180 | } |
83 | EXPORT_SYMBOL(rdc_gpio_direction_input); | 181 | EXPORT_SYMBOL(rdc_gpio_direction_input); |
84 | 182 | ||
183 | /* configure GPIO pin as output and set value */ | ||
85 | int rdc_gpio_direction_output(unsigned gpio, int value) | 184 | int rdc_gpio_direction_output(unsigned gpio, int value) |
86 | { | 185 | { |
186 | if (!rdc321x_is_gpio(gpio)) | ||
187 | return -EINVAL; | ||
188 | |||
189 | gpio_set_value(gpio, value); | ||
190 | rdc321x_configure_gpio(gpio); | ||
191 | |||
87 | return 0; | 192 | return 0; |
88 | } | 193 | } |
89 | EXPORT_SYMBOL(rdc_gpio_direction_output); | 194 | EXPORT_SYMBOL(rdc_gpio_direction_output); |
90 | |||
91 | |||
diff --git a/arch/x86/mach-rdc321x/platform.c b/arch/x86/mach-rdc321x/platform.c index dda6024a5862..a037041817c7 100644 --- a/arch/x86/mach-rdc321x/platform.c +++ b/arch/x86/mach-rdc321x/platform.c | |||
@@ -62,6 +62,8 @@ static struct platform_device *rdc321x_devs[] = { | |||
62 | 62 | ||
63 | static int __init rdc_board_setup(void) | 63 | static int __init rdc_board_setup(void) |
64 | { | 64 | { |
65 | rdc321x_gpio_setup(); | ||
66 | |||
65 | return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); | 67 | return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); |
66 | } | 68 | } |
67 | 69 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index fdc667422df9..c0c82bc143c9 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -92,7 +92,8 @@ static int is_prefetch(struct pt_regs *regs, unsigned long addr, | |||
92 | unsigned char *max_instr; | 92 | unsigned char *max_instr; |
93 | 93 | ||
94 | #ifdef CONFIG_X86_32 | 94 | #ifdef CONFIG_X86_32 |
95 | if (!(__supported_pte_mask & _PAGE_NX)) | 95 | /* Catch an obscure case of prefetch inside an NX page: */ |
96 | if ((__supported_pte_mask & _PAGE_NX) && (error_code & 16)) | ||
96 | return 0; | 97 | return 0; |
97 | #endif | 98 | #endif |
98 | 99 | ||
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 4fbafb4bc2f0..0b3d567e686d 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c | |||
@@ -178,7 +178,7 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) | |||
178 | 178 | ||
179 | page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)]; | 179 | page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)]; |
180 | 180 | ||
181 | WARN_ON(!PageCompound(page)); | 181 | WARN_ON(!PageHead(page)); |
182 | 182 | ||
183 | return page; | 183 | return page; |
184 | } | 184 | } |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 8b9ee27805fd..de4e6f05840b 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -95,7 +95,7 @@ struct shared_info *HYPERVISOR_shared_info = (void *)&dummy_shared_info; | |||
95 | * | 95 | * |
96 | * 0: not available, 1: available | 96 | * 0: not available, 1: available |
97 | */ | 97 | */ |
98 | static int have_vcpu_info_placement = 0; | 98 | static int have_vcpu_info_placement = 1; |
99 | 99 | ||
100 | static void __init xen_vcpu_setup(int cpu) | 100 | static void __init xen_vcpu_setup(int cpu) |
101 | { | 101 | { |
@@ -103,6 +103,7 @@ static void __init xen_vcpu_setup(int cpu) | |||
103 | int err; | 103 | int err; |
104 | struct vcpu_info *vcpup; | 104 | struct vcpu_info *vcpup; |
105 | 105 | ||
106 | BUG_ON(HYPERVISOR_shared_info == &dummy_shared_info); | ||
106 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; | 107 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; |
107 | 108 | ||
108 | if (!have_vcpu_info_placement) | 109 | if (!have_vcpu_info_placement) |
@@ -805,33 +806,43 @@ static __init void xen_pagetable_setup_start(pgd_t *base) | |||
805 | PFN_DOWN(__pa(xen_start_info->pt_base))); | 806 | PFN_DOWN(__pa(xen_start_info->pt_base))); |
806 | } | 807 | } |
807 | 808 | ||
808 | static __init void xen_pagetable_setup_done(pgd_t *base) | 809 | static __init void setup_shared_info(void) |
809 | { | 810 | { |
810 | /* This will work as long as patching hasn't happened yet | ||
811 | (which it hasn't) */ | ||
812 | pv_mmu_ops.alloc_pt = xen_alloc_pt; | ||
813 | pv_mmu_ops.alloc_pd = xen_alloc_pd; | ||
814 | pv_mmu_ops.release_pt = xen_release_pt; | ||
815 | pv_mmu_ops.release_pd = xen_release_pt; | ||
816 | pv_mmu_ops.set_pte = xen_set_pte; | ||
817 | |||
818 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 811 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
812 | unsigned long addr = fix_to_virt(FIX_PARAVIRT_BOOTMAP); | ||
813 | |||
819 | /* | 814 | /* |
820 | * Create a mapping for the shared info page. | 815 | * Create a mapping for the shared info page. |
821 | * Should be set_fixmap(), but shared_info is a machine | 816 | * Should be set_fixmap(), but shared_info is a machine |
822 | * address with no corresponding pseudo-phys address. | 817 | * address with no corresponding pseudo-phys address. |
823 | */ | 818 | */ |
824 | set_pte_mfn(fix_to_virt(FIX_PARAVIRT_BOOTMAP), | 819 | set_pte_mfn(addr, |
825 | PFN_DOWN(xen_start_info->shared_info), | 820 | PFN_DOWN(xen_start_info->shared_info), |
826 | PAGE_KERNEL); | 821 | PAGE_KERNEL); |
827 | 822 | ||
828 | HYPERVISOR_shared_info = | 823 | HYPERVISOR_shared_info = (struct shared_info *)addr; |
829 | (struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP); | ||
830 | |||
831 | } else | 824 | } else |
832 | HYPERVISOR_shared_info = | 825 | HYPERVISOR_shared_info = |
833 | (struct shared_info *)__va(xen_start_info->shared_info); | 826 | (struct shared_info *)__va(xen_start_info->shared_info); |
834 | 827 | ||
828 | #ifndef CONFIG_SMP | ||
829 | /* In UP this is as good a place as any to set up shared info */ | ||
830 | xen_setup_vcpu_info_placement(); | ||
831 | #endif | ||
832 | } | ||
833 | |||
834 | static __init void xen_pagetable_setup_done(pgd_t *base) | ||
835 | { | ||
836 | /* This will work as long as patching hasn't happened yet | ||
837 | (which it hasn't) */ | ||
838 | pv_mmu_ops.alloc_pt = xen_alloc_pt; | ||
839 | pv_mmu_ops.alloc_pd = xen_alloc_pd; | ||
840 | pv_mmu_ops.release_pt = xen_release_pt; | ||
841 | pv_mmu_ops.release_pd = xen_release_pt; | ||
842 | pv_mmu_ops.set_pte = xen_set_pte; | ||
843 | |||
844 | setup_shared_info(); | ||
845 | |||
835 | /* Actually pin the pagetable down, but we can't set PG_pinned | 846 | /* Actually pin the pagetable down, but we can't set PG_pinned |
836 | yet because the page structures don't exist yet. */ | 847 | yet because the page structures don't exist yet. */ |
837 | { | 848 | { |
@@ -1182,15 +1193,9 @@ asmlinkage void __init xen_start_kernel(void) | |||
1182 | x86_write_percpu(xen_cr3, __pa(pgd)); | 1193 | x86_write_percpu(xen_cr3, __pa(pgd)); |
1183 | x86_write_percpu(xen_current_cr3, __pa(pgd)); | 1194 | x86_write_percpu(xen_current_cr3, __pa(pgd)); |
1184 | 1195 | ||
1185 | #ifdef CONFIG_SMP | ||
1186 | /* Don't do the full vcpu_info placement stuff until we have a | 1196 | /* Don't do the full vcpu_info placement stuff until we have a |
1187 | possible map. */ | 1197 | possible map and a non-dummy shared_info. */ |
1188 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | 1198 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; |
1189 | #else | ||
1190 | /* May as well do it now, since there's no good time to call | ||
1191 | it later on UP. */ | ||
1192 | xen_setup_vcpu_info_placement(); | ||
1193 | #endif | ||
1194 | 1199 | ||
1195 | pv_info.kernel_rpl = 1; | 1200 | pv_info.kernel_rpl = 1; |
1196 | if (xen_feature(XENFEAT_supervisor_mode_kernel)) | 1201 | if (xen_feature(XENFEAT_supervisor_mode_kernel)) |
diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S index 1a43b60c0c62..6b7190449d07 100644 --- a/arch/x86/xen/xen-asm.S +++ b/arch/x86/xen/xen-asm.S | |||
@@ -33,12 +33,17 @@ | |||
33 | events, then enter the hypervisor to get them handled. | 33 | events, then enter the hypervisor to get them handled. |
34 | */ | 34 | */ |
35 | ENTRY(xen_irq_enable_direct) | 35 | ENTRY(xen_irq_enable_direct) |
36 | /* Clear mask and test pending */ | 36 | /* Unmask events */ |
37 | andw $0x00ff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending | 37 | movb $0, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask |
38 | |||
38 | /* Preempt here doesn't matter because that will deal with | 39 | /* Preempt here doesn't matter because that will deal with |
39 | any pending interrupts. The pending check may end up being | 40 | any pending interrupts. The pending check may end up being |
40 | run on the wrong CPU, but that doesn't hurt. */ | 41 | run on the wrong CPU, but that doesn't hurt. */ |
42 | |||
43 | /* Test for pending */ | ||
44 | testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending | ||
41 | jz 1f | 45 | jz 1f |
46 | |||
42 | 2: call check_events | 47 | 2: call check_events |
43 | 1: | 48 | 1: |
44 | ENDPATCH(xen_irq_enable_direct) | 49 | ENDPATCH(xen_irq_enable_direct) |