rpms/kernel/F-11 hpet-fixes.patch, 1.1, 1.2 kernel.spec, 1.1573, 1.1574

Kyle McMartin kyle at fedoraproject.org
Mon Apr 27 19:31:04 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18839

Modified Files:
	hpet-fixes.patch kernel.spec 
Log Message:
* Mon Apr 27 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.1-112
- 7a6f9cbb: x86: hpet: fix periodic mode programming on AMD 81xx


hpet-fixes.patch:

Index: hpet-fixes.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/hpet-fixes.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hpet-fixes.patch	24 Apr 2009 14:31:07 -0000	1.1
+++ hpet-fixes.patch	27 Apr 2009 19:30:33 -0000	1.2
@@ -1,3 +1,30 @@
+commit ef1e38c25baa3e6867270f207367bebcffab31b8
+Author: Andreas Herrmann <andreas.herrmann3 at amd.com>
+Date:   Tue Apr 21 20:00:37 2009 +0200
+
+    x86: hpet: fix periodic mode programming on AMD 81xx
+    
+    (See http://bugzilla.kernel.org/show_bug.cgi?id=12961)
+    
+    It partially reverts commit c23e253e67c9d8a91a0ffa33c1f571a17f0a2403
+    (x86: hpet: stop HPET_COUNTER when programming periodic mode)
+    
+    HPET on AMD 81xx chipset needs a second write (with HPET_TN_SETVAL
+    cleared) to T0_CMP register to set the period in periodic mode.
+    
+    With this patch HPET_COUNTER is still stopped but not reset when HPET
+    is programmed in periodic mode. This should help to avoid races when
+    HPET is programmed in periodic mode and fixes a boot time hang that
+    I've observed on a machine when using 1000HZ.
+    
+    [ Impact: fix boot time hang on machines with AMD 81xx chipset ]
+    
+    Reported-by: Jeff Mahoney <jeffm at suse.com>
+    Signed-off-by: Andreas Herrmann <andreas.herrmann3 at amd.com>
+    Tested-by: Jeff Mahoney <jeffm at suse.com>
+    LKML-Reference: <20090421180037.GA2763 at alberich.amd.com>
+    Signed-off-by: Ingo Molnar <mingo at elte.hu>
+
 commit 7bad863035a98d0dd45ceb29c66b9c2ed90e595e
 Author: Andreas Herrmann <andreas.herrmann3 at amd.com>
 Date:   Sat Feb 21 00:16:35 2009 +0100
@@ -63,7 +90,7 @@
  	com20020=	[HW,NET] ARCnet - COM20020 chipset
  			Format:
 diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
-index a00545f..648b3a2 100644
+index a00545f..b30f79c 100644
 --- a/arch/x86/kernel/hpet.c
 +++ b/arch/x86/kernel/hpet.c
 @@ -80,6 +80,7 @@ static inline void hpet_clear_mapping(void)
@@ -127,7 +154,7 @@
  /*
   * When the hpet driver (/dev/hpet) is enabled, we need to reserve
   * timer 0 and timer 1 in case of RTC emulation.
-@@ -191,27 +231,37 @@ static struct clock_event_device hpet_clockevent = {
+@@ -191,27 +231,42 @@ static struct clock_event_device hpet_clockevent = {
  	.rating		= 50,
  };
  
@@ -138,6 +165,10 @@
 -
  	cfg &= ~HPET_CFG_ENABLE;
  	hpet_writel(cfg, HPET_CFG);
++}
++
++static void hpet_reset_counter(void)
++{
  	hpet_writel(0, HPET_COUNTER);
  	hpet_writel(0, HPET_COUNTER + 4);
 +}
@@ -152,6 +183,7 @@
 +static void hpet_restart_counter(void)
 +{
 +	hpet_stop_counter();
++	hpet_reset_counter();
 +	hpet_start_counter();
 +}
 +
@@ -169,24 +201,15 @@
  }
  
  static void hpet_enable_legacy_int(void)
-@@ -259,29 +309,23 @@ static int hpet_setup_msi_irq(unsigned int irq);
- static void hpet_set_mode(enum clock_event_mode mode,
- 			  struct clock_event_device *evt, int timer)
- {
--	unsigned long cfg, cmp, now;
-+	unsigned long cfg;
- 	uint64_t delta;
+@@ -264,6 +319,7 @@ static void hpet_set_mode(enum clock_event_mode mode,
  
  	switch (mode) {
  	case CLOCK_EVT_MODE_PERIODIC:
 +		hpet_stop_counter();
  		delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult;
  		delta >>= evt->shift;
--		now = hpet_readl(HPET_COUNTER);
--		cmp = now + (unsigned long) delta;
- 		cfg = hpet_readl(HPET_Tn_CFG(timer));
- 		/* Make sure we use edge triggered interrupts */
- 		cfg &= ~HPET_TN_LEVEL;
+ 		now = hpet_readl(HPET_COUNTER);
+@@ -274,14 +330,18 @@ static void hpet_set_mode(enum clock_event_mode mode,
  		cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
  		       HPET_TN_SETVAL | HPET_TN_32BIT;
  		hpet_writel(cfg, HPET_Tn_CFG(timer));
@@ -195,15 +218,22 @@
 -		 * config register sets the counter value, the second
 -		 * write sets the period.
 -		 */
--		hpet_writel(cmp, HPET_Tn_CMP(timer));
--		udelay(1);
+ 		hpet_writel(cmp, HPET_Tn_CMP(timer));
+ 		udelay(1);
++		/*
++		 * HPET on AMD 81xx needs a second write (with HPET_TN_SETVAL
++		 * cleared) to T0_CMP to set the period. The HPET_TN_SETVAL
++		 * bit is automatically cleared after the first write.
++		 * (See AMD-8111 HyperTransport I/O Hub Data Sheet,
++		 * Publication # 24674)
++		 */
  		hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
 +		hpet_start_counter();
 +		hpet_print_config();
  		break;
  
  	case CLOCK_EVT_MODE_ONESHOT:
-@@ -308,6 +352,7 @@ static void hpet_set_mode(enum clock_event_mode mode,
+@@ -308,6 +368,7 @@ static void hpet_set_mode(enum clock_event_mode mode,
  			irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
  			enable_irq(hdev->irq);
  		}
@@ -211,7 +241,7 @@
  		break;
  	}
  }
-@@ -526,6 +571,7 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
+@@ -526,6 +587,7 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
  
  	num_timers = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT);
  	num_timers++; /* Value read out starts from 0 */
@@ -219,7 +249,7 @@
  
  	hpet_devs = kzalloc(sizeof(struct hpet_dev) * num_timers, GFP_KERNEL);
  	if (!hpet_devs)
-@@ -695,7 +741,7 @@ static struct clocksource clocksource_hpet = {
+@@ -695,7 +757,7 @@ static struct clocksource clocksource_hpet = {
  	.mask		= HPET_MASK,
  	.shift		= HPET_SHIFT,
  	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
@@ -228,7 +258,7 @@
  #ifdef CONFIG_X86_64
  	.vread		= vread_hpet,
  #endif
-@@ -707,7 +753,7 @@ static int hpet_clocksource_register(void)
+@@ -707,7 +769,7 @@ static int hpet_clocksource_register(void)
  	cycle_t t1;
  
  	/* Start the counter */
@@ -237,7 +267,7 @@
  
  	/* Verify whether hpet counter works */
  	t1 = read_hpet();
-@@ -793,6 +839,7 @@ int __init hpet_enable(void)
+@@ -793,6 +855,7 @@ int __init hpet_enable(void)
  	 * information and the number of channels
  	 */
  	id = hpet_readl(HPET_ID);
@@ -245,7 +275,7 @@
  
  #ifdef CONFIG_HPET_EMULATE_RTC
  	/*
-@@ -845,6 +892,7 @@ static __init int hpet_late_init(void)
+@@ -845,6 +908,7 @@ static __init int hpet_late_init(void)
  		return -ENODEV;
  
  	hpet_reserve_platform_timers(hpet_readl(HPET_ID));


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1573
retrieving revision 1.1574
diff -u -r1.1573 -r1.1574
--- kernel.spec	24 Apr 2009 14:32:20 -0000	1.1573
+++ kernel.spec	27 Apr 2009 19:30:33 -0000	1.1574
@@ -1988,6 +1988,9 @@
 # and build.
 
 %changelog
+* Mon Apr 27 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.1-112
+- 7a6f9cbb: x86: hpet: fix periodic mode programming on AMD 81xx
+
 * Fri Apr 24 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.1-111
 - backport hpet fixes from 2.6.30-rc3.
 




More information about the fedora-extras-commits mailing list