From: Cyrill Gorcunov <gorcunov@gmail.com>
To: macro@linux-mips.org, mingo@elte.hu, tglx@linutronix.de
Cc: hpa@zytor.com, yhlu.kernel@gmail.com,
linux-kernel@vger.kernel.org,
Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [patch 3/8] x86: apic - unify __setup_APIC_LVTT
Date: Thu, 01 Jan 1970 03:00:03 +0300 [thread overview]
Message-ID: <20080814184651.681143113@gmail.com> (raw)
In-Reply-To: 20080814183428.550709025@gmail.com
[-- Attachment #1: x86-apic-unify-__setup_APIC_LVTT.patch --]
[-- Type: text/plain, Size: 1752 bytes --]
To be able to unify this function we RE-introduce
APIC_DIVISOR for 64bit mode. This snipped was eliminated
in some time ago in a sake of clenup but now we need it
again since it allow up to get rid of #ifdef(s).
And lapic_is_integrated call is added in apic_64.c but
since we always have APIC integrated on 64bit cpu compiler
will ignore this call.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 1e0b5d9..5d07689 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -244,6 +244,9 @@ int lapic_get_maxlvt(void)
return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2;
}
+/* Clock divisor is set to 1 */
+#define APIC_DIVISOR 1
+
/*
* This function sets up the local APIC timer, with a timeout of
* 'clocks' APIC bus clock. During calibration we actually call
@@ -262,6 +265,9 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
lvtt_value = LOCAL_TIMER_VECTOR;
if (!oneshot)
lvtt_value |= APIC_LVT_TIMER_PERIODIC;
+ if (!lapic_is_integrated())
+ lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
+
if (!irqen)
lvtt_value |= APIC_LVT_MASKED;
@@ -276,7 +282,7 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
| APIC_TDR_DIV_16);
if (!oneshot)
- apic_write(APIC_TMICT, clocks);
+ apic_write(APIC_TMICT, clocks / APIC_DIVISOR);
}
/*
@@ -450,7 +456,7 @@ static int __init calibrate_APIC_clock(void)
lapic_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &lapic_clockevent);
- calibration_result = result / HZ;
+ calibration_result = (result * APIC_DIVISOR) / HZ;
/*
* Do a sanity check on the APIC calibration result
--
next prev parent reply other threads:[~2008-08-14 18:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 18:34 [patch 0/8] [RFC -tip] another one step toward APIC merging Cyrill Gorcunov
1970-01-01 0:00 ` [patch 1/8] x86: apic - use SET_APIC_DEST_FIELD instead of hardcoded shift Cyrill Gorcunov
1970-01-01 0:00 ` [patch 2/8] x86: apic - unify disable_apic_timer Cyrill Gorcunov
1970-01-01 0:00 ` Cyrill Gorcunov [this message]
1970-01-01 0:00 ` [patch 4/8] x86: apic - do not clear APIC twice in lapic_shutdown Cyrill Gorcunov
1970-01-01 0:00 ` [patch 5/8] x86: apic - get rid of local_apic_timer_verify_ok Cyrill Gorcunov
1970-01-01 0:00 ` [patch 6/8] x86: apic - unify verify_local_APIC Cyrill Gorcunov
1970-01-01 0:00 ` [patch 7/8] x86: apic - unify sync_Arb_IDs Cyrill Gorcunov
2008-08-14 19:41 ` Maciej W. Rozycki
2008-08-14 20:10 ` Cyrill Gorcunov
1970-01-01 0:00 ` [patch 8/8] x86: apic - unify init_bsp_APIC Cyrill Gorcunov
2008-08-14 19:44 ` Maciej W. Rozycki
2008-08-15 6:41 ` Cyrill Gorcunov
2008-08-15 11:51 ` Ingo Molnar
2008-08-15 12:15 ` Maciej W. Rozycki
2008-08-15 13:48 ` Ingo Molnar
2008-08-15 14:45 ` Cyrill Gorcunov
2008-08-15 14:47 ` Ingo Molnar
2008-08-15 15:31 ` Maciej W. Rozycki
2008-08-15 16:35 ` Cyrill Gorcunov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080814184651.681143113@gmail.com \
--to=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@linux-mips.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=yhlu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.