aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/tboot.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* printk: prefer %#x et at over 0x%xJan Beulich2012-09-211-6/+6
| | | | | | | | | Performance is not an issue with printk(), so let the function do minimally more work and instead save a byte per affected format specifier. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: add a new SMP bring up way for tboot caseWei, Gang2012-01-111-0/+14
| | | | | | | | | | | | | | | | | From: Wei, Gang <gang.wei@intel.com> tboot may be trying to put APs waiting in MWAIT loops before launching Xen. Xen could check the new flag field in v6 tboot shared page for the hint. If TB_FLAG_AP_WAKE_SUPPORT bit in flag field is set, Xen BSP have to write the monitored memory(g_tboot_shared->ap_wake_trigger) to bring APs out of MWAIT loops. The sipi vector should be written in g_tboot_shared->ap_wake_addr before waking up APs. Signed-off-by: Joseph Cihula <joseph.cihula@intel.com> Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Gang Wei <gang.wei@intel.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* x86/tboot: fix some coding style issues in tboot.cGang Wei2012-01-021-17/+21
| | | | | | Signed-off-by: Gang Wei <gang.wei@intel.com> Acked-by: Joseph Cihula <joseph.cihula@intel.com> Committed-by: Keir Fraser <keir@xen.org>
* introduce and use nr_cpu_ids and nr_cpumask_bitsJan Beulich2011-10-211-1/+1
| | | | | | | | | | | | | | | The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS, where necessary, get adjusted accordingly), while the latter is for the sole use of determining the allocation size when dynamically allocating CPU masks (done later in this series). Adjust accessors to use either of the two to bound their bitmap operations - which one gets used depends on whether accessing the bits in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more efficient. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/tboot: make resume error messages visibleJan Beulich2011-09-171-14/+29
| | | | | | | | | With tboot_s3_resume() running before console_resume(), the error messages so far printed by it are mostly guaranteed to go into nirwana. Latch MACs into a static variable instead, and issue the messages right before calling panic(). Signed-off-by: Jan Beulich <jbeulich@suse.com>
* xen: remove more declarations from C files.Tim Deegan2011-05-271-1/+0
| | | | | | | | | | This patch moves some more, mostly data, extern declarations into header files. I haven't been as strict as I was with functions; in particular there are a number of declarations of assembler labels that are only used in one place. I've also left a few compat-mode tricks, and all the magic in symbols.c Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* Define new <pfn.h> header for PFN_{DOWN,UP} macros.Keir Fraser2011-03-231-0/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* move various bits into .init.* sectionsJan Beulich2011-03-091-2/+2
| | | | | | | | | | This also includes the removal of some entirely unused functions. The patch builds upon the makefile adjustments done in the earlier sent patch titled "move more kernel decompression bits to .init.* sections". Signed-off-by: Jan Beulich <jbeulich@novell.com>
* vtd: Reinstate ACPI DMAR on system shutdown or S3/S4/S5.Keir Fraser2010-12-171-7/+2
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86: Add -Wredundant-decls to Xen build flags.Keir Fraser2010-12-021-1/+1
| | | | | | Fix up the fallout. Signed-off-by: Keir Fraser <keir@xen.org>
* kexec: Clean up shutdown logic. Reinstate ACPI DMAR during kexec.Keir Fraser2010-07-291-1/+4
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Walking the page lists needs the page_alloc lockKeir Fraser2010-07-281-0/+2
| | | | | | | | | | | | | | | | | There are a few places in Xen where we walk a domain's page lists without holding the page_alloc lock. They race with updates to the page lists, which are normally rare but can be quite common under PoD when the domain is close to its memory limit and the PoD reclaimer is busy. This patch protects those places by taking the page_alloc lock. I think this is OK for the two debug-key printouts - they don't run from irq context and look deadlock-free. The tboot change seems safe too unless tboot shutdown functions are called from irq context or with the page_alloc lock held. The p2m one is the scariest but there are already code paths in PoD that take the page_alloc lock with the p2m lock held so it's no worse than existing code. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* x86: Force !in_irq() in machine_restart().Keir Fraser2010-06-071-5/+0
| | | | | | | Various function we may call assert this fact. We just want to restart the system. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Dynamically allocate percpu data area when a CPU comes online.Keir Fraser2010-05-181-7/+3
| | | | | | At the same time, the data area starts life zeroed. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* intel_txt: to fix intel txt S3 resume failure since c/s 21108Keir Fraser2010-05-171-6/+6
| | | | | | | | | | This patch is to fix S3 resume failure with Intel TXT/tboot launched, brought by c/s 21108. Don't printk anything between two tboot_gen_xenheap_integrity() calls for release build or debug build. Or else xen heap will be changed, which causes that memory integrity will be lost on S3 resume. Signed-off-by: Shane Wang <shane.wang@intel.com>
* tboot: fix S3 issue for Intel Trusted Execution Technology.Keir Fraser2010-02-031-4/+56
| | | | | | | Those unmapped pages cause page fault when MACing them and finally cause S3 failure. Signed-off-by: Shane Wang <shane.wang@intel.com>
* Miscellaneous data placement adjustmentsKeir Fraser2009-10-281-3/+3
| | | | | | | Make various data items const or __read_mostly where possible/reasonable. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86: Fix the build.Keir Fraser2009-09-221-9/+9
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tboot: fix tboot memory mapping for 32bKeir Fraser2009-09-221-40/+52
| | | | | | | | | | This patch used fixmap to get TXT heap base/size and SINIT base/size from TXT pub config registers (whose address starts from 0xfed20000), and get DMAR table copy from TXT heap (whose address may start from 0x7d520000) for tboot, instead of using map_pages_to_xen(), which will cause panic on x86_32. Signed-off-by: Shane Wang <shane.wang@intel.com>
* Introduce new flavour of map_domain_page()Keir Fraser2009-09-221-2/+1
| | | | | | | | | | | | | Introduce a variant of map_domain_page() directly getting passed a struct page_info * argument, based on the observation that in many places the argument to this function so far simply was the result of page_to_mfn(). This is meaningful for the x86-64 case where map_domain_page() really just is an invocation of mfn_to_virt(), and hence the combined mfn_to_virt(page_to_mfn()) now represents a needless round trip conversion compressed -> uncompressed -> compressed of the MFN representation. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86-64: reduce range spanned by 1:1 mapping and frame table indexesKeir Fraser2009-09-221-1/+7
| | | | | | | | | | | | | | | | | Introduces a virtual space conserving transformation on the MFN thus far used to index 1:1 mapping and frame table, removing the largest range of contiguous bits (below the most significant one) which are zero for all valid MFNs from the MFN representation, to be used to index into those arrays, thereby cutting the virtual range these tables must cover approximately by half with each bit removed. Since this should account for hotpluggable memory (in order to not requiring a re-write when that gets supported), the determination of which bits are candidates for removal must not be based on the E820 information, but instead has to use the SRAT. That in turn requires a change to the ordering of steps done during early boot. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Replace boot-time free-pages bitmap with a region list.Keir Fraser2009-07-081-6/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86 tboot: Fix c/s 19577Keir Fraser2009-06-291-1/+0
| | | | Signed-off-by: Shane Wang <shane.wang@intel.com>
* x86 vtd: Do not exclude freed percpu areas from dom0 vtd tables.Keir Fraser2009-04-251-3/+4
| | | | | Signed-off-by: Qing He <qing.he@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* tboot: Fix return code for S3 integrityKeir Fraser2009-03-061-1/+1
| | | | | | | | | The original patch left in a debug return value from one of the memory integrity checks. This patch returns the correct error code in case of a failure. This was re-tested to ensure that it still passes for the expected case. Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* txt: perform per-domain (and frametable and xenheap) MAC on entry intoKeir Fraser2009-03-031-22/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | S3 and verification on resume. The MAC algorithm is called VMAC and was developed by Ted Krovetz and Wei Dai (more details are in the files). It is based on a universal hash function. The universal hash is passed through a pseudo-random function, implemented using AES. More details can be found at http://fastcrypto.org/vmac/. = The AES code comes from the OpenBSD implementation (which is derived from the implementation referenced in VMAC site). As Xen does not have a good source of entropy to generate its own key (for the keyed hash), it uses the key that tboot passes in. Although the code attempts to MAC all of a domain's pages (code/data, VT-d tables) based on its s3_integrity flag, some of a domain's memory may always be MAC'ed, e.g. shadow page tables. Only xenheap pages that are in use are MAC'ed. We believe that the memory MAC'ed by the Xen code and the ranges passed to tboot to MAC cover all of the memory whose integrity needs to be protected on S3. Any suggestions or ranges that we missed are welcome. Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* tboot: use TXT's DMA-protected DMAR table to setup VT-dKeir Fraser2009-01-291-17/+111
| | | | Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* tboot: tboot no longer marks TXT regions as E820_UNUSABLE, so Xen mustKeir Fraser2009-01-291-0/+65
| | | | | | | explicitly disallow them itself. Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* tboot: hypervisor integrity on S3Keir Fraser2009-01-291-0/+21
| | | | | | | | When launched from tboot, utilise tboot interface to provide integrity protection to the hypervisor during S3 Signed-off-by: Joseph Cihula <joseph.cihula@intel.com> ACKed-by: Shane Wang <shane.wang@intel.com>
* tboot: ACPI Generic Address Structure for tboot shutdownKeir Fraser2009-01-291-19/+12
| | | | | | | | | | New versions of tboot support ACPI GAS (Generic Address Structure) for handling sleep states. This required a change to the tboot_shared_t data structure that is not backwards compatible. This patch requires that new version makes use of GAS when invoking tboot on shutdown. Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* tboot: single tboot entry point for shutdownKeir Fraser2009-01-291-7/+2
| | | | | | | tboot removed the shutdown_entry32 and shutdown_entry64 from tboot_shared_t and now has just a single shutdown_entry field. Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* vt-d: Do not explicitly exclude tboot ranges from dom0 vt-dKeir Fraser2009-01-251-12/+0
| | | | | | | mappings. tboot is not registered as RAM in e820 tables, and hence will not be mapped anyway (fails memory_is_conventional_ram() check). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Fix 17725:c0c0f4fa8850: use type paddr_t instead of unsigned long for ↵Keir Fraser2008-05-271-3/+3
| | | | | | | | physcial memory address Otherwise, the address overflows on PAE system with memory size > 4G. Signed-off-by: Yang, Xiaowei <xiaowei.yang@intel.com>
* VT-d: remove Xen and tboot range from dom0's VT-d tableKeir Fraser2008-05-261-0/+12
| | | | | | | | | | | This a step forward to fix the security hole introduced by dom0's 1:1 mapping VT-d table: remove the critical code and data from it. The more flexible solution is to update dom0's VT-d table on demand as what will be done for other PV domains. However, there could bring a performance issue even with software optimization. Iotlb flush of some hardware is time-consuming. Signed-off-by: Yang, Xiaowei <xiaowei.yang@intel.com>
* tboot, xen: Update for Trusted Boot v20071128.Keir Fraser2007-12-041-2/+39
| | | | | | | | | | | | | | | This patch updates the Xen to work with the latest version (20071128) of Trusted Boot (tboot). This version of tboot now resides at 16MB (instead of the previous <1MB), in addition to several other enhancements. By residing at 16MB, this version of tboot will be protected from access by dom0. This patch allows Xen to correctly map the tboot shutdown code that it must trampoline into for a clean shutdown (without this patch Xen will fault on shutdown). This patch will also work with the previous version of tboot. Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
* Intel(R) Trusted Execution Technology (Intel(R) TXT) support for Xen.Keir Fraser2007-10-301-0/+70
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>