From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 6/8] x86/time: support 32-bit wide ACPI PM timer Date: Wed, 15 Jun 2016 04:29:27 -0600 Message-ID: <57614A2702000078000F53A9@prv-mh.provo.novell.com> References: <576140F302000078000F52FE@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part67515C17.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bD84h-0007qR-JG for xen-devel@lists.xenproject.org; Wed, 15 Jun 2016 10:29:31 +0000 In-Reply-To: <576140F302000078000F52FE@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Dario Faggioli , Joao Martins 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. --=__Part67515C17.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I have no idea why we didn't do so from the beginning. Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -481,22 +481,23 @@ static int __init acpi_parse_fadt(struct if (fadt->header.revision >=3D FADT2_REVISION_ID) { /* FADT rev. 2 */ if (fadt->xpm_timer_block.space_id =3D=3D - ACPI_ADR_SPACE_SYSTEM_IO) + ACPI_ADR_SPACE_SYSTEM_IO) { pmtmr_ioport =3D fadt->xpm_timer_block.address; - /* - * "X" fields are optional extensions to the original V1.0 - * fields, so we must selectively expand V1.0 fields if = the - * corresponding X field is zero. - */ - if (!pmtmr_ioport) - pmtmr_ioport =3D fadt->pm_timer_block; - } else { - /* FADT rev. 1 */ + pmtmr_width =3D fadt->xpm_timer_block.bit_width; + } + } + /* + * "X" fields are optional extensions to the original V1.0 + * fields, so we must selectively expand V1.0 fields if the + * corresponding X field is zero. + */ + if (!pmtmr_ioport) { pmtmr_ioport =3D fadt->pm_timer_block; + pmtmr_width =3D fadt->pm_timer_length =3D=3D 4 ? 24 : 0; } if (pmtmr_ioport) - printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", - pmtmr_ioport); + printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x (%u = bits)\n", + pmtmr_ioport, pmtmr_width); #endif =20 acpi_smi_cmd =3D fadt->smi_command; --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -403,6 +403,7 @@ static struct platform_timesource __init */ =20 u32 __read_mostly pmtmr_ioport; +unsigned int __initdata pmtmr_width; =20 /* ACPI PM timer ticks at 3.579545 MHz. */ #define ACPI_PM_FREQUENCY 3579545 @@ -417,9 +418,15 @@ static s64 __init init_pmtimer(struct pl u64 start; u32 count, target, mask =3D 0xffffff; =20 - if ( pmtmr_ioport =3D=3D 0 ) + if ( !pmtmr_ioport || !pmtmr_width ) return 0; =20 + if ( pmtmr_width =3D=3D 32 ) + { + pts->counter_bits =3D 32; + mask =3D 0xffffffff; + } + count =3D inl(pmtmr_ioport) & mask; start =3D rdtsc_ordered(); target =3D count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY); --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -146,6 +146,7 @@ extern u32 x86_acpiid_to_apicid[]; #define INVALID_ACPIID (-1U) =20 extern u32 pmtmr_ioport; +extern unsigned int pmtmr_width; =20 int acpi_dmar_init(void); void acpi_mmcfg_init(void); --=__Part67515C17.1__= Content-Type: text/plain; name="x86-PMTMR-32bit.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-PMTMR-32bit.patch" x86/time: support 32-bit wide ACPI PM timer=0A=0AI have no idea why we = didn't do so from the beginning.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/acpi/boot.c=0A+++ b/xen/arch/x86/acpi/boo= t.c=0A@@ -481,22 +481,23 @@ static int __init acpi_parse_fadt(struct=0A = if (fadt->header.revision >=3D FADT2_REVISION_ID) {=0A /* FADT = rev. 2 */=0A if (fadt->xpm_timer_block.space_id =3D=3D=0A- = ACPI_ADR_SPACE_SYSTEM_IO)=0A+ ACPI_ADR_SPACE_SYSTEM_I= O) {=0A pmtmr_ioport =3D fadt->xpm_timer_block.addr= ess;=0A- /*=0A- * "X" fields are optional = extensions to the original V1.0=0A- * fields, so we must = selectively expand V1.0 fields if the=0A- * corresponding X = field is zero.=0A- */=0A- if (!pmtmr_ioport)=0A- = pmtmr_ioport =3D fadt->pm_timer_block;=0A- } else {=0A- = /* FADT rev. 1 */=0A+ pmtmr_width =3D fadt->xpm_timer_blo= ck.bit_width;=0A+ }=0A+ }=0A+ /*=0A+ * "X" fields are = optional extensions to the original V1.0=0A+ * fields, so we must = selectively expand V1.0 fields if the=0A+ * corresponding X field = is zero.=0A+ */=0A+ if (!pmtmr_ioport) {=0A pmtmr_iopor= t =3D fadt->pm_timer_block;=0A+ pmtmr_width =3D fadt->pm_timer_leng= th =3D=3D 4 ? 24 : 0;=0A }=0A if (pmtmr_ioport)=0A- = printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",=0A- = pmtmr_ioport);=0A+ printk(KERN_INFO PREFIX "PM-Timer IO Port: = %#x (%u bits)\n",=0A+ pmtmr_ioport, pmtmr_width);=0A = #endif=0A =0A acpi_smi_cmd =3D fadt->smi_command;=0A--- a/xen/arch/= x86/time.c=0A+++ b/xen/arch/x86/time.c=0A@@ -403,6 +403,7 @@ static struct = platform_timesource __init=0A */=0A =0A u32 __read_mostly pmtmr_ioport;=0A= +unsigned int __initdata pmtmr_width;=0A =0A /* ACPI PM timer ticks at = 3.579545 MHz. */=0A #define ACPI_PM_FREQUENCY 3579545=0A@@ -417,9 +418,15 = @@ static s64 __init init_pmtimer(struct pl=0A u64 start;=0A u32 = count, target, mask =3D 0xffffff;=0A =0A- if ( pmtmr_ioport =3D=3D 0 = )=0A+ if ( !pmtmr_ioport || !pmtmr_width )=0A return 0;=0A =0A+ = if ( pmtmr_width =3D=3D 32 )=0A+ {=0A+ pts->counter_bits =3D = 32;=0A+ mask =3D 0xffffffff;=0A+ }=0A+=0A count =3D = inl(pmtmr_ioport) & mask;=0A start =3D rdtsc_ordered();=0A target = =3D count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);=0A--- a/xen/include/asm-x86= /acpi.h=0A+++ b/xen/include/asm-x86/acpi.h=0A@@ -146,6 +146,7 @@ extern = u32 x86_acpiid_to_apicid[];=0A #define INVALID_ACPIID (-1U)=0A = =0A extern u32 pmtmr_ioport;=0A+extern unsigned int pmtmr_width;=0A =0A = int acpi_dmar_init(void);=0A void acpi_mmcfg_init(void);=0A --=__Part67515C17.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__Part67515C17.1__=--