From: "Jan Beulich" Subject: [PATCH 3/4] x86/hpet: clear unwanted bits Date: Tue, 27 Mar 2012 11:46:50 +0100 Message-ID: <4F71B6BA020000780007B1B6@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4668758A.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4668758A.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Leaving certain bits set when being started from an environment where the HPET was already in use can affect functionality. Clear those bits to be on the safe side. We should also consider ignoring the HPET altogether if any reserved bits are found to be set. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -537,7 +537,7 @@ void __init hpet_broadcast_init(void) { /* set HPET Tn as oneshot */ cfg =3D hpet_read32(HPET_Tn_CFG(hpet_events[i].idx)); - cfg &=3D ~HPET_TN_PERIODIC; + cfg &=3D ~(HPET_TN_LEVEL | HPET_TN_PERIODIC | HPET_TN_FSB); cfg |=3D HPET_TN_ENABLE | HPET_TN_32BIT; hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx)); =20 @@ -594,7 +594,7 @@ void hpet_broadcast_resume(void) =20 /* set HPET Tn as oneshot */ cfg =3D hpet_read32(HPET_Tn_CFG(hpet_events[i].idx)); - cfg &=3D ~HPET_TN_PERIODIC; + cfg &=3D ~(HPET_TN_LEVEL | HPET_TN_PERIODIC | HPET_TN_FSB); cfg |=3D HPET_TN_ENABLE | HPET_TN_32BIT; hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].idx)); =20 --- a/xen/include/asm-x86/hpet.h +++ b/xen/include/asm-x86/hpet.h @@ -32,9 +32,11 @@ #define HPET_LEGACY_8254 2 #define HPET_LEGACY_RTC 8 =20 +#define HPET_TN_LEVEL 0x002 #define HPET_TN_ENABLE 0x004 #define HPET_TN_PERIODIC 0x008 #define HPET_TN_PERIODIC_CAP 0x010 +#define HPET_TN_64BIT_CAP 0x020 #define HPET_TN_SETVAL 0x040 #define HPET_TN_32BIT 0x100 #define HPET_TN_ROUTE 0x3e00 --=__Part4668758A.0__= Content-Type: text/plain; name="x86-hpet-clear-unwanted-bits.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-hpet-clear-unwanted-bits.patch" x86/hpet: clear unwanted bits=0A=0ALeaving certain bits set when being = started from an environment where=0Athe HPET was already in use can affect = functionality. Clear those bits=0Ato be on the safe side.=0A=0AWe should = also consider ignoring the HPET altogether if any reserved=0Abits are = found to be set.=0A=0ASigned-off-by: Jan Beulich =0A=0A-= -- a/xen/arch/x86/hpet.c=0A+++ b/xen/arch/x86/hpet.c=0A@@ -537,7 +537,7 @@ = void __init hpet_broadcast_init(void)=0A {=0A /* set HPET Tn = as oneshot */=0A cfg =3D hpet_read32(HPET_Tn_CFG(hpet_events[i].idx= ));=0A- cfg &=3D ~HPET_TN_PERIODIC;=0A+ cfg &=3D ~(HPET_TN_LE= VEL | HPET_TN_PERIODIC | HPET_TN_FSB);=0A cfg |=3D HPET_TN_ENABLE = | HPET_TN_32BIT;=0A hpet_write32(cfg, HPET_Tn_CFG(hpet_events[i].id= x));=0A =0A@@ -594,7 +594,7 @@ void hpet_broadcast_resume(void)=0A =0A = /* set HPET Tn as oneshot */=0A cfg =3D hpet_read32(HPET_Tn_CFG= (hpet_events[i].idx));=0A- cfg &=3D ~HPET_TN_PERIODIC;=0A+ = cfg &=3D ~(HPET_TN_LEVEL | HPET_TN_PERIODIC | HPET_TN_FSB);=0A cfg = |=3D HPET_TN_ENABLE | HPET_TN_32BIT;=0A hpet_write32(cfg, = HPET_Tn_CFG(hpet_events[i].idx));=0A =0A--- a/xen/include/asm-x86/hpet.h=0A= +++ b/xen/include/asm-x86/hpet.h=0A@@ -32,9 +32,11 @@=0A #define = HPET_LEGACY_8254 2=0A #define HPET_LEGACY_RTC 8=0A = =0A+#define HPET_TN_LEVEL 0x002=0A #define HPET_TN_ENABLE = 0x004=0A #define HPET_TN_PERIODIC 0x008=0A #define HPET_TN_PERIODIC_C= AP 0x010=0A+#define HPET_TN_64BIT_CAP 0x020=0A #define HPET_TN_SE= TVAL 0x040=0A #define HPET_TN_32BIT 0x100=0A #define = HPET_TN_ROUTE 0x3e00=0A --=__Part4668758A.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part4668758A.0__=--