|
13 | 13 | #include <asm/i387.h>
|
14 | 14 | #include <mach_apic.h>
|
15 | 15 | #include <asm/hvm/support.h>
|
| 16 | +#include <asm/intel_txt.h> |
16 | 17 |
|
17 | 18 | #include "cpu.h"
|
18 | 19 |
|
@@ -525,6 +526,47 @@ static void intel_log_freq(const struct cpuinfo_x86 *c)
|
525 | 526 | printk("%u MHz\n", (factor * max_ratio + 50) / 100);
|
526 | 527 | }
|
527 | 528 |
|
| 529 | +/* |
| 530 | + * Print out the SMX and TXT capabilties, so that dom0 can determine if system |
| 531 | + * is DRTM capable |
| 532 | + */ |
| 533 | +static void intel_log_smx_txt(struct cpuinfo_x86 *c) |
| 534 | +{ |
| 535 | + unsigned long cr4_val, getsec_caps; |
| 536 | + |
| 537 | + /* Run only on BSP to report the SMX/TXT caps only once */ |
| 538 | + if (smp_processor_id()) |
| 539 | + return; |
| 540 | + |
| 541 | + printk("CPU: SMX capability "); |
| 542 | + if (!test_bit(X86_FEATURE_SMX, &boot_cpu_data.x86_capability)) { |
| 543 | + printk("not supported\n"); |
| 544 | + return; |
| 545 | + } |
| 546 | + printk("supported\n"); |
| 547 | + |
| 548 | + /* Can't run GETSEC without VMX and SMX */ |
| 549 | + if (!test_bit(X86_FEATURE_VMX, &boot_cpu_data.x86_capability)) |
| 550 | + return; |
| 551 | + |
| 552 | + cr4_val = read_cr4(); |
| 553 | + if (!(cr4_val & X86_CR4_SMXE)) |
| 554 | + write_cr4(cr4_val | X86_CR4_SMXE); |
| 555 | + |
| 556 | + asm volatile ("getsec\n" |
| 557 | + : "=a" (getsec_caps) |
| 558 | + : "a" (GETSEC_CAPABILITIES), "b" (0) :); |
| 559 | + |
| 560 | + if (getsec_caps & GETSEC_CAP_TXT_CHIPSET) |
| 561 | + printk("Chipset supports TXT\n"); |
| 562 | + else |
| 563 | + printk("Chipset does not support TXT\n"); |
| 564 | + |
| 565 | + if (!(cr4_val & X86_CR4_SMXE)) |
| 566 | + write_cr4(cr4_val & ~X86_CR4_SMXE); |
| 567 | + |
| 568 | +} |
| 569 | + |
528 | 570 | static void cf_check init_intel(struct cpuinfo_x86 *c)
|
529 | 571 | {
|
530 | 572 | /* Detect the extended topology information if available */
|
@@ -565,6 +607,8 @@ static void cf_check init_intel(struct cpuinfo_x86 *c)
|
565 | 607 | detect_ht(c);
|
566 | 608 | }
|
567 | 609 |
|
| 610 | + intel_log_smx_txt(c); |
| 611 | + |
568 | 612 | /* Work around errata */
|
569 | 613 | Intel_errata_workarounds(c);
|
570 | 614 |
|
|
0 commit comments