* Patch from LKML
@ 2008-07-15 18:38 Zachary Amsden
2008-07-15 18:51 ` [PATCH] x86: let 32bit use apic_ops too - fix Suresh Siddha
2008-07-15 18:52 ` Patch from LKML Yinghai Lu
0 siblings, 2 replies; 19+ messages in thread
From: Zachary Amsden @ 2008-07-15 18:38 UTC (permalink / raw)
To: suresh.b.siddha, yhlu.kernel, Chris Wright, Jeremy Fitzhardinge,
Rusty Russell, virtualization, Linux Kernel Mailing List
> On Tue, Jul 15, 2008 at 10:33 AM, Suresh Siddha
> <suresh.b.siddha@intel.com> wrote:
> > On Sun, Jul 13, 2008 at 10:19:35PM -0700, Yinghai Lu wrote:
> >>
> >> fix for pv.
> >>
> >> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> >>
> >> ---
> >> arch/x86/kernel/paravirt.c | 5 ----
> >> arch/x86/kernel/vmi_32.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
> >> arch/x86/xen/enlighten.c | 19 +++++++---------
> >> include/asm-x86/paravirt.h | 29 -------------------------
> >> 4 files changed, 57 insertions(+), 47 deletions(-)
> >>
> >> Index: linux-2.6/arch/x86/kernel/paravirt.c
> >> ===================================================================
> >> --- linux-2.6.orig/arch/x86/kernel/paravirt.c
> >> +++ linux-2.6/arch/x86/kernel/paravirt.c
> >> @@ -373,11 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = {
> >>
> >> struct pv_apic_ops pv_apic_ops = {
> >> #ifdef CONFIG_X86_LOCAL_APIC
> >> -#ifndef CONFIG_X86_64
> >> - .apic_write = native_apic_mem_write,
> >> - .apic_write_atomic = native_apic_mem_write_atomic,
> >> - .apic_read = native_apic_mem_read,
> >> -#endif
> >> .setup_boot_clock = setup_boot_APIC_clock,
> >> .setup_secondary_clock = setup_secondary_APIC_clock,
> >> .startup_ipi_hook = paravirt_nop,
> >> Index: linux-2.6/arch/x86/kernel/vmi_32.c
> >> ===================================================================
> >> --- linux-2.6.orig/arch/x86/kernel/vmi_32.c
> >> +++ linux-2.6/arch/x86/kernel/vmi_32.c
> >> @@ -676,6 +676,50 @@ static inline int __init probe_vmi_rom(v
> >> return 0;
> >> }
> >>
> >> +#ifdef CONFIG_X86_LOCAL_APIC
> >> +static u32 vmi_apic_read(u32 reg)
> >> +{
> >> + return 0;
> >> +}
> >> +
> >> +static void vmi_apic_write(u32 reg, u32 val)
> >> +{
> >> + /* Warn to see if there's any stray references */
> >> + WARN_ON(1);
> >> +}
> >> +
> >> +static u64 vmi_apic_icr_read(void)
> >> +{
> >> + return 0;
> >> +}
> >> +
> >> +static void vmi_apic_icr_write(u32 low, u32 id)
> >> +{
> >> + /* Warn to see if there's any stray references */
> >> + WARN_ON(1);
> >> +}
> >> +
> >> +static void vmi_apic_wait_icr_idle(void)
> >> +{
> >> + return;
> >> +}
> >> +
> >> +static u32 vmi_safe_apic_wait_icr_idle(void)
> >> +{
> >> + return 0;
> >> +}
> >> +
> >> +static struct apic_ops vmi_basic_apic_ops = {
> >> + .read = vmi_apic_read,
> >> + .write = vmi_apic_write,
> >> + .write_atomic = vmi_apic_write,
> >> + .icr_read = vmi_apic_icr_read,
> >> + .icr_write = vmi_apic_icr_write,
> >> + .wait_icr_idle = vmi_apic_wait_icr_idle,
> >> + .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
> >> +};
> >> +#endif
> >> +
> >> /*
> >> * VMI setup common to all processors
> >> */
> >> @@ -904,9 +948,10 @@ static inline int __init activate_vmi(vo
> >> #endif
> >>
> >> #ifdef CONFIG_X86_LOCAL_APIC
> >> - para_fill(pv_apic_ops.apic_read, APICRead);
> >> - para_fill(pv_apic_ops.apic_write, APICWrite);
> >> - para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
> >> + para_fill(vmi_basic_apic_ops.read, APICRead);
> >> + para_fill(vmi_basic_apic_ops.write, APICWrite);
> >> + para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
> >> + apic_ops = &vmi_basic_apic_ops;
> >
> > Yinghai, Looking more closely at this, based on my understanding this might be
> > wrong for VMI. Correct patch should be as follows. Any comments?
>
> so you mean icr related will still use default native member?
>
> YH
Nacked-by: Zachary Amsden <zach@vmware.com>
What are you doing here and why aren't you cc-ing the maintainers?
Thanks,
Zach
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 18:38 Patch from LKML Zachary Amsden
@ 2008-07-15 18:51 ` Suresh Siddha
2008-07-15 19:04 ` Zachary Amsden
2008-07-15 19:22 ` Yinghai Lu
2008-07-15 18:52 ` Patch from LKML Yinghai Lu
1 sibling, 2 replies; 19+ messages in thread
From: Suresh Siddha @ 2008-07-15 18:51 UTC (permalink / raw)
To: Zachary Amsden
Cc: Siddha, Suresh B, yhlu.kernel, Chris Wright, Jeremy Fitzhardinge,
Rusty Russell, virtualization, Linux Kernel Mailing List
On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
>
> Nacked-by: Zachary Amsden <zach@vmware.com>
>
> What are you doing here and why aren't you cc-ing the maintainers?
Sorry. I was about to bring you into the loop.
Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
for VMI case aswell.
Based on my understanding, tip/x86/x2apic git commit
94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
something like
http://marc.info/?l=linux-kernel&m=121614328831237&w=2
Can you please check and Ack/Nack this fix?
thanks,
suresh
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 18:51 ` [PATCH] x86: let 32bit use apic_ops too - fix Suresh Siddha
@ 2008-07-15 19:04 ` Zachary Amsden
2008-07-15 19:10 ` Yinghai Lu
2008-07-15 19:22 ` Yinghai Lu
1 sibling, 1 reply; 19+ messages in thread
From: Zachary Amsden @ 2008-07-15 19:04 UTC (permalink / raw)
To: Suresh Siddha
Cc: yhlu.kernel, Chris Wright, Jeremy Fitzhardinge, Rusty Russell,
virtualization, Linux Kernel Mailing List
On Tue, 2008-07-15 at 11:51 -0700, Suresh Siddha wrote:
> On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
> >
> > Nacked-by: Zachary Amsden <zach@vmware.com>
> >
> > What are you doing here and why aren't you cc-ing the maintainers?
>
> Sorry. I was about to bring you into the loop.
>
> Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
> is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
> for VMI case aswell.
>
> Based on my understanding, tip/x86/x2apic git commit
> 94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
> something like
> http://marc.info/?l=linux-kernel&m=121614328831237&w=2
Looks better, but I need to read more context to find out where the
apic_ops variable comes from; I'll read the list for patches.
You are correct in that we will want to use the same wait_icr_idle
routine as native hardware; it's not clear from just this patch how that
happens.
Also, the VMI operations are sensitive to parameter order because they
interface with an ABI at the other end. I need to check the parameter
order for apic read / write is still consistent with the ABI.
Zach
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 19:04 ` Zachary Amsden
@ 2008-07-15 19:10 ` Yinghai Lu
2008-07-15 19:19 ` Zachary Amsden
0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-15 19:10 UTC (permalink / raw)
To: Zachary Amsden
Cc: Suresh Siddha, Chris Wright, Jeremy Fitzhardinge, Rusty Russell,
virtualization, Linux Kernel Mailing List
On Tue, Jul 15, 2008 at 12:04 PM, Zachary Amsden <zach@vmware.com> wrote:
> On Tue, 2008-07-15 at 11:51 -0700, Suresh Siddha wrote:
>> On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
>> >
>> > Nacked-by: Zachary Amsden <zach@vmware.com>
>> >
>> > What are you doing here and why aren't you cc-ing the maintainers?
>>
>> Sorry. I was about to bring you into the loop.
>>
>> Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
>> is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
>> for VMI case aswell.
>>
>> Based on my understanding, tip/x86/x2apic git commit
>> 94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
>> something like
>> http://marc.info/?l=linux-kernel&m=121614328831237&w=2
>
> Looks better, but I need to read more context to find out where the
> apic_ops variable comes from; I'll read the list for patches.
>
> You are correct in that we will want to use the same wait_icr_idle
> routine as native hardware; it's not clear from just this patch how that
> happens.
>
> Also, the VMI operations are sensitive to parameter order because they
> interface with an ABI at the other end. I need to check the parameter
> order for apic read / write is still consistent with the ABI.
http://people.redhat.com/mingo/tip.git/readme.txt
mkdir linux-2.6
cd linux-2.6
git init
git remote add linus
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git remote add tip
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
git remote update
git checkout -b tip-latest tip/master
git merge tip/x86/x2apic
YH
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 19:10 ` Yinghai Lu
@ 2008-07-15 19:19 ` Zachary Amsden
0 siblings, 0 replies; 19+ messages in thread
From: Zachary Amsden @ 2008-07-15 19:19 UTC (permalink / raw)
To: Yinghai Lu
Cc: Suresh Siddha, Chris Wright, Jeremy Fitzhardinge, Rusty Russell,
virtualization, Linux Kernel Mailing List
On Tue, 2008-07-15 at 12:10 -0700, Yinghai Lu wrote:
> On Tue, Jul 15, 2008 at 12:04 PM, Zachary Amsden <zach@vmware.com> wrote:
> > On Tue, 2008-07-15 at 11:51 -0700, Suresh Siddha wrote:
> >> On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
> >> >
> >> > Nacked-by: Zachary Amsden <zach@vmware.com>
> >> >
> >> > What are you doing here and why aren't you cc-ing the maintainers?
> >>
> >> Sorry. I was about to bring you into the loop.
> >>
> >> Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
> >> is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
> >> for VMI case aswell.
> >>
> >> Based on my understanding, tip/x86/x2apic git commit
> >> 94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
> >> something like
> >> http://marc.info/?l=linux-kernel&m=121614328831237&w=2
Suresh's patch looks good. Thanks Suresh!
Acked-by: Zachary Amsden <zach@vmware.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 18:51 ` [PATCH] x86: let 32bit use apic_ops too - fix Suresh Siddha
2008-07-15 19:04 ` Zachary Amsden
@ 2008-07-15 19:22 ` Yinghai Lu
2008-07-15 19:24 ` Zachary Amsden
1 sibling, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-15 19:22 UTC (permalink / raw)
To: Suresh Siddha, Jeremy Fitzhardinge
Cc: Zachary Amsden, Chris Wright, Rusty Russell, virtualization,
Linux Kernel Mailing List
On Tue, Jul 15, 2008 at 11:51 AM, Suresh Siddha
<suresh.b.siddha@intel.com> wrote:
> On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
>>
>> Nacked-by: Zachary Amsden <zach@vmware.com>
>>
>> What are you doing here and why aren't you cc-ing the maintainers?
>
> Sorry. I was about to bring you into the loop.
>
> Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
> is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
> for VMI case aswell.
>
> Based on my understanding, tip/x86/x2apic git commit
> 94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
> something like
> http://marc.info/?l=linux-kernel&m=121614328831237&w=2
>
> Can you please check and Ack/Nack this fix?
how about xen pv with icr related?
YH
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 19:22 ` Yinghai Lu
@ 2008-07-15 19:24 ` Zachary Amsden
0 siblings, 0 replies; 19+ messages in thread
From: Zachary Amsden @ 2008-07-15 19:24 UTC (permalink / raw)
To: Yinghai Lu
Cc: Suresh Siddha, Jeremy Fitzhardinge, Chris Wright, Rusty Russell,
virtualization, Linux Kernel Mailing List
On Tue, 2008-07-15 at 12:22 -0700, Yinghai Lu wrote:
> On Tue, Jul 15, 2008 at 11:51 AM, Suresh Siddha
> <suresh.b.siddha@intel.com> wrote:
> > On Tue, Jul 15, 2008 at 11:38:50AM -0700, Zachary Amsden wrote:
> >>
> >> Nacked-by: Zachary Amsden <zach@vmware.com>
> >>
> >> What are you doing here and why aren't you cc-ing the maintainers?
> >
> > Sorry. I was about to bring you into the loop.
> >
> > Yinghai posted 32bit native apic_ops(similar to my 64bit apic ops patch, which
> > is different from pv_apic_ops) which is in tip/x86/x2apic and proposed a fix
> > for VMI case aswell.
> >
> > Based on my understanding, tip/x86/x2apic git commit
> > 94a8c3c2437c8946f1b6c8e0b2c560a7db8ed3c6 is wrong and it should be fixed with
> > something like
> > http://marc.info/?l=linux-kernel&m=121614328831237&w=2
> >
> > Can you please check and Ack/Nack this fix?
>
> how about xen pv with icr related?
Xen doesn't have an APIC; they should be fine as is I think.
Zach
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Patch from LKML
2008-07-15 18:38 Patch from LKML Zachary Amsden
2008-07-15 18:51 ` [PATCH] x86: let 32bit use apic_ops too - fix Suresh Siddha
@ 2008-07-15 18:52 ` Yinghai Lu
2008-07-15 18:57 ` Zachary Amsden
1 sibling, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-15 18:52 UTC (permalink / raw)
To: Zachary Amsden
Cc: suresh.b.siddha, Chris Wright, Jeremy Fitzhardinge,
Rusty Russell, virtualization, Linux Kernel Mailing List
On Tue, Jul 15, 2008 at 11:38 AM, Zachary Amsden <zach@vmware.com> wrote:
>
>> On Tue, Jul 15, 2008 at 10:33 AM, Suresh Siddha
>> <suresh.b.siddha@intel.com> wrote:
>> > On Sun, Jul 13, 2008 at 10:19:35PM -0700, Yinghai Lu wrote:
>> >>
>> >> fix for pv.
>> >>
>> >> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>> >>
>> >> ---
>> >> arch/x86/kernel/paravirt.c | 5 ----
>> >> arch/x86/kernel/vmi_32.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
>> >> arch/x86/xen/enlighten.c | 19 +++++++---------
>> >> include/asm-x86/paravirt.h | 29 -------------------------
>> >> 4 files changed, 57 insertions(+), 47 deletions(-)
>> >>
>> >> Index: linux-2.6/arch/x86/kernel/paravirt.c
>> >> ===================================================================
>> >> --- linux-2.6.orig/arch/x86/kernel/paravirt.c
>> >> +++ linux-2.6/arch/x86/kernel/paravirt.c
>> >> @@ -373,11 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = {
>> >>
>> >> struct pv_apic_ops pv_apic_ops = {
>> >> #ifdef CONFIG_X86_LOCAL_APIC
>> >> -#ifndef CONFIG_X86_64
>> >> - .apic_write = native_apic_mem_write,
>> >> - .apic_write_atomic = native_apic_mem_write_atomic,
>> >> - .apic_read = native_apic_mem_read,
>> >> -#endif
>> >> .setup_boot_clock = setup_boot_APIC_clock,
>> >> .setup_secondary_clock = setup_secondary_APIC_clock,
>> >> .startup_ipi_hook = paravirt_nop,
>> >> Index: linux-2.6/arch/x86/kernel/vmi_32.c
>> >> ===================================================================
>> >> --- linux-2.6.orig/arch/x86/kernel/vmi_32.c
>> >> +++ linux-2.6/arch/x86/kernel/vmi_32.c
>> >> @@ -676,6 +676,50 @@ static inline int __init probe_vmi_rom(v
>> >> return 0;
>> >> }
>> >>
>> >> +#ifdef CONFIG_X86_LOCAL_APIC
>> >> +static u32 vmi_apic_read(u32 reg)
>> >> +{
>> >> + return 0;
>> >> +}
>> >> +
>> >> +static void vmi_apic_write(u32 reg, u32 val)
>> >> +{
>> >> + /* Warn to see if there's any stray references */
>> >> + WARN_ON(1);
>> >> +}
>> >> +
>> >> +static u64 vmi_apic_icr_read(void)
>> >> +{
>> >> + return 0;
>> >> +}
>> >> +
>> >> +static void vmi_apic_icr_write(u32 low, u32 id)
>> >> +{
>> >> + /* Warn to see if there's any stray references */
>> >> + WARN_ON(1);
>> >> +}
>> >> +
>> >> +static void vmi_apic_wait_icr_idle(void)
>> >> +{
>> >> + return;
>> >> +}
>> >> +
>> >> +static u32 vmi_safe_apic_wait_icr_idle(void)
>> >> +{
>> >> + return 0;
>> >> +}
>> >> +
>> >> +static struct apic_ops vmi_basic_apic_ops = {
>> >> + .read = vmi_apic_read,
>> >> + .write = vmi_apic_write,
>> >> + .write_atomic = vmi_apic_write,
>> >> + .icr_read = vmi_apic_icr_read,
>> >> + .icr_write = vmi_apic_icr_write,
>> >> + .wait_icr_idle = vmi_apic_wait_icr_idle,
>> >> + .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
>> >> +};
>> >> +#endif
>> >> +
>> >> /*
>> >> * VMI setup common to all processors
>> >> */
>> >> @@ -904,9 +948,10 @@ static inline int __init activate_vmi(vo
>> >> #endif
>> >>
>> >> #ifdef CONFIG_X86_LOCAL_APIC
>> >> - para_fill(pv_apic_ops.apic_read, APICRead);
>> >> - para_fill(pv_apic_ops.apic_write, APICWrite);
>> >> - para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
>> >> + para_fill(vmi_basic_apic_ops.read, APICRead);
>> >> + para_fill(vmi_basic_apic_ops.write, APICWrite);
>> >> + para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
>> >> + apic_ops = &vmi_basic_apic_ops;
>> >
>> > Yinghai, Looking more closely at this, based on my understanding this might be
>> > wrong for VMI. Correct patch should be as follows. Any comments?
>>
>> so you mean icr related will still use default native member?
>>
>> YH
>
> Nacked-by: Zachary Amsden <zach@vmware.com>
because of not ccing you?
>
> What are you doing here and why aren't you cc-ing the maintainers?
did you checking tip tree for x86 changing?
YH
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: Patch from LKML
2008-07-15 18:52 ` Patch from LKML Yinghai Lu
@ 2008-07-15 18:57 ` Zachary Amsden
0 siblings, 0 replies; 19+ messages in thread
From: Zachary Amsden @ 2008-07-15 18:57 UTC (permalink / raw)
To: Yinghai Lu
Cc: suresh.b.siddha, Chris Wright, Jeremy Fitzhardinge,
Rusty Russell, virtualization, Linux Kernel Mailing List
On Tue, 2008-07-15 at 11:52 -0700, Yinghai Lu wrote:
> > Nacked-by: Zachary Amsden <zach@vmware.com>
>
> because of not ccing you?
Because it's wrong.
> >
> > What are you doing here and why aren't you cc-ing the maintainers?
>
> did you checking tip tree for x86 changing?
No, this was brought to my attention by someone who spotted it.
Zach
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH] x86: introduce page_size_mask for 64bit
@ 2008-07-08 8:41 Yinghai Lu
2008-07-11 3:38 ` [PATCH] x86: introduce max_low_pfn_mapped " Yinghai Lu
0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-08 8:41 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: LKML
prepare for overmapped patch
also printout last_map_addr together with end
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/mm/init_64.c | 98 ++++++++++++++++++++++++++++++++------------------
1 file changed, 63 insertions(+), 35 deletions(-)
Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -300,7 +300,8 @@ phys_pte_update(pmd_t *pmd, unsigned lon
}
static unsigned long __meminit
-phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
+phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
+ unsigned long page_size_mask)
{
unsigned long pages = 0;
@@ -325,7 +326,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned
continue;
}
- if (cpu_has_pse) {
+ if (page_size_mask & (1<<PG_LEVEL_2M)) {
pages++;
set_pte((pte_t *)pmd,
pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
@@ -343,20 +344,22 @@ phys_pmd_init(pmd_t *pmd_page, unsigned
}
static unsigned long __meminit
-phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
+phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end,
+ unsigned long page_size_mask)
{
pmd_t *pmd = pmd_offset(pud, 0);
unsigned long last_map_addr;
spin_lock(&init_mm.page_table_lock);
- last_map_addr = phys_pmd_init(pmd, address, end);
+ last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask);
spin_unlock(&init_mm.page_table_lock);
__flush_tlb_all();
return last_map_addr;
}
static unsigned long __meminit
-phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
+phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
+ unsigned long page_size_mask)
{
unsigned long pages = 0;
unsigned long last_map_addr = end;
@@ -378,11 +381,12 @@ phys_pud_init(pud_t *pud_page, unsigned
if (pud_val(*pud)) {
if (!pud_large(*pud))
- last_map_addr = phys_pmd_update(pud, addr, end);
+ last_map_addr = phys_pmd_update(pud, addr, end,
+ page_size_mask);
continue;
}
- if (direct_gbpages) {
+ if (page_size_mask & (1<<PG_LEVEL_1G)) {
pages++;
set_pte((pte_t *)pud,
pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
@@ -393,7 +397,7 @@ phys_pud_init(pud_t *pud_page, unsigned
pmd = alloc_low_page(&pmd_phys);
spin_lock(&init_mm.page_table_lock);
- last_map_addr = phys_pmd_init(pmd, addr, end);
+ last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask);
unmap_low_page(pmd);
pud_populate(&init_mm, pud, __va(pmd_phys));
spin_unlock(&init_mm.page_table_lock);
@@ -406,13 +410,14 @@ phys_pud_init(pud_t *pud_page, unsigned
}
static unsigned long __meminit
-phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end)
+phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end,
+ unsigned long page_size_mask)
{
pud_t *pud;
pud = (pud_t *)pgd_page_vaddr(*pgd);
- return phys_pud_init(pud, addr, end);
+ return phys_pud_init(pud, addr, end, page_size_mask);
}
static void __init find_early_table_space(unsigned long end)
@@ -582,29 +587,12 @@ static void __init early_memtest(unsigne
}
#endif
-/*
- * Setup the direct mapping of the physical memory at PAGE_OFFSET.
- * This runs before bootmem is initialized and gets pages directly from
- * the physical memory. To access them they are temporarily mapped.
- */
-unsigned long __init_refok init_memory_mapping(unsigned long start, unsigned long end)
+static unsigned long __init kernel_physical_mapping_init(unsigned long start,
+ unsigned long end,
+ unsigned long page_size_mask)
{
- unsigned long next, last_map_addr = end;
- unsigned long start_phys = start, end_phys = end;
- printk(KERN_INFO "init_memory_mapping\n");
-
- /*
- * Find space for the kernel direct mapping tables.
- *
- * Later we should allocate these tables in the local node of the
- * memory mapped. Unfortunately this is done currently before the
- * nodes are discovered.
- */
- if (!after_bootmem) {
- init_gbpages();
- find_early_table_space(end);
- }
+ unsigned long next, last_map_addr = end;
start = (unsigned long)__va(start);
end = (unsigned long)__va(end);
@@ -619,7 +607,8 @@ unsigned long __init_refok init_memory_m
next = end;
if (pgd_val(*pgd)) {
- last_map_addr = phys_pud_update(pgd, __pa(start), __pa(end));
+ last_map_addr = phys_pud_update(pgd, __pa(start),
+ __pa(end), page_size_mask);
continue;
}
@@ -628,22 +617,61 @@ unsigned long __init_refok init_memory_m
else
pud = alloc_low_page(&pud_phys);
- last_map_addr = phys_pud_init(pud, __pa(start), __pa(next));
+ last_map_addr = phys_pud_init(pud, __pa(start), __pa(next),
+ page_size_mask);
unmap_low_page(pud);
pgd_populate(&init_mm, pgd_offset_k(start),
__va(pud_phys));
}
+ return last_map_addr;
+}
+/*
+ * Setup the direct mapping of the physical memory at PAGE_OFFSET.
+ * This runs before bootmem is initialized and gets pages directly from
+ * the physical memory. To access them they are temporarily mapped.
+ */
+unsigned long __init_refok init_memory_mapping(unsigned long start,
+ unsigned long end)
+{
+ unsigned long last_map_addr;
+ unsigned long page_size_mask = 0;
+
+ printk(KERN_INFO "init_memory_mapping\n");
+
+ /*
+ * Find space for the kernel direct mapping tables.
+ *
+ * Later we should allocate these tables in the local node of the
+ * memory mapped. Unfortunately this is done currently before the
+ * nodes are discovered.
+ */
+ if (!after_bootmem) {
+ init_gbpages();
+ find_early_table_space(end);
+ }
+
+ if (direct_gbpages)
+ page_size_mask |= 1 << PG_LEVEL_1G;
+ if (cpu_has_pse)
+ page_size_mask |= 1 << PG_LEVEL_2M;
+
+ last_map_addr = kernel_physical_mapping_init(start, end,
+ page_size_mask);
+
if (!after_bootmem)
mmu_cr4_features = read_cr4();
__flush_tlb_all();
- if (!after_bootmem)
+ if (!after_bootmem && table_end > table_start)
reserve_early(table_start << PAGE_SHIFT,
table_end << PAGE_SHIFT, "PGTABLE");
+ printk(KERN_INFO "last_map_addr: %lx end: %lx\n",
+ last_map_addr, end);
+
if (!after_bootmem)
- early_memtest(start_phys, end_phys);
+ early_memtest(start, end);
return last_map_addr >> PAGE_SHIFT;
}
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH] x86: introduce max_low_pfn_mapped for 64bit
@ 2008-07-11 3:38 ` Yinghai Lu
2008-07-12 1:41 ` [PATCH] x86: let 32bit use apic_ops too Yinghai Lu
0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-11 3:38 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Suresh Siddha; +Cc: LKML
when 4g more memory installed, don't map big hole below 4g.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/acpi/boot.c | 2 +-
arch/x86/kernel/cpu/amd_64.c | 10 +++++++---
arch/x86/kernel/e820.c | 23 ++++++++++++++++++++---
arch/x86/kernel/efi.c | 2 +-
arch/x86/kernel/setup.c | 22 ++++++++++++++++++----
arch/x86/mm/init_32.c | 1 +
arch/x86/mm/init_64.c | 1 +
arch/x86/mm/pageattr.c | 19 +++++++++++++++++--
arch/x86/mm/pat.c | 3 ++-
arch/x86/pci/i386.c | 4 +++-
include/asm-x86/e820.h | 3 ++-
include/asm-x86/page.h | 1 +
12 files changed, 74 insertions(+), 17 deletions(-)
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -130,7 +130,7 @@ char *__init __acpi_map_table(unsigned l
if (!phys || !size)
return NULL;
- if (phys+size <= (max_pfn_mapped << PAGE_SHIFT))
+ if (phys+size <= (max_low_pfn_mapped << PAGE_SHIFT))
return __va(phys);
offset = phys & (PAGE_SIZE - 1);
Index: linux-2.6/arch/x86/kernel/cpu/amd_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd_64.c
+++ linux-2.6/arch/x86/kernel/cpu/amd_64.c
@@ -199,10 +199,14 @@ static void __cpuinit init_amd(struct cp
* Don't do it for gbpages because there seems very little
* benefit in doing so.
*/
- if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg) &&
- (tseg >> PMD_SHIFT) <
- (max_pfn_mapped >> (PMD_SHIFT-PAGE_SHIFT)))
+ if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) {
+ if ((tseg>>PMD_SHIFT) <
+ (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) ||
+ ((tseg>>PMD_SHIFT) <
+ (max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) &&
+ (tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT))))
set_memory_4k((unsigned long)__va(tseg), 1);
+ }
}
}
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -1056,7 +1056,7 @@ unsigned long __initdata end_user_pfn =
/*
* Find the highest page frame number we have available
*/
-unsigned long __init e820_end(void)
+static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
{
int i;
unsigned long last_pfn = 0;
@@ -1064,12 +1064,21 @@ unsigned long __init e820_end(void)
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = &e820.map[i];
+ unsigned long start_pfn;
unsigned long end_pfn;
- if (ei->type != E820_RAM)
+ if (ei->type != type)
continue;
+ start_pfn = ei->addr >> PAGE_SHIFT;
end_pfn = (ei->addr + ei->size) >> PAGE_SHIFT;
+
+ if (start_pfn >= limit_pfn)
+ continue;
+ if (end_pfn > limit_pfn) {
+ last_pfn = limit_pfn;
+ break;
+ }
if (end_pfn > last_pfn)
last_pfn = end_pfn;
}
@@ -1083,7 +1092,15 @@ unsigned long __init e820_end(void)
last_pfn, max_arch_pfn);
return last_pfn;
}
+unsigned long __init e820_end_of_ram_pfn(void)
+{
+ return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
+}
+unsigned long __init e820_end_of_low_ram_pfn(void)
+{
+ return e820_end_pfn(1UL<<(32 - PAGE_SHIFT), E820_RAM);
+}
/*
* Finds an active region in the address range from start_pfn to last_pfn and
* returns its range in ei_startpfn and ei_endpfn for the e820 entry.
@@ -1206,7 +1223,7 @@ static int __init parse_memmap_opt(char
* the real mem size before original memory map is
* reset.
*/
- saved_max_pfn = e820_end();
+ saved_max_pfn = e820_end_of_ram_pfn();
#endif
e820.nr_map = 0;
userdef = 1;
Index: linux-2.6/arch/x86/kernel/efi.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/efi.c
+++ linux-2.6/arch/x86/kernel/efi.c
@@ -473,7 +473,7 @@ void __init efi_enter_virtual_mode(void)
size = md->num_pages << EFI_PAGE_SHIFT;
end = md->phys_addr + size;
- if (PFN_UP(end) <= max_pfn_mapped)
+ if (PFN_UP(end) <= max_low_pfn_mapped)
va = __va(md->phys_addr);
else
va = efi_ioremap(md->phys_addr, size);
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -719,14 +719,14 @@ void __init setup_arch(char **cmdline_p)
* partially used pages are not usable - thus
* we are rounding upwards:
*/
- max_pfn = e820_end();
+ max_pfn = e820_end_of_ram_pfn();
/* preallocate 4k for mptable mpc */
early_reserve_e820_mpc_new();
/* update e820 for memory not covered by WB MTRRs */
mtrr_bp_init();
if (mtrr_trim_uncached_memory(max_pfn))
- max_pfn = e820_end();
+ max_pfn = e820_end_of_ram_pfn();
#ifdef CONFIG_X86_32
/* max_low_pfn get updated here */
@@ -738,12 +738,26 @@ void __init setup_arch(char **cmdline_p)
/* How many end-of-memory variables you have, grandma! */
/* need this before calling reserve_initrd */
- max_low_pfn = max_pfn;
+ if (max_pfn > (1UL<<(32 - PAGE_SHIFT)))
+ max_low_pfn = e820_end_of_low_ram_pfn();
+ else
+ max_low_pfn = max_pfn;
+
high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
#endif
/* max_pfn_mapped is updated here */
- max_pfn_mapped = init_memory_mapping(0, (max_low_pfn << PAGE_SHIFT));
+ max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
+ max_pfn_mapped = max_low_pfn_mapped;
+
+#ifdef CONFIG_X86_64
+ if (max_pfn > max_low_pfn) {
+ max_pfn_mapped = init_memory_mapping(1UL<<32,
+ max_pfn<<PAGE_SHIFT);
+ /* can we preseve max_low_pfn ?*/
+ max_low_pfn = max_pfn;
+ }
+#endif
/*
* NOTE: On x86-32, only from this point on, fixmaps are ready for use.
Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_32.c
+++ linux-2.6/arch/x86/mm/init_32.c
@@ -50,6 +50,7 @@
unsigned int __VMALLOC_RESERVE = 128 << 20;
+unsigned long max_low_pfn_mapped;
unsigned long max_pfn_mapped;
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -53,6 +53,7 @@
* The direct mapping extends to max_pfn_mapped, so that we can directly access
* apertures, ACPI and other tables without having to play with fixmaps.
*/
+unsigned long max_low_pfn_mapped;
unsigned long max_pfn_mapped;
static unsigned long dma_reserve __initdata;
Index: linux-2.6/arch/x86/mm/pageattr.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/pageattr.c
+++ linux-2.6/arch/x86/mm/pageattr.c
@@ -537,8 +537,14 @@ static int split_large_page(pte_t *kpte,
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
if (address >= (unsigned long)__va(0) &&
+ address < (unsigned long)__va(max_low_pfn_mapped << PAGE_SHIFT))
+ split_page_count(level);
+
+#ifdef CONFIG_X86_64
+ if (address >= (unsigned long)__va(1UL<<32) &&
address < (unsigned long)__va(max_pfn_mapped << PAGE_SHIFT))
split_page_count(level);
+#endif
/*
* Install the new, split up pagetable. Important details here:
@@ -655,12 +661,21 @@ static int cpa_process_alias(struct cpa_
if (cpa->pfn > max_pfn_mapped)
return 0;
+#ifdef CONFIG_X86_64
+ if (cpa->pfn > max_low_pfn_mapped && cpa->pfn < (1UL<<(32-PAGE_SHIFT)))
+ return 0;
+#endif
/*
* No need to redo, when the primary call touched the direct
* mapping already:
*/
- if (!within(cpa->vaddr, PAGE_OFFSET,
- PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))) {
+ if (!(within(cpa->vaddr, PAGE_OFFSET,
+ PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT))
+#ifdef CONFIG_X86_64
+ || within(cpa->vaddr, PAGE_OFFSET + (1UL<<32),
+ PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))
+#endif
+ )) {
alias_cpa = *cpa;
alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
Index: linux-2.6/arch/x86/mm/pat.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/pat.c
+++ linux-2.6/arch/x86/mm/pat.c
@@ -449,7 +449,8 @@ int phys_mem_access_prot_allowed(struct
if (retval < 0)
return 0;
- if (pfn <= max_pfn_mapped &&
+ if (((pfn <= max_low_pfn_mapped) ||
+ (pfn >= (1UL<<(32 - PAGE_SHIFT)) && pfn <= max_pfn_mapped)) &&
ioremap_change_attr((unsigned long)__va(offset), size, flags) < 0) {
free_memtype(offset, offset + size);
printk(KERN_INFO
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -334,7 +334,9 @@ int pci_mmap_page_range(struct pci_dev *
flags = new_flags;
}
- if (vma->vm_pgoff <= max_pfn_mapped &&
+ if (((vma->vm_pgoff <= max_low_pfn_mapped) ||
+ (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) &&
+ vma->vm_pgoff <= max_pfn_mapped)) &&
ioremap_change_attr((unsigned long)__va(addr), len, flags)) {
free_memtype(addr, addr + len);
return -EINVAL;
Index: linux-2.6/include/asm-x86/e820.h
===================================================================
--- linux-2.6.orig/include/asm-x86/e820.h
+++ linux-2.6/include/asm-x86/e820.h
@@ -99,7 +99,8 @@ extern void free_early(u64 start, u64 en
extern void early_res_to_bootmem(u64 start, u64 end);
extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
-extern unsigned long e820_end(void);
+extern unsigned long e820_end_of_ram_pfn(void);
+extern unsigned long e820_end_of_low_ram_pfn(void);
extern int e820_find_active_region(const struct e820entry *ei,
unsigned long start_pfn,
unsigned long last_pfn,
Index: linux-2.6/include/asm-x86/page.h
===================================================================
--- linux-2.6.orig/include/asm-x86/page.h
+++ linux-2.6/include/asm-x86/page.h
@@ -61,6 +61,7 @@ extern void map_devmem(unsigned long pfn
extern void unmap_devmem(unsigned long pfn, unsigned long size,
pgprot_t vma_prot);
+extern unsigned long max_low_pfn_mapped;
extern unsigned long max_pfn_mapped;
struct page;
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH] x86: let 32bit use apic_ops too
2008-07-11 3:38 ` [PATCH] x86: introduce max_low_pfn_mapped " Yinghai Lu
@ 2008-07-12 1:41 ` Yinghai Lu
2008-07-14 5:19 ` [PATCH] x86: let 32bit use apic_ops too - fix Yinghai Lu
0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-12 1:41 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Suresh Siddha; +Cc: LKML
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/apic_32.c | 39 +++++++++++++++++++++++++++++++--------
include/asm-x86/apic.h | 13 ++-----------
2 files changed, 33 insertions(+), 19 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic_32.c
+++ linux-2.6/arch/x86/kernel/apic_32.c
@@ -145,19 +145,13 @@ static int modern_apic(void)
return lapic_get_version() >= 0x14;
}
-void apic_icr_write(u32 low, u32 id)
-{
- apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(id));
- apic_write_around(APIC_ICR, low);
-}
-
-void apic_wait_icr_idle(void)
+void xapic_wait_icr_idle(void)
{
while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
cpu_relax();
}
-u32 safe_apic_wait_icr_idle(void)
+u32 safe_xapic_wait_icr_idle(void)
{
u32 send_status;
int timeout;
@@ -173,6 +167,35 @@ u32 safe_apic_wait_icr_idle(void)
return send_status;
}
+void xapic_icr_write(u32 low, u32 id)
+{
+ apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(id));
+ apic_write_around(APIC_ICR, low);
+}
+
+u64 xapic_icr_read(void)
+{
+ u32 icr1, icr2;
+
+ icr2 = apic_read(APIC_ICR2);
+ icr1 = apic_read(APIC_ICR);
+
+ return icr1 | ((u64)icr2 << 32);
+}
+
+static struct apic_ops xapic_ops = {
+ .read = native_apic_mem_read,
+ .write = native_apic_mem_write,
+ .write_atomic = native_apic_mem_write_atomic,
+ .icr_read = xapic_icr_read,
+ .icr_write = xapic_icr_write,
+ .wait_icr_idle = xapic_wait_icr_idle,
+ .safe_wait_icr_idle = safe_xapic_wait_icr_idle,
+};
+
+struct apic_ops __read_mostly *apic_ops = &xapic_ops;
+EXPORT_SYMBOL_GPL(apic_ops);
+
/**
* enable_NMI_through_LVT0 - enable NMI through local vector table 0
*/
Index: linux-2.6/include/asm-x86/apic.h
===================================================================
--- linux-2.6.orig/include/asm-x86/apic.h
+++ linux-2.6/include/asm-x86/apic.h
@@ -49,11 +49,6 @@ extern int disable_apic;
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#else
-#ifndef CONFIG_X86_64
-#define apic_write native_apic_mem_write
-#define apic_write_atomic native_apic_mem_write_atomic
-#define apic_read native_apic_mem_read
-#endif
#define setup_boot_clock setup_boot_APIC_clock
#define setup_secondary_clock setup_secondary_APIC_clock
#endif
@@ -95,16 +90,13 @@ static inline u32 native_apic_msr_read(u
return low;
}
-#ifdef CONFIG_X86_32
-extern void apic_wait_icr_idle(void);
-extern u32 safe_apic_wait_icr_idle(void);
-extern void apic_icr_write(u32 low, u32 id);
-#else
+#ifndef CONFIG_X86_32
extern int x2apic, x2apic_preenabled;
extern void check_x2apic(void);
extern void enable_x2apic(void);
extern void enable_IR_x2apic(void);
extern void x2apic_icr_write(u32 low, u32 id);
+#endif
struct apic_ops {
u32 (*read)(u32 reg);
@@ -125,7 +117,6 @@ extern struct apic_ops *apic_ops;
#define apic_icr_write (apic_ops->icr_write)
#define apic_wait_icr_idle (apic_ops->wait_icr_idle)
#define safe_apic_wait_icr_idle (apic_ops->safe_wait_icr_idle)
-#endif
extern int get_physical_broadcast(void);
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-12 1:41 ` [PATCH] x86: let 32bit use apic_ops too Yinghai Lu
@ 2008-07-14 5:19 ` Yinghai Lu
2008-07-14 7:12 ` Ingo Molnar
2008-07-15 17:33 ` Suresh Siddha
0 siblings, 2 replies; 19+ messages in thread
From: Yinghai Lu @ 2008-07-14 5:19 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Suresh Siddha; +Cc: LKML
fix for pv.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/paravirt.c | 5 ----
arch/x86/kernel/vmi_32.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
arch/x86/xen/enlighten.c | 19 +++++++---------
include/asm-x86/paravirt.h | 29 -------------------------
4 files changed, 57 insertions(+), 47 deletions(-)
Index: linux-2.6/arch/x86/kernel/paravirt.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/paravirt.c
+++ linux-2.6/arch/x86/kernel/paravirt.c
@@ -373,11 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = {
struct pv_apic_ops pv_apic_ops = {
#ifdef CONFIG_X86_LOCAL_APIC
-#ifndef CONFIG_X86_64
- .apic_write = native_apic_mem_write,
- .apic_write_atomic = native_apic_mem_write_atomic,
- .apic_read = native_apic_mem_read,
-#endif
.setup_boot_clock = setup_boot_APIC_clock,
.setup_secondary_clock = setup_secondary_APIC_clock,
.startup_ipi_hook = paravirt_nop,
Index: linux-2.6/arch/x86/kernel/vmi_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/vmi_32.c
+++ linux-2.6/arch/x86/kernel/vmi_32.c
@@ -676,6 +676,50 @@ static inline int __init probe_vmi_rom(v
return 0;
}
+#ifdef CONFIG_X86_LOCAL_APIC
+static u32 vmi_apic_read(u32 reg)
+{
+ return 0;
+}
+
+static void vmi_apic_write(u32 reg, u32 val)
+{
+ /* Warn to see if there's any stray references */
+ WARN_ON(1);
+}
+
+static u64 vmi_apic_icr_read(void)
+{
+ return 0;
+}
+
+static void vmi_apic_icr_write(u32 low, u32 id)
+{
+ /* Warn to see if there's any stray references */
+ WARN_ON(1);
+}
+
+static void vmi_apic_wait_icr_idle(void)
+{
+ return;
+}
+
+static u32 vmi_safe_apic_wait_icr_idle(void)
+{
+ return 0;
+}
+
+static struct apic_ops vmi_basic_apic_ops = {
+ .read = vmi_apic_read,
+ .write = vmi_apic_write,
+ .write_atomic = vmi_apic_write,
+ .icr_read = vmi_apic_icr_read,
+ .icr_write = vmi_apic_icr_write,
+ .wait_icr_idle = vmi_apic_wait_icr_idle,
+ .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
+};
+#endif
+
/*
* VMI setup common to all processors
*/
@@ -904,9 +948,10 @@ static inline int __init activate_vmi(vo
#endif
#ifdef CONFIG_X86_LOCAL_APIC
- para_fill(pv_apic_ops.apic_read, APICRead);
- para_fill(pv_apic_ops.apic_write, APICWrite);
- para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
+ para_fill(vmi_basic_apic_ops.read, APICRead);
+ para_fill(vmi_basic_apic_ops.write, APICWrite);
+ para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
+ apic_ops = &vmi_basic_apic_ops;
#endif
/*
Index: linux-2.6/arch/x86/xen/enlighten.c
===================================================================
--- linux-2.6.orig/arch/x86/xen/enlighten.c
+++ linux-2.6/arch/x86/xen/enlighten.c
@@ -587,7 +587,6 @@ static void xen_apic_write(u32 reg, u32
WARN_ON(1);
}
-#ifdef CONFIG_X86_64
static u64 xen_apic_icr_read(void)
{
return 0;
@@ -604,6 +603,11 @@ static void xen_apic_wait_icr_idle(void)
return;
}
+static u32 xen_safe_apic_wait_icr_idle(void)
+{
+ return 0;
+}
+
static struct apic_ops xen_basic_apic_ops = {
.read = xen_apic_read,
.write = xen_apic_write,
@@ -611,9 +615,8 @@ static struct apic_ops xen_basic_apic_op
.icr_read = xen_apic_icr_read,
.icr_write = xen_apic_icr_write,
.wait_icr_idle = xen_apic_wait_icr_idle,
- .safe_wait_icr_idle = xen_apic_wait_icr_idle,
+ .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle,
};
-#endif
#endif
@@ -1298,11 +1301,6 @@ static const struct pv_irq_ops xen_irq_o
static const struct pv_apic_ops xen_apic_ops __initdata = {
#ifdef CONFIG_X86_LOCAL_APIC
-#ifndef CONFIG_X86_64
- .apic_write = xen_apic_write,
- .apic_write_atomic = xen_apic_write,
- .apic_read = xen_apic_read,
-#endif
.setup_boot_clock = paravirt_nop,
.setup_secondary_clock = paravirt_nop,
.startup_ipi_hook = paravirt_nop,
@@ -1704,9 +1702,10 @@ asmlinkage void __init xen_start_kernel(
pv_irq_ops = xen_irq_ops;
pv_apic_ops = xen_apic_ops;
pv_mmu_ops = xen_mmu_ops;
-#ifdef CONFIG_X86_64
+
+#ifdef CONFIG_X86_LOCAL_APIC
/*
- * for 64bit, set up the basic apic ops aswell.
+ * set up the basic apic ops.
*/
apic_ops = &xen_basic_apic_ops;
#endif
Index: linux-2.6/include/asm-x86/paravirt.h
===================================================================
--- linux-2.6.orig/include/asm-x86/paravirt.h
+++ linux-2.6/include/asm-x86/paravirt.h
@@ -200,15 +200,6 @@ struct pv_irq_ops {
struct pv_apic_ops {
#ifdef CONFIG_X86_LOCAL_APIC
-#ifndef CONFIG_X86_64
- /*
- * Direct APIC operations, principally for VMI. Ideally
- * these shouldn't be in this interface.
- */
- void (*apic_write)(u32 reg, u32 v);
- void (*apic_write_atomic)(u32 reg, u32 v);
- u32 (*apic_read)(u32 reg);
-#endif
void (*setup_boot_clock)(void);
void (*setup_secondary_clock)(void);
@@ -901,26 +892,6 @@ static inline void slow_down_io(void)
}
#ifdef CONFIG_X86_LOCAL_APIC
-/*
- * Basic functions accessing APICs.
- */
-#ifndef CONFIG_X86_64
-static inline void apic_write(u32 reg, u32 v)
-{
- PVOP_VCALL2(pv_apic_ops.apic_write, reg, v);
-}
-
-static inline void apic_write_atomic(u32 reg, u32 v)
-{
- PVOP_VCALL2(pv_apic_ops.apic_write_atomic, reg, v);
-}
-
-static inline u32 apic_read(u32 reg)
-{
- return PVOP_CALL1(unsigned long, pv_apic_ops.apic_read, reg);
-}
-#endif
-
static inline void setup_boot_clock(void)
{
PVOP_VCALL0(pv_apic_ops.setup_boot_clock);
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 5:19 ` [PATCH] x86: let 32bit use apic_ops too - fix Yinghai Lu
@ 2008-07-14 7:12 ` Ingo Molnar
2008-07-14 16:49 ` Suresh Siddha
2008-07-15 17:33 ` Suresh Siddha
1 sibling, 1 reply; 19+ messages in thread
From: Ingo Molnar @ 2008-07-14 7:12 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Suresh Siddha, LKML
* Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> fix for pv.
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
applied to tip/x86/x2apic - thanks Yinghai.
Ingo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 7:12 ` Ingo Molnar
@ 2008-07-14 16:49 ` Suresh Siddha
2008-07-14 17:00 ` Yinghai Lu
2008-07-18 17:06 ` Ingo Molnar
0 siblings, 2 replies; 19+ messages in thread
From: Suresh Siddha @ 2008-07-14 16:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, Siddha, Suresh B, LKML
On Mon, Jul 14, 2008 at 12:12:07AM -0700, Ingo Molnar wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
> > fix for pv.
> >
> > Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
> applied to tip/x86/x2apic - thanks Yinghai.
Ingo, before you try for the third attempt ;) we need one more lguest apic_ops
fix. Patch appended. Thanks.
---
[patch] x86: apic_ops for lguest
apic_ops for lguest.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
---
Index: x86.git/arch/x86/lguest/boot.c
===================================================================
--- x86.git.orig/arch/x86/lguest/boot.c 2008-07-14 09:44:31.000000000 -0700
+++ x86.git/arch/x86/lguest/boot.c 2008-07-14 09:45:12.000000000 -0700
@@ -791,6 +791,37 @@
{
return 0;
}
+
+static u64 lguest_apic_icr_read(void)
+{
+ return 0;
+}
+
+static void lguest_apic_icr_write(u32 low, u32 id)
+{
+ /* Warn to see if there's any stray references */
+ WARN_ON(1);
+}
+
+static void lguest_apic_wait_icr_idle(void)
+{
+ return;
+}
+
+static u32 lguest_apic_safe_wait_icr_idle(void)
+{
+ return 0;
+}
+
+static struct apic_ops lguest_basic_apic_ops = {
+ .read = lguest_apic_read,
+ .write = lguest_apic_write,
+ .write_atomic = lguest_apic_write,
+ .icr_read = lguest_apic_icr_read,
+ .icr_write = lguest_apic_icr_write,
+ .wait_icr_idle = lguest_apic_wait_icr_idle,
+ .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle,
+};
#endif
/* STOP! Until an interrupt comes in. */
@@ -990,9 +1021,7 @@
#ifdef CONFIG_X86_LOCAL_APIC
/* apic read/write intercepts */
- pv_apic_ops.apic_write = lguest_apic_write;
- pv_apic_ops.apic_write_atomic = lguest_apic_write;
- pv_apic_ops.apic_read = lguest_apic_read;
+ apic_ops = &lguest_basic_apic_ops;
#endif
/* time operations */
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 16:49 ` Suresh Siddha
@ 2008-07-14 17:00 ` Yinghai Lu
2008-07-14 18:03 ` Suresh Siddha
2008-07-18 17:06 ` Ingo Molnar
1 sibling, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-14 17:00 UTC (permalink / raw)
To: Suresh Siddha; +Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, LKML
On Mon, Jul 14, 2008 at 9:49 AM, Suresh Siddha
<suresh.b.siddha@intel.com> wrote:
> On Mon, Jul 14, 2008 at 12:12:07AM -0700, Ingo Molnar wrote:
>>
>> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>>
>> > fix for pv.
>> >
>> > Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>>
>> applied to tip/x86/x2apic - thanks Yinghai.
>
> Ingo, before you try for the third attempt ;) we need one more lguest apic_ops
> fix. Patch appended. Thanks.
>
> ---
> [patch] x86: apic_ops for lguest
>
> apic_ops for lguest.
>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> Cc: Yinghai Lu <yhlu.kernel@gmail.com>
> ---
>
> Index: x86.git/arch/x86/lguest/boot.c
> ===================================================================
> --- x86.git.orig/arch/x86/lguest/boot.c 2008-07-14 09:44:31.000000000 -0700
> +++ x86.git/arch/x86/lguest/boot.c 2008-07-14 09:45:12.000000000 -0700
> @@ -791,6 +791,37 @@
> {
> return 0;
> }
> +
> +static u64 lguest_apic_icr_read(void)
> +{
> + return 0;
> +}
> +
> +static void lguest_apic_icr_write(u32 low, u32 id)
> +{
> + /* Warn to see if there's any stray references */
> + WARN_ON(1);
> +}
> +
> +static void lguest_apic_wait_icr_idle(void)
> +{
> + return;
> +}
> +
> +static u32 lguest_apic_safe_wait_icr_idle(void)
> +{
> + return 0;
> +}
> +
> +static struct apic_ops lguest_basic_apic_ops = {
> + .read = lguest_apic_read,
> + .write = lguest_apic_write,
> + .write_atomic = lguest_apic_write,
> + .icr_read = lguest_apic_icr_read,
> + .icr_write = lguest_apic_icr_write,
> + .wait_icr_idle = lguest_apic_wait_icr_idle,
> + .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle,
> +};
> #endif
>
> /* STOP! Until an interrupt comes in. */
> @@ -990,9 +1021,7 @@
>
> #ifdef CONFIG_X86_LOCAL_APIC
> /* apic read/write intercepts */
> - pv_apic_ops.apic_write = lguest_apic_write;
> - pv_apic_ops.apic_write_atomic = lguest_apic_write;
> - pv_apic_ops.apic_read = lguest_apic_read;
> + apic_ops = &lguest_basic_apic_ops;
> #endif
>
> /* time operations */
do we need one for KVM pv?
YH
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 17:00 ` Yinghai Lu
@ 2008-07-14 18:03 ` Suresh Siddha
0 siblings, 0 replies; 19+ messages in thread
From: Suresh Siddha @ 2008-07-14 18:03 UTC (permalink / raw)
To: Yinghai Lu
Cc: Siddha, Suresh B, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, LKML
On Mon, Jul 14, 2008 at 10:00:28AM -0700, Yinghai Lu wrote:
> On Mon, Jul 14, 2008 at 9:49 AM, Suresh Siddha
> <suresh.b.siddha@intel.com> wrote:
> > [patch] x86: apic_ops for lguest
> >
> > apic_ops for lguest.
> >
> > Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> > Cc: Yinghai Lu <yhlu.kernel@gmail.com>
>
> do we need one for KVM pv?
No. They use different op's for complete apic virt.
thanks,
suresh
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 16:49 ` Suresh Siddha
2008-07-14 17:00 ` Yinghai Lu
@ 2008-07-18 17:06 ` Ingo Molnar
1 sibling, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2008-07-18 17:06 UTC (permalink / raw)
To: Suresh Siddha; +Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, LKML
* Suresh Siddha <suresh.b.siddha@intel.com> wrote:
> Ingo, before you try for the third attempt ;) we need one more lguest
> apic_ops fix. Patch appended. Thanks.
>
> ---
> [patch] x86: apic_ops for lguest
>
> apic_ops for lguest.
applied to tip/x86/x2apic, thanks Suresh.
Ingo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-14 5:19 ` [PATCH] x86: let 32bit use apic_ops too - fix Yinghai Lu
2008-07-14 7:12 ` Ingo Molnar
@ 2008-07-15 17:33 ` Suresh Siddha
2008-07-15 18:10 ` Yinghai Lu
2008-07-18 17:07 ` Ingo Molnar
1 sibling, 2 replies; 19+ messages in thread
From: Suresh Siddha @ 2008-07-15 17:33 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Siddha, Suresh B, LKML
On Sun, Jul 13, 2008 at 10:19:35PM -0700, Yinghai Lu wrote:
>
> fix for pv.
>
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
> ---
> arch/x86/kernel/paravirt.c | 5 ----
> arch/x86/kernel/vmi_32.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
> arch/x86/xen/enlighten.c | 19 +++++++---------
> include/asm-x86/paravirt.h | 29 -------------------------
> 4 files changed, 57 insertions(+), 47 deletions(-)
>
> Index: linux-2.6/arch/x86/kernel/paravirt.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/paravirt.c
> +++ linux-2.6/arch/x86/kernel/paravirt.c
> @@ -373,11 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = {
>
> struct pv_apic_ops pv_apic_ops = {
> #ifdef CONFIG_X86_LOCAL_APIC
> -#ifndef CONFIG_X86_64
> - .apic_write = native_apic_mem_write,
> - .apic_write_atomic = native_apic_mem_write_atomic,
> - .apic_read = native_apic_mem_read,
> -#endif
> .setup_boot_clock = setup_boot_APIC_clock,
> .setup_secondary_clock = setup_secondary_APIC_clock,
> .startup_ipi_hook = paravirt_nop,
> Index: linux-2.6/arch/x86/kernel/vmi_32.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/vmi_32.c
> +++ linux-2.6/arch/x86/kernel/vmi_32.c
> @@ -676,6 +676,50 @@ static inline int __init probe_vmi_rom(v
> return 0;
> }
>
> +#ifdef CONFIG_X86_LOCAL_APIC
> +static u32 vmi_apic_read(u32 reg)
> +{
> + return 0;
> +}
> +
> +static void vmi_apic_write(u32 reg, u32 val)
> +{
> + /* Warn to see if there's any stray references */
> + WARN_ON(1);
> +}
> +
> +static u64 vmi_apic_icr_read(void)
> +{
> + return 0;
> +}
> +
> +static void vmi_apic_icr_write(u32 low, u32 id)
> +{
> + /* Warn to see if there's any stray references */
> + WARN_ON(1);
> +}
> +
> +static void vmi_apic_wait_icr_idle(void)
> +{
> + return;
> +}
> +
> +static u32 vmi_safe_apic_wait_icr_idle(void)
> +{
> + return 0;
> +}
> +
> +static struct apic_ops vmi_basic_apic_ops = {
> + .read = vmi_apic_read,
> + .write = vmi_apic_write,
> + .write_atomic = vmi_apic_write,
> + .icr_read = vmi_apic_icr_read,
> + .icr_write = vmi_apic_icr_write,
> + .wait_icr_idle = vmi_apic_wait_icr_idle,
> + .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
> +};
> +#endif
> +
> /*
> * VMI setup common to all processors
> */
> @@ -904,9 +948,10 @@ static inline int __init activate_vmi(vo
> #endif
>
> #ifdef CONFIG_X86_LOCAL_APIC
> - para_fill(pv_apic_ops.apic_read, APICRead);
> - para_fill(pv_apic_ops.apic_write, APICWrite);
> - para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
> + para_fill(vmi_basic_apic_ops.read, APICRead);
> + para_fill(vmi_basic_apic_ops.write, APICWrite);
> + para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
> + apic_ops = &vmi_basic_apic_ops;
Yinghai, Looking more closely at this, based on my understanding this might be
wrong for VMI. Correct patch should be as follows. Any comments?
thanks,
suresh
---
Fix VMI apic_ops.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index b1375fa..3410196 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -145,6 +145,11 @@ static int modern_apic(void)
return lapic_get_version() >= 0x14;
}
+/*
+ * Paravirt kernels also might be using these below ops. So we still
+ * use generic apic_read()/apic_write(), which might be pointing to different
+ * ops in PARAVIRT case.
+ */
void xapic_wait_icr_idle(void)
{
while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index cf30743..d6897e4 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -676,50 +676,6 @@ static inline int __init probe_vmi_rom(void)
return 0;
}
-#ifdef CONFIG_X86_LOCAL_APIC
-static u32 vmi_apic_read(u32 reg)
-{
- return 0;
-}
-
-static void vmi_apic_write(u32 reg, u32 val)
-{
- /* Warn to see if there's any stray references */
- WARN_ON(1);
-}
-
-static u64 vmi_apic_icr_read(void)
-{
- return 0;
-}
-
-static void vmi_apic_icr_write(u32 low, u32 id)
-{
- /* Warn to see if there's any stray references */
- WARN_ON(1);
-}
-
-static void vmi_apic_wait_icr_idle(void)
-{
- return;
-}
-
-static u32 vmi_safe_apic_wait_icr_idle(void)
-{
- return 0;
-}
-
-static struct apic_ops vmi_basic_apic_ops = {
- .read = vmi_apic_read,
- .write = vmi_apic_write,
- .write_atomic = vmi_apic_write,
- .icr_read = vmi_apic_icr_read,
- .icr_write = vmi_apic_icr_write,
- .wait_icr_idle = vmi_apic_wait_icr_idle,
- .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
-};
-#endif
-
/*
* VMI setup common to all processors
*/
@@ -948,10 +904,9 @@ static inline int __init activate_vmi(void)
#endif
#ifdef CONFIG_X86_LOCAL_APIC
- para_fill(vmi_basic_apic_ops.read, APICRead);
- para_fill(vmi_basic_apic_ops.write, APICWrite);
- para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
- apic_ops = &vmi_basic_apic_ops;
+ para_fill(apic_ops->read, APICRead);
+ para_fill(apic_ops->write, APICWrite);
+ para_fill(apic_ops->write_atomic, APICWrite);
#endif
/*
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 17:33 ` Suresh Siddha
@ 2008-07-15 18:10 ` Yinghai Lu
2008-07-15 18:27 ` Suresh Siddha
2008-07-18 17:07 ` Ingo Molnar
1 sibling, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2008-07-15 18:10 UTC (permalink / raw)
To: Suresh Siddha; +Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, LKML
On Tue, Jul 15, 2008 at 10:33 AM, Suresh Siddha
<suresh.b.siddha@intel.com> wrote:
> On Sun, Jul 13, 2008 at 10:19:35PM -0700, Yinghai Lu wrote:
>>
>> fix for pv.
>>
>> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>>
>> ---
>> arch/x86/kernel/paravirt.c | 5 ----
>> arch/x86/kernel/vmi_32.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
>> arch/x86/xen/enlighten.c | 19 +++++++---------
>> include/asm-x86/paravirt.h | 29 -------------------------
>> 4 files changed, 57 insertions(+), 47 deletions(-)
>>
>> Index: linux-2.6/arch/x86/kernel/paravirt.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/paravirt.c
>> +++ linux-2.6/arch/x86/kernel/paravirt.c
>> @@ -373,11 +373,6 @@ struct pv_cpu_ops pv_cpu_ops = {
>>
>> struct pv_apic_ops pv_apic_ops = {
>> #ifdef CONFIG_X86_LOCAL_APIC
>> -#ifndef CONFIG_X86_64
>> - .apic_write = native_apic_mem_write,
>> - .apic_write_atomic = native_apic_mem_write_atomic,
>> - .apic_read = native_apic_mem_read,
>> -#endif
>> .setup_boot_clock = setup_boot_APIC_clock,
>> .setup_secondary_clock = setup_secondary_APIC_clock,
>> .startup_ipi_hook = paravirt_nop,
>> Index: linux-2.6/arch/x86/kernel/vmi_32.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/vmi_32.c
>> +++ linux-2.6/arch/x86/kernel/vmi_32.c
>> @@ -676,6 +676,50 @@ static inline int __init probe_vmi_rom(v
>> return 0;
>> }
>>
>> +#ifdef CONFIG_X86_LOCAL_APIC
>> +static u32 vmi_apic_read(u32 reg)
>> +{
>> + return 0;
>> +}
>> +
>> +static void vmi_apic_write(u32 reg, u32 val)
>> +{
>> + /* Warn to see if there's any stray references */
>> + WARN_ON(1);
>> +}
>> +
>> +static u64 vmi_apic_icr_read(void)
>> +{
>> + return 0;
>> +}
>> +
>> +static void vmi_apic_icr_write(u32 low, u32 id)
>> +{
>> + /* Warn to see if there's any stray references */
>> + WARN_ON(1);
>> +}
>> +
>> +static void vmi_apic_wait_icr_idle(void)
>> +{
>> + return;
>> +}
>> +
>> +static u32 vmi_safe_apic_wait_icr_idle(void)
>> +{
>> + return 0;
>> +}
>> +
>> +static struct apic_ops vmi_basic_apic_ops = {
>> + .read = vmi_apic_read,
>> + .write = vmi_apic_write,
>> + .write_atomic = vmi_apic_write,
>> + .icr_read = vmi_apic_icr_read,
>> + .icr_write = vmi_apic_icr_write,
>> + .wait_icr_idle = vmi_apic_wait_icr_idle,
>> + .safe_wait_icr_idle = vmi_safe_apic_wait_icr_idle,
>> +};
>> +#endif
>> +
>> /*
>> * VMI setup common to all processors
>> */
>> @@ -904,9 +948,10 @@ static inline int __init activate_vmi(vo
>> #endif
>>
>> #ifdef CONFIG_X86_LOCAL_APIC
>> - para_fill(pv_apic_ops.apic_read, APICRead);
>> - para_fill(pv_apic_ops.apic_write, APICWrite);
>> - para_fill(pv_apic_ops.apic_write_atomic, APICWrite);
>> + para_fill(vmi_basic_apic_ops.read, APICRead);
>> + para_fill(vmi_basic_apic_ops.write, APICWrite);
>> + para_fill(vmi_basic_apic_ops.write_atomic, APICWrite);
>> + apic_ops = &vmi_basic_apic_ops;
>
> Yinghai, Looking more closely at this, based on my understanding this might be
> wrong for VMI. Correct patch should be as follows. Any comments?
so you mean icr related will still use default native member?
YH
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 18:10 ` Yinghai Lu
@ 2008-07-15 18:27 ` Suresh Siddha
0 siblings, 0 replies; 19+ messages in thread
From: Suresh Siddha @ 2008-07-15 18:27 UTC (permalink / raw)
To: Yinghai Lu
Cc: Siddha, Suresh B, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, LKML
On Tue, Jul 15, 2008 at 11:10:37AM -0700, Yinghai Lu wrote:
> On Tue, Jul 15, 2008 at 10:33 AM, Suresh Siddha
> <suresh.b.siddha@intel.com> wrote:
> > Yinghai, Looking more closely at this, based on my understanding this might be
> > wrong for VMI. Correct patch should be as follows. Any comments?
>
> so you mean icr related will still use default native member?
Yes. This is similar to pre apic_ops.
I think VMI uses apic operations in the paravirt case. For example,
please refer to vmi_time_bsp_init/vmi_time_ap_init.
thanks,
suresh
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] x86: let 32bit use apic_ops too - fix
2008-07-15 17:33 ` Suresh Siddha
2008-07-15 18:10 ` Yinghai Lu
@ 2008-07-18 17:07 ` Ingo Molnar
1 sibling, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2008-07-18 17:07 UTC (permalink / raw)
To: Suresh Siddha; +Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, LKML
* Suresh Siddha <suresh.b.siddha@intel.com> wrote:
> Yinghai, Looking more closely at this, based on my understanding this
> might be wrong for VMI. Correct patch should be as follows. Any
> comments?
applied to tip/x86/x2apic (with some fixups), thanks Suresh.
Ingo
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2008-07-18 17:08 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-15 18:38 Patch from LKML Zachary Amsden
2008-07-15 18:51 ` [PATCH] x86: let 32bit use apic_ops too - fix Suresh Siddha
2008-07-15 19:04 ` Zachary Amsden
2008-07-15 19:10 ` Yinghai Lu
2008-07-15 19:19 ` Zachary Amsden
2008-07-15 19:22 ` Yinghai Lu
2008-07-15 19:24 ` Zachary Amsden
2008-07-15 18:52 ` Patch from LKML Yinghai Lu
2008-07-15 18:57 ` Zachary Amsden
-- strict thread matches above, loose matches on Subject: below --
2008-07-08 8:41 [PATCH] x86: introduce page_size_mask for 64bit Yinghai Lu
2008-07-11 3:38 ` [PATCH] x86: introduce max_low_pfn_mapped " Yinghai Lu
2008-07-12 1:41 ` [PATCH] x86: let 32bit use apic_ops too Yinghai Lu
2008-07-14 5:19 ` [PATCH] x86: let 32bit use apic_ops too - fix Yinghai Lu
2008-07-14 7:12 ` Ingo Molnar
2008-07-14 16:49 ` Suresh Siddha
2008-07-14 17:00 ` Yinghai Lu
2008-07-14 18:03 ` Suresh Siddha
2008-07-18 17:06 ` Ingo Molnar
2008-07-15 17:33 ` Suresh Siddha
2008-07-15 18:10 ` Yinghai Lu
2008-07-15 18:27 ` Suresh Siddha
2008-07-18 17:07 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome