[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/time: support 32-bit wide ACPI PM timer



commit 2e4c6154d4809c5066a63e30c64c3018665bb975
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Aug 4 10:03:28 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 4 10:03:28 2016 +0200

    x86/time: support 32-bit wide ACPI PM timer
    
    I have no idea why we didn't do so from the beginning.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Tested-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Tested-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/acpi/boot.c   | 25 +++++++++++++------------
 xen/arch/x86/time.c        |  9 ++++++++-
 xen/include/asm-x86/acpi.h |  1 +
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 385c0be..a2db18c 100644
--- 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 
acpi_table_header *table)
        if (fadt->header.revision >= FADT2_REVISION_ID) {
                /* FADT rev. 2 */
                if (fadt->xpm_timer_block.space_id ==
-                   ACPI_ADR_SPACE_SYSTEM_IO)
+                   ACPI_ADR_SPACE_SYSTEM_IO) {
                        pmtmr_ioport = 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 = fadt->pm_timer_block;
-       } else {
-               /* FADT rev. 1 */
+                       pmtmr_width = 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 = fadt->pm_timer_block;
+               pmtmr_width = fadt->pm_timer_length == 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
 
        acpi_smi_cmd       = fadt->smi_command;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index de87e65..33b51d8 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -403,6 +403,7 @@ static struct platform_timesource __initdata plt_hpet =
  */
 
 u32 __read_mostly pmtmr_ioport;
+unsigned int __initdata pmtmr_width;
 
 /* ACPI PM timer ticks at 3.579545 MHz. */
 #define ACPI_PM_FREQUENCY 3579545
@@ -417,9 +418,15 @@ static s64 __init init_pmtimer(struct platform_timesource 
*pts)
     u64 start;
     u32 count, target, mask = 0xffffff;
 
-    if ( pmtmr_ioport == 0 )
+    if ( !pmtmr_ioport || !pmtmr_width )
         return 0;
 
+    if ( pmtmr_width == 32 )
+    {
+        pts->counter_bits = 32;
+        mask = 0xffffffff;
+    }
+
     count = inl(pmtmr_ioport) & mask;
     start = rdtsc_ordered();
     target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 49f7e1e..d36bee9 100644
--- 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)
 
 extern u32 pmtmr_ioport;
+extern unsigned int pmtmr_width;
 
 int acpi_dmar_init(void);
 void acpi_mmcfg_init(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.