- Update to Xen 4.1.3 c/s 23336

- Upstream or pending upstream patches from Jan
  25587-fix-off-by-one-parsing-error.patch
  25616-x86-MCi_CTL-default.patch
  25617-vtd-qinval-addr.patch
  25688-x86-nr_irqs_gsi.patch
- bnc#773393 - VUL-0: CVE-2012-3433: xen: HVM guest destroy p2m
  teardown host DoS vulnerability
  CVE-2012-3433-xsa11.patch
- bnc#773401 - VUL-1: CVE-2012-3432: xen: HVM guest user mode MMIO
  emulation DoS
  25682-x86-inconsistent-io-state.patch

- bnc#762484 - VUL-1: CVE-2012-2625: xen: pv bootloader doesn't
  check the size of the bzip2 or lzma compressed kernel, leading to
  denial of service
  25589-pygrub-size-limits.patch

- Make it build with latest TeXLive 2012 with new package layout

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=196
This commit is contained in:
Charles Arnold 2012-08-10 21:38:41 +00:00 committed by Git OBS Bridge
parent 8458d7092f
commit 3f55414718
175 changed files with 2583 additions and 8418 deletions

View File

@ -19,10 +19,25 @@ could be introduced.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/mm/shadow/multi.c # HG changeset patch
=================================================================== # User Jan Beulich <jbeulich@suse.com>
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/shadow/multi.c # Date 1340271059 -7200
+++ xen-4.1.2-testing/xen/arch/x86/mm/shadow/multi.c # Node ID baa85434d0ec16629ca30b7c07deaa9beb3ea9c5
# Parent d4cdcf4d541cc4ce72c48df2e26c2b506c5b04bd
x86/mm: fix mod_l1_entry() return value when encountering r/o MMIO page
While putting together the workaround announced in
http://lists.xen.org/archives/html/xen-devel/2012-06/msg00709.html, I
found that mod_l1_entry(), upon encountering a set bit in
mmio_ro_ranges, would return 1 instead of 0 (the removal of the write
permission is supposed to be entirely transparent to the caller, even
more so to the calling guest).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -872,7 +872,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl @@ -872,7 +872,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl
// If a privileged domain is attempting to install a map of a page it does // If a privileged domain is attempting to install a map of a page it does
// not own, we let it succeed anyway. // not own, we let it succeed anyway.
@ -74,11 +89,9 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/shadow/multi.c
shadow_vram_get_l1e(new_sl1e, sl1e, sl1mfn, d); shadow_vram_get_l1e(new_sl1e, sl1e, sl1mfn, d);
break; break;
} }
Index: xen-4.1.2-testing/xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c
=================================================================== +++ b/xen/arch/x86/mm.c
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c @@ -800,12 +800,12 @@ get_page_from_l1e(
+++ xen-4.1.2-testing/xen/arch/x86/mm.c
@@ -799,12 +799,12 @@ get_page_from_l1e(
bool_t write; bool_t write;
if ( !(l1f & _PAGE_PRESENT) ) if ( !(l1f & _PAGE_PRESENT) )
@ -93,7 +106,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
if ( !mfn_valid(mfn) || if ( !mfn_valid(mfn) ||
@@ -821,18 +821,21 @@ get_page_from_l1e( @@ -822,18 +822,21 @@ get_page_from_l1e(
if ( !iomem_access_permitted(pg_owner, mfn, mfn) ) if ( !iomem_access_permitted(pg_owner, mfn, mfn) )
{ {
if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */ if ( mfn != (PADDR_MASK >> PAGE_SHIFT) ) /* INVALID_MFN? */
@ -118,7 +131,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
if ( unlikely(real_pg_owner != pg_owner) ) if ( unlikely(real_pg_owner != pg_owner) )
@@ -863,6 +866,7 @@ get_page_from_l1e( @@ -864,6 +867,7 @@ get_page_from_l1e(
{ {
unsigned long x, nx, y = page->count_info; unsigned long x, nx, y = page->count_info;
unsigned long cacheattr = pte_flags_to_cacheattr(l1f); unsigned long cacheattr = pte_flags_to_cacheattr(l1f);
@ -126,7 +139,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( is_xen_heap_page(page) ) if ( is_xen_heap_page(page) )
{ {
@@ -870,7 +874,7 @@ get_page_from_l1e( @@ -871,7 +875,7 @@ get_page_from_l1e(
put_page_type(page); put_page_type(page);
put_page(page); put_page(page);
MEM_LOG("Attempt to change cache attributes of Xen heap page"); MEM_LOG("Attempt to change cache attributes of Xen heap page");
@ -135,7 +148,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
do { do {
@@ -878,7 +882,8 @@ get_page_from_l1e( @@ -879,7 +883,8 @@ get_page_from_l1e(
nx = (x & ~PGC_cacheattr_mask) | (cacheattr << PGC_cacheattr_base); nx = (x & ~PGC_cacheattr_mask) | (cacheattr << PGC_cacheattr_base);
} while ( (y = cmpxchg(&page->count_info, x, nx)) != x ); } while ( (y = cmpxchg(&page->count_info, x, nx)) != x );
@ -145,7 +158,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
cacheattr = y & PGC_cacheattr_mask; cacheattr = y & PGC_cacheattr_mask;
do { do {
@@ -894,11 +899,11 @@ get_page_from_l1e( @@ -895,11 +900,11 @@ get_page_from_l1e(
" from L1 entry %" PRIpte ") for %d", " from L1 entry %" PRIpte ") for %d",
mfn, get_gpfn_from_mfn(mfn), mfn, get_gpfn_from_mfn(mfn),
l1e_get_intpte(l1e), l1e_owner->domain_id); l1e_get_intpte(l1e), l1e_owner->domain_id);
@ -159,7 +172,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
could_not_pin: could_not_pin:
MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte
@@ -907,7 +912,7 @@ get_page_from_l1e( @@ -908,7 +913,7 @@ get_page_from_l1e(
l1e_get_intpte(l1e), l1e_owner->domain_id, pg_owner->domain_id); l1e_get_intpte(l1e), l1e_owner->domain_id, pg_owner->domain_id);
if ( real_pg_owner != NULL ) if ( real_pg_owner != NULL )
put_page(page); put_page(page);
@ -168,7 +181,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
@@ -1197,17 +1202,20 @@ static int alloc_l1_table(struct page_in @@ -1198,17 +1203,20 @@ static int alloc_l1_table(struct page_in
unsigned long pfn = page_to_mfn(page); unsigned long pfn = page_to_mfn(page);
l1_pgentry_t *pl1e; l1_pgentry_t *pl1e;
unsigned int i; unsigned int i;
@ -192,7 +205,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
l1e_remove_flags(pl1e[i], _PAGE_RW); l1e_remove_flags(pl1e[i], _PAGE_RW);
break; break;
} }
@@ -1225,7 +1233,7 @@ static int alloc_l1_table(struct page_in @@ -1226,7 +1234,7 @@ static int alloc_l1_table(struct page_in
put_page_from_l1e(pl1e[i], d); put_page_from_l1e(pl1e[i], d);
unmap_domain_page(pl1e); unmap_domain_page(pl1e);
@ -201,7 +214,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e) static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e)
@@ -1794,11 +1802,13 @@ static int mod_l1_entry(l1_pgentry_t *pl @@ -1795,12 +1803,15 @@ static int mod_l1_entry(l1_pgentry_t *pl
return rc; return rc;
} }
@ -216,9 +229,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
+ break; + break;
+ case 1: + case 1:
l1e_remove_flags(nl1e, _PAGE_RW); l1e_remove_flags(nl1e, _PAGE_RW);
+ rc = 0;
break; break;
} }
@@ -4948,7 +4958,7 @@ static int ptwr_emulated_update(
@@ -4976,7 +4987,7 @@ static int ptwr_emulated_update(
nl1e = l1e_from_intpte(val); nl1e = l1e_from_intpte(val);
switch ( get_page_from_l1e(nl1e, d, d) ) switch ( get_page_from_l1e(nl1e, d, d) )
{ {
@ -227,7 +242,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( is_pv_32bit_domain(d) && (bytes == 4) && (unaligned_addr & 4) && if ( is_pv_32bit_domain(d) && (bytes == 4) && (unaligned_addr & 4) &&
!do_cmpxchg && (l1e_get_flags(nl1e) & _PAGE_PRESENT) ) !do_cmpxchg && (l1e_get_flags(nl1e) & _PAGE_PRESENT) )
{ {
@@ -4968,7 +4978,9 @@ static int ptwr_emulated_update( @@ -4996,7 +5007,9 @@ static int ptwr_emulated_update(
return X86EMUL_UNHANDLEABLE; return X86EMUL_UNHANDLEABLE;
} }
break; break;

View File

@ -12,11 +12,9 @@ x86: make mod_l1_entry() return a proper error code
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c
=================================================================== +++ b/xen/arch/x86/mm.c
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c @@ -1766,15 +1766,16 @@ static int mod_l1_entry(l1_pgentry_t *pl
+++ xen-4.1.2-testing/xen/arch/x86/mm.c
@@ -1765,15 +1765,16 @@ static int mod_l1_entry(l1_pgentry_t *pl
struct domain *pt_dom = pt_vcpu->domain; struct domain *pt_dom = pt_vcpu->domain;
unsigned long mfn; unsigned long mfn;
p2m_type_t p2mt; p2m_type_t p2mt;
@ -37,7 +35,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
if ( l1e_get_flags(nl1e) & _PAGE_PRESENT ) if ( l1e_get_flags(nl1e) & _PAGE_PRESENT )
@@ -1782,7 +1783,7 @@ static int mod_l1_entry(l1_pgentry_t *pl @@ -1783,7 +1784,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
mfn = mfn_x(gfn_to_mfn(p2m_get_hostp2m(pg_dom), mfn = mfn_x(gfn_to_mfn(p2m_get_hostp2m(pg_dom),
l1e_get_pfn(nl1e), &p2mt)); l1e_get_pfn(nl1e), &p2mt));
if ( !p2m_is_ram(p2mt) || unlikely(mfn == INVALID_MFN) ) if ( !p2m_is_ram(p2mt) || unlikely(mfn == INVALID_MFN) )
@ -46,7 +44,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
ASSERT((mfn & ~(PADDR_MASK >> PAGE_SHIFT)) == 0); ASSERT((mfn & ~(PADDR_MASK >> PAGE_SHIFT)) == 0);
nl1e = l1e_from_pfn(mfn, l1e_get_flags(nl1e)); nl1e = l1e_from_pfn(mfn, l1e_get_flags(nl1e));
@@ -1790,22 +1791,23 @@ static int mod_l1_entry(l1_pgentry_t *pl @@ -1791,22 +1792,23 @@ static int mod_l1_entry(l1_pgentry_t *pl
{ {
MEM_LOG("Bad L1 flags %x", MEM_LOG("Bad L1 flags %x",
l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom)); l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom));
@ -75,7 +73,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
case 0: case 0:
break; break;
case 1: case 1:
@@ -1818,13 +1820,13 @@ static int mod_l1_entry(l1_pgentry_t *pl @@ -1820,13 +1822,13 @@ static int mod_l1_entry(l1_pgentry_t *pl
preserve_ad)) ) preserve_ad)) )
{ {
ol1e = nl1e; ol1e = nl1e;
@ -91,7 +89,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
put_page_from_l1e(ol1e, pt_dom); put_page_from_l1e(ol1e, pt_dom);
@@ -3516,9 +3518,10 @@ int do_mmu_update( @@ -3518,9 +3520,10 @@ int do_mmu_update(
} }
#endif #endif
@ -105,7 +103,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
break; break;
case PGT_l2_page_table: case PGT_l2_page_table:
@@ -4300,7 +4303,7 @@ static int __do_update_va_mapping( @@ -4302,7 +4305,7 @@ static int __do_update_va_mapping(
goto out; goto out;
} }

View File

@ -11,11 +11,9 @@ track both an okay status and an error code).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c
=================================================================== +++ b/xen/arch/x86/mm.c
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c @@ -1847,16 +1847,16 @@ static int mod_l2_entry(l2_pgentry_t *pl
+++ xen-4.1.2-testing/xen/arch/x86/mm.c
@@ -1845,16 +1845,16 @@ static int mod_l2_entry(l2_pgentry_t *pl
struct domain *d = vcpu->domain; struct domain *d = vcpu->domain;
struct page_info *l2pg = mfn_to_page(pfn); struct page_info *l2pg = mfn_to_page(pfn);
unsigned long type = l2pg->u.inuse.type_info; unsigned long type = l2pg->u.inuse.type_info;
@ -35,7 +33,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( l2e_get_flags(nl2e) & _PAGE_PRESENT ) if ( l2e_get_flags(nl2e) & _PAGE_PRESENT )
{ {
@@ -1862,32 +1862,33 @@ static int mod_l2_entry(l2_pgentry_t *pl @@ -1864,32 +1864,33 @@ static int mod_l2_entry(l2_pgentry_t *pl
{ {
MEM_LOG("Bad L2 flags %x", MEM_LOG("Bad L2 flags %x",
l2e_get_flags(nl2e) & L2_DISALLOW_MASK); l2e_get_flags(nl2e) & L2_DISALLOW_MASK);
@ -76,7 +74,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
put_page_from_l2e(ol2e, pfn); put_page_from_l2e(ol2e, pfn);
@@ -3367,7 +3368,7 @@ int do_mmu_update( @@ -3369,7 +3370,7 @@ int do_mmu_update(
void *va; void *va;
unsigned long gpfn, gmfn, mfn; unsigned long gpfn, gmfn, mfn;
struct page_info *page; struct page_info *page;
@ -85,7 +83,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
unsigned int cmd, done = 0, pt_dom; unsigned int cmd, done = 0, pt_dom;
struct vcpu *v = current; struct vcpu *v = current;
struct domain *d = v->domain, *pt_owner = d, *pg_owner; struct domain *d = v->domain, *pt_owner = d, *pg_owner;
@@ -3434,7 +3435,6 @@ int do_mmu_update( @@ -3436,7 +3437,6 @@ int do_mmu_update(
} }
cmd = req.ptr & (sizeof(l1_pgentry_t)-1); cmd = req.ptr & (sizeof(l1_pgentry_t)-1);
@ -93,7 +91,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
switch ( cmd ) switch ( cmd )
{ {
@@ -3451,6 +3451,7 @@ int do_mmu_update( @@ -3453,6 +3453,7 @@ int do_mmu_update(
rc = xsm_mmu_normal_update(d, pg_owner, req.val); rc = xsm_mmu_normal_update(d, pg_owner, req.val);
if ( rc ) if ( rc )
break; break;
@ -101,7 +99,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
req.ptr -= cmd; req.ptr -= cmd;
gmfn = req.ptr >> PAGE_SHIFT; gmfn = req.ptr >> PAGE_SHIFT;
@@ -3521,7 +3522,6 @@ int do_mmu_update( @@ -3523,7 +3524,6 @@ int do_mmu_update(
rc = mod_l1_entry(va, l1e, mfn, rc = mod_l1_entry(va, l1e, mfn,
cmd == MMU_PT_UPDATE_PRESERVE_AD, v, cmd == MMU_PT_UPDATE_PRESERVE_AD, v,
pg_owner); pg_owner);
@ -109,7 +107,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
break; break;
case PGT_l2_page_table: case PGT_l2_page_table:
@@ -3545,13 +3545,12 @@ int do_mmu_update( @@ -3547,13 +3547,12 @@ int do_mmu_update(
else if ( p2m_ram_shared == l2e_p2mt ) else if ( p2m_ram_shared == l2e_p2mt )
{ {
MEM_LOG("Unexpected attempt to map shared page.\n"); MEM_LOG("Unexpected attempt to map shared page.\n");
@ -125,7 +123,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
break; break;
case PGT_l3_page_table: case PGT_l3_page_table:
@@ -3575,13 +3574,11 @@ int do_mmu_update( @@ -3577,13 +3576,11 @@ int do_mmu_update(
else if ( p2m_ram_shared == l3e_p2mt ) else if ( p2m_ram_shared == l3e_p2mt )
{ {
MEM_LOG("Unexpected attempt to map shared page.\n"); MEM_LOG("Unexpected attempt to map shared page.\n");
@ -139,7 +137,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
} }
break; break;
#if CONFIG_PAGING_LEVELS >= 4 #if CONFIG_PAGING_LEVELS >= 4
@@ -3607,20 +3604,18 @@ int do_mmu_update( @@ -3609,20 +3606,18 @@ int do_mmu_update(
else if ( p2m_ram_shared == l4e_p2mt ) else if ( p2m_ram_shared == l4e_p2mt )
{ {
MEM_LOG("Unexpected attempt to map shared page.\n"); MEM_LOG("Unexpected attempt to map shared page.\n");
@ -162,7 +160,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
break; break;
} }
page_unlock(page); page_unlock(page);
@@ -3630,8 +3625,8 @@ int do_mmu_update( @@ -3632,8 +3627,8 @@ int do_mmu_update(
else if ( get_page_type(page, PGT_writable_page) ) else if ( get_page_type(page, PGT_writable_page) )
{ {
perfc_incr(writable_mmu_updates); perfc_incr(writable_mmu_updates);
@ -173,7 +171,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
put_page_type(page); put_page_type(page);
} }
@@ -3652,17 +3647,18 @@ int do_mmu_update( @@ -3654,17 +3649,18 @@ int do_mmu_update(
if ( unlikely(!get_page_from_pagenr(mfn, pg_owner)) ) if ( unlikely(!get_page_from_pagenr(mfn, pg_owner)) )
{ {
MEM_LOG("Could not get page for mach->phys update"); MEM_LOG("Could not get page for mach->phys update");
@ -193,7 +191,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
paging_mark_dirty(pg_owner, mfn); paging_mark_dirty(pg_owner, mfn);
@@ -3672,15 +3668,11 @@ int do_mmu_update( @@ -3674,15 +3670,11 @@ int do_mmu_update(
default: default:
MEM_LOG("Invalid page update command %x", cmd); MEM_LOG("Invalid page update command %x", cmd);
rc = -ENOSYS; rc = -ENOSYS;

View File

@ -9,10 +9,10 @@ Define new <pfn.h> header for PFN_{DOWN,UP} macros.
Signed-off-by: Keir Fraser <keir@xen.org> Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/domain_build.c Index: xen-4.1.3-testing/xen/arch/x86/domain_build.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/domain_build.c --- xen-4.1.3-testing.orig/xen/arch/x86/domain_build.c
+++ xen-4.1.2-testing/xen/arch/x86/domain_build.c +++ xen-4.1.3-testing/xen/arch/x86/domain_build.c
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#include <xen/bitops.h> #include <xen/bitops.h>
#include <xen/compat.h> #include <xen/compat.h>
@ -21,10 +21,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/domain_build.c
#include <asm/regs.h> #include <asm/regs.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
Index: xen-4.1.2-testing/xen/arch/x86/e820.c Index: xen-4.1.3-testing/xen/arch/x86/e820.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/e820.c --- xen-4.1.3-testing.orig/xen/arch/x86/e820.c
+++ xen-4.1.2-testing/xen/arch/x86/e820.c +++ xen-4.1.3-testing/xen/arch/x86/e820.c
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#include <xen/mm.h> #include <xen/mm.h>
#include <xen/compat.h> #include <xen/compat.h>
@ -33,22 +33,22 @@ Index: xen-4.1.2-testing/xen/arch/x86/e820.c
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/processor.h> #include <asm/processor.h>
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -99,6 +99,7 @@ @@ -100,6 +100,7 @@
#include <xen/event.h>
#include <xen/iocap.h> #include <xen/iocap.h>
#include <xen/guest_access.h> #include <xen/guest_access.h>
#include <xen/xmalloc.h>
+#include <xen/pfn.h> +#include <xen/pfn.h>
#include <asm/paging.h> #include <asm/paging.h>
#include <asm/shadow.h> #include <asm/shadow.h>
#include <asm/page.h> #include <asm/page.h>
Index: xen-4.1.2-testing/xen/arch/x86/msi.c Index: xen-4.1.3-testing/xen/arch/x86/msi.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/msi.c --- xen-4.1.3-testing.orig/xen/arch/x86/msi.c
+++ xen-4.1.2-testing/xen/arch/x86/msi.c +++ xen-4.1.3-testing/xen/arch/x86/msi.c
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
#include <xen/pci_regs.h> #include <xen/pci_regs.h>
#include <xen/iocap.h> #include <xen/iocap.h>
@ -57,10 +57,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/msi.c
#include <asm/io.h> #include <asm/io.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/desc.h> #include <asm/desc.h>
Index: xen-4.1.2-testing/xen/arch/x86/numa.c Index: xen-4.1.3-testing/xen/arch/x86/numa.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/numa.c --- xen-4.1.3-testing.orig/xen/arch/x86/numa.c
+++ xen-4.1.2-testing/xen/arch/x86/numa.c +++ xen-4.1.3-testing/xen/arch/x86/numa.c
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
#include <xen/keyhandler.h> #include <xen/keyhandler.h>
#include <xen/time.h> #include <xen/time.h>
@ -69,10 +69,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/numa.c
#include <asm/acpi.h> #include <asm/acpi.h>
#include <xen/sched.h> #include <xen/sched.h>
Index: xen-4.1.2-testing/xen/arch/x86/setup.c Index: xen-4.1.3-testing/xen/arch/x86/setup.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/setup.c --- xen-4.1.3-testing.orig/xen/arch/x86/setup.c
+++ xen-4.1.2-testing/xen/arch/x86/setup.c +++ xen-4.1.3-testing/xen/arch/x86/setup.c
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#include <xen/rcupdate.h> #include <xen/rcupdate.h>
#include <xen/vga.h> #include <xen/vga.h>
@ -81,10 +81,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
#include <xen/nodemask.h> #include <xen/nodemask.h>
#include <public/version.h> #include <public/version.h>
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
Index: xen-4.1.2-testing/xen/arch/x86/srat.c Index: xen-4.1.3-testing/xen/arch/x86/srat.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/srat.c --- xen-4.1.3-testing.orig/xen/arch/x86/srat.c
+++ xen-4.1.2-testing/xen/arch/x86/srat.c +++ xen-4.1.3-testing/xen/arch/x86/srat.c
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
#include <xen/nodemask.h> #include <xen/nodemask.h>
#include <xen/acpi.h> #include <xen/acpi.h>
@ -93,10 +93,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/srat.c
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/page.h> #include <asm/page.h>
Index: xen-4.1.2-testing/xen/arch/x86/tboot.c Index: xen-4.1.3-testing/xen/arch/x86/tboot.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/tboot.c --- xen-4.1.3-testing.orig/xen/arch/x86/tboot.c
+++ xen-4.1.2-testing/xen/arch/x86/tboot.c +++ xen-4.1.3-testing/xen/arch/x86/tboot.c
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
#include <xen/domain_page.h> #include <xen/domain_page.h>
#include <xen/iommu.h> #include <xen/iommu.h>
@ -105,10 +105,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/tboot.c
#include <asm/fixmap.h> #include <asm/fixmap.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/processor.h> #include <asm/processor.h>
Index: xen-4.1.2-testing/xen/include/asm-x86/page.h Index: xen-4.1.3-testing/xen/include/asm-x86/page.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/page.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/page.h
+++ xen-4.1.2-testing/xen/include/asm-x86/page.h +++ xen-4.1.3-testing/xen/include/asm-x86/page.h
@@ -396,8 +396,6 @@ static inline uint32_t cacheattr_to_pte_ @@ -396,8 +396,6 @@ static inline uint32_t cacheattr_to_pte_
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
@ -118,10 +118,22 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/page.h
#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK) #define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK)
#endif /* __X86_PAGE_H__ */ #endif /* __X86_PAGE_H__ */
Index: xen-4.1.2-testing/xen/include/xen/pfn.h Index: xen-4.1.3-testing/xen/include/xen/pci.h
===================================================================
--- xen-4.1.3-testing.orig/xen/include/xen/pci.h
+++ xen-4.1.3-testing/xen/include/xen/pci.h
@@ -13,6 +13,7 @@
#include <xen/spinlock.h>
#include <xen/irq.h>
#include <xen/pci_regs.h>
+#include <xen/pfn.h>
/*
* The PCI interface treats multi-function devices as independent
Index: xen-4.1.3-testing/xen/include/xen/pfn.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/xen/pfn.h +++ xen-4.1.3-testing/xen/include/xen/pfn.h
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+#ifndef __XEN_PFN_H__ +#ifndef __XEN_PFN_H__
+#define __XEN_PFN_H__ +#define __XEN_PFN_H__

View File

@ -8,11 +8,11 @@ guest-bound irq before accessing desc->action.
Signed-off-by: Keir Fraser <keir@xen.org> Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/irq.c Index: xen-4.1.3-testing/xen/arch/x86/irq.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/irq.c --- xen-4.1.3-testing.orig/xen/arch/x86/irq.c
+++ xen-4.1.2-testing/xen/arch/x86/irq.c +++ xen-4.1.3-testing/xen/arch/x86/irq.c
@@ -1033,6 +1033,12 @@ static void __pirq_guest_eoi(struct doma @@ -1143,6 +1143,12 @@ static void __pirq_guest_eoi(struct doma
return; return;
} }

View File

@ -27,11 +27,11 @@ Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com> Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Index: xen-4.1.2-testing/xen/arch/x86/apic.c Index: xen-4.1.3-testing/xen/arch/x86/apic.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/apic.c --- xen-4.1.3-testing.orig/xen/arch/x86/apic.c
+++ xen-4.1.2-testing/xen/arch/x86/apic.c +++ xen-4.1.3-testing/xen/arch/x86/apic.c
@@ -566,7 +566,7 @@ static void resume_x2apic(void) @@ -572,7 +572,7 @@ static void resume_x2apic(void)
mask_8259A(); mask_8259A();
mask_IO_APIC_setup(ioapic_entries); mask_IO_APIC_setup(ioapic_entries);
@ -40,7 +40,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/apic.c
__enable_x2apic(); __enable_x2apic();
restore_IO_APIC_setup(ioapic_entries); restore_IO_APIC_setup(ioapic_entries);
@@ -783,7 +783,7 @@ int lapic_suspend(void) @@ -789,7 +789,7 @@ int lapic_suspend(void)
local_irq_save(flags); local_irq_save(flags);
disable_local_APIC(); disable_local_APIC();
@ -49,7 +49,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/apic.c
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
} }
@@ -1029,7 +1029,7 @@ void __init x2apic_bsp_setup(void) @@ -1035,7 +1035,7 @@ void __init x2apic_bsp_setup(void)
mask_8259A(); mask_8259A();
mask_IO_APIC_setup(ioapic_entries); mask_IO_APIC_setup(ioapic_entries);
@ -58,10 +58,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/apic.c
{ {
if ( x2apic_enabled ) if ( x2apic_enabled )
panic("Interrupt remapping could not be enabled while " panic("Interrupt remapping could not be enabled while "
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/dmar.c Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/dmar.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/dmar.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/dmar.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/dmar.c +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/dmar.c
@@ -46,6 +46,7 @@ LIST_HEAD(acpi_rmrr_units); @@ -46,6 +46,7 @@ LIST_HEAD(acpi_rmrr_units);
LIST_HEAD(acpi_atsr_units); LIST_HEAD(acpi_atsr_units);
LIST_HEAD(acpi_rhsa_units); LIST_HEAD(acpi_rhsa_units);
@ -101,10 +101,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/dmar.c
+ flags = DMAR_INTR_REMAP | DMAR_X2APIC_OPT_OUT; + flags = DMAR_INTR_REMAP | DMAR_X2APIC_OPT_OUT;
+ return ((dmar_flags & flags) == DMAR_INTR_REMAP); + return ((dmar_flags & flags) == DMAR_INTR_REMAP);
+} +}
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/extern.h Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/extern.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/extern.h --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/extern.h
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/extern.h +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/extern.h
@@ -87,5 +87,7 @@ void vtd_ops_preamble_quirk(struct iommu @@ -87,5 +87,7 @@ void vtd_ops_preamble_quirk(struct iommu
void vtd_ops_postamble_quirk(struct iommu* iommu); void vtd_ops_postamble_quirk(struct iommu* iommu);
void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map);
@ -113,10 +113,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/extern.h
+int platform_supports_x2apic(void); +int platform_supports_x2apic(void);
#endif // _VTD_EXTERN_H_ #endif // _VTD_EXTERN_H_
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/intremap.c Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/intremap.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/intremap.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/intremap.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/intremap.c +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/intremap.c
@@ -741,6 +741,13 @@ int enable_intremap(struct iommu *iommu, @@ -741,6 +741,13 @@ int enable_intremap(struct iommu *iommu,
ASSERT(ecap_intr_remap(iommu->ecap) && iommu_intremap); ASSERT(ecap_intr_remap(iommu->ecap) && iommu_intremap);
@ -163,11 +163,11 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/intremap.c
{ {
struct acpi_drhd_unit *drhd; struct acpi_drhd_unit *drhd;
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/iommu.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c
@@ -2006,7 +2006,7 @@ static int init_vtd_hw(void) @@ -2091,7 +2091,7 @@ static int init_vtd_hw(void)
{ {
iommu_intremap = 0; iommu_intremap = 0;
dprintk(XENLOG_WARNING VTDPREFIX, dprintk(XENLOG_WARNING VTDPREFIX,
@ -176,10 +176,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c
break; break;
} }
} }
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/iommu.h --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.h
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h
@@ -22,6 +22,10 @@ @@ -22,6 +22,10 @@
#include <xen/types.h> #include <xen/types.h>
@ -191,10 +191,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h
/* /*
* Intel IOMMU register specification per version 1.0 public spec. * Intel IOMMU register specification per version 1.0 public spec.
*/ */
Index: xen-4.1.2-testing/xen/include/xen/iommu.h Index: xen-4.1.3-testing/xen/include/xen/iommu.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/iommu.h --- xen-4.1.3-testing.orig/xen/include/xen/iommu.h
+++ xen-4.1.2-testing/xen/include/xen/iommu.h +++ xen-4.1.3-testing/xen/include/xen/iommu.h
@@ -66,8 +66,8 @@ struct iommu { @@ -66,8 +66,8 @@ struct iommu {
int iommu_setup(void); int iommu_setup(void);

View File

@ -1,435 +0,0 @@
References: FATE#309900
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1303116432 -3600
# Node ID 1276926e3795b11ef6ac2f59df900d8e0ba9f54b
# Parent 07d832ad23021445bc56fafaeb2843c94d868005
vmx/hvm: move mov-cr handling functions to generic HVM code
Currently the handling of CR accesses intercepts is done much
differently in SVM and VMX. For future usage move the VMX part
into the generic HVM path and use the exported functions.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
@@ -1298,6 +1298,86 @@ static void hvm_set_uc_mode(struct vcpu
return hvm_funcs.set_uc_mode(v);
}
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr)
+{
+ struct vcpu *curr = current;
+ unsigned long val, *reg;
+
+ if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+ {
+ gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+ goto exit_and_crash;
+ }
+
+ val = *reg;
+ HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(val));
+ HVM_DBG_LOG(DBG_LEVEL_1, "CR%u, value = %lx", cr, val);
+
+ switch ( cr )
+ {
+ case 0:
+ return hvm_set_cr0(val);
+
+ case 3:
+ return hvm_set_cr3(val);
+
+ case 4:
+ return hvm_set_cr4(val);
+
+ case 8:
+ vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, ((val & 0x0f) << 4));
+ break;
+
+ default:
+ gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
+ goto exit_and_crash;
+ }
+
+ return X86EMUL_OKAY;
+
+ exit_and_crash:
+ domain_crash(curr->domain);
+ return X86EMUL_UNHANDLEABLE;
+}
+
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr)
+{
+ struct vcpu *curr = current;
+ unsigned long val = 0, *reg;
+
+ if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+ {
+ gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+ goto exit_and_crash;
+ }
+
+ switch ( cr )
+ {
+ case 0:
+ case 2:
+ case 3:
+ case 4:
+ val = curr->arch.hvm_vcpu.guest_cr[cr];
+ break;
+ case 8:
+ val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+ break;
+ default:
+ gdprintk(XENLOG_ERR, "invalid cr: %u\n", cr);
+ goto exit_and_crash;
+ }
+
+ *reg = val;
+ HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(val));
+ HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%u, value = %lx", cr, val);
+
+ return X86EMUL_OKAY;
+
+ exit_and_crash:
+ domain_crash(curr->domain);
+ return X86EMUL_UNHANDLEABLE;
+}
+
int hvm_set_cr0(unsigned long value)
{
struct vcpu *v = current;
Index: xen-4.1.2-testing/xen/arch/x86/hvm/vmx/vmx.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/vmx/vmx.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/vmx/vmx.c
@@ -1545,182 +1545,42 @@ static void vmx_invlpg_intercept(unsigne
vpid_sync_vcpu_gva(curr, vaddr);
}
-#define CASE_SET_REG(REG, reg) \
- case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: regs->reg = value; break
-#define CASE_GET_REG(REG, reg) \
- case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: value = regs->reg; break
-
-#define CASE_EXTEND_SET_REG \
- CASE_EXTEND_REG(S)
-#define CASE_EXTEND_GET_REG \
- CASE_EXTEND_REG(G)
-
-#ifdef __i386__
-#define CASE_EXTEND_REG(T)
-#else
-#define CASE_EXTEND_REG(T) \
- CASE_ ## T ## ET_REG(R8, r8); \
- CASE_ ## T ## ET_REG(R9, r9); \
- CASE_ ## T ## ET_REG(R10, r10); \
- CASE_ ## T ## ET_REG(R11, r11); \
- CASE_ ## T ## ET_REG(R12, r12); \
- CASE_ ## T ## ET_REG(R13, r13); \
- CASE_ ## T ## ET_REG(R14, r14); \
- CASE_ ## T ## ET_REG(R15, r15)
-#endif
-
-static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
-{
- unsigned long value;
- struct vcpu *v = current;
- struct vlapic *vlapic = vcpu_vlapic(v);
- int rc = 0;
- unsigned long old;
-
- switch ( gp )
- {
- CASE_GET_REG(EAX, eax);
- CASE_GET_REG(ECX, ecx);
- CASE_GET_REG(EDX, edx);
- CASE_GET_REG(EBX, ebx);
- CASE_GET_REG(EBP, ebp);
- CASE_GET_REG(ESI, esi);
- CASE_GET_REG(EDI, edi);
- CASE_GET_REG(ESP, esp);
- CASE_EXTEND_GET_REG;
- default:
- gdprintk(XENLOG_ERR, "invalid gp: %d\n", gp);
- goto exit_and_crash;
- }
-
- HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(value));
-
- HVM_DBG_LOG(DBG_LEVEL_1, "CR%d, value = %lx", cr, value);
-
- switch ( cr )
- {
- case 0:
- old = v->arch.hvm_vcpu.guest_cr[0];
- rc = !hvm_set_cr0(value);
- if (rc)
- hvm_memory_event_cr0(value, old);
- return rc;
-
- case 3:
- old = v->arch.hvm_vcpu.guest_cr[3];
- rc = !hvm_set_cr3(value);
- if (rc)
- hvm_memory_event_cr3(value, old);
- return rc;
-
- case 4:
- old = v->arch.hvm_vcpu.guest_cr[4];
- rc = !hvm_set_cr4(value);
- if (rc)
- hvm_memory_event_cr4(value, old);
- return rc;
-
- case 8:
- vlapic_set_reg(vlapic, APIC_TASKPRI, ((value & 0x0F) << 4));
- break;
-
- default:
- gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
- goto exit_and_crash;
- }
-
- return 1;
-
- exit_and_crash:
- domain_crash(v->domain);
- return 0;
-}
-
-/*
- * Read from control registers. CR0 and CR4 are read from the shadow.
- */
-static void mov_from_cr(int cr, int gp, struct cpu_user_regs *regs)
+static int vmx_cr_access(unsigned long exit_qualification)
{
- unsigned long value = 0;
- struct vcpu *v = current;
- struct vlapic *vlapic = vcpu_vlapic(v);
-
- switch ( cr )
- {
- case 3:
- value = (unsigned long)v->arch.hvm_vcpu.guest_cr[3];
- break;
- case 8:
- value = (unsigned long)vlapic_get_reg(vlapic, APIC_TASKPRI);
- value = (value & 0xF0) >> 4;
- break;
- default:
- gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
- domain_crash(v->domain);
- break;
- }
-
- switch ( gp ) {
- CASE_SET_REG(EAX, eax);
- CASE_SET_REG(ECX, ecx);
- CASE_SET_REG(EDX, edx);
- CASE_SET_REG(EBX, ebx);
- CASE_SET_REG(EBP, ebp);
- CASE_SET_REG(ESI, esi);
- CASE_SET_REG(EDI, edi);
- CASE_SET_REG(ESP, esp);
- CASE_EXTEND_SET_REG;
- default:
- printk("invalid gp: %d\n", gp);
- domain_crash(v->domain);
- break;
- }
-
- HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(value));
-
- HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%d, value = %lx", cr, value);
-}
-
-static int vmx_cr_access(unsigned long exit_qualification,
- struct cpu_user_regs *regs)
-{
- unsigned int gp, cr;
- unsigned long value;
- struct vcpu *v = current;
+ struct vcpu *curr = current;
- switch ( exit_qualification & VMX_CONTROL_REG_ACCESS_TYPE )
+ switch ( VMX_CONTROL_REG_ACCESS_TYPE(exit_qualification) )
{
- case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR:
- gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
- cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
- return mov_to_cr(gp, cr, regs);
- case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR:
- gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
- cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
- mov_from_cr(cr, gp, regs);
- break;
- case VMX_CONTROL_REG_ACCESS_TYPE_CLTS:
- {
- unsigned long old = v->arch.hvm_vcpu.guest_cr[0];
- v->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
- vmx_update_guest_cr(v, 0);
-
- hvm_memory_event_cr0(v->arch.hvm_vcpu.guest_cr[0], old);
-
+ case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR: {
+ unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+ unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+ return hvm_mov_to_cr(cr, gp);
+ }
+ case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR: {
+ unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+ unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+ return hvm_mov_from_cr(cr, gp);
+ }
+ case VMX_CONTROL_REG_ACCESS_TYPE_CLTS: {
+ unsigned long old = curr->arch.hvm_vcpu.guest_cr[0];
+ curr->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
+ vmx_update_guest_cr(curr, 0);
+ hvm_memory_event_cr0(curr->arch.hvm_vcpu.guest_cr[0], old);
HVMTRACE_0D(CLTS);
break;
}
- case VMX_CONTROL_REG_ACCESS_TYPE_LMSW:
- value = v->arch.hvm_vcpu.guest_cr[0];
+ case VMX_CONTROL_REG_ACCESS_TYPE_LMSW: {
+ unsigned long value = curr->arch.hvm_vcpu.guest_cr[0];
/* LMSW can: (1) set bits 0-3; (2) clear bits 1-3. */
value = (value & ~0xe) | ((exit_qualification >> 16) & 0xf);
HVMTRACE_LONG_1D(LMSW, value);
- return !hvm_set_cr0(value);
+ return hvm_set_cr0(value);
+ }
default:
BUG();
}
- return 1;
+ return X86EMUL_OKAY;
}
static const struct lbr_info {
@@ -2525,7 +2385,7 @@ asmlinkage void vmx_vmexit_handler(struc
case EXIT_REASON_CR_ACCESS:
{
exit_qualification = __vmread(EXIT_QUALIFICATION);
- if ( vmx_cr_access(exit_qualification, regs) )
+ if ( vmx_cr_access(exit_qualification) == X86EMUL_OKAY )
update_guest_eip(); /* Safe: MOV Cn, LMSW, CLTS */
break;
}
Index: xen-4.1.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c
@@ -368,6 +368,36 @@ void vcpu_show_execution_state(struct vc
vcpu_unpause(v);
}
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg)
+{
+ void *p;
+
+ switch ( modrm_reg )
+ {
+ case 0: p = &regs->eax; break;
+ case 1: p = &regs->ecx; break;
+ case 2: p = &regs->edx; break;
+ case 3: p = &regs->ebx; break;
+ case 4: p = &regs->esp; break;
+ case 5: p = &regs->ebp; break;
+ case 6: p = &regs->esi; break;
+ case 7: p = &regs->edi; break;
+#if defined(__x86_64__)
+ case 8: p = &regs->r8; break;
+ case 9: p = &regs->r9; break;
+ case 10: p = &regs->r10; break;
+ case 11: p = &regs->r11; break;
+ case 12: p = &regs->r12; break;
+ case 13: p = &regs->r13; break;
+ case 14: p = &regs->r14; break;
+ case 15: p = &regs->r15; break;
+#endif
+ default: p = NULL; break;
+ }
+
+ return p;
+}
+
static char *trapstr(int trapnr)
{
static char *strings[] = {
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/support.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/support.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/support.h
@@ -137,5 +137,7 @@ int hvm_set_cr3(unsigned long value);
int hvm_set_cr4(unsigned long value);
int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content);
int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content);
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr);
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr);
#endif /* __ASM_X86_HVM_SUPPORT_H__ */
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/vmx/vmx.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/vmx/vmx.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -144,31 +144,15 @@ void vmx_update_cpu_exec_control(struct
* Exit Qualifications for MOV for Control Register Access
*/
/* 3:0 - control register number (CRn) */
-#define VMX_CONTROL_REG_ACCESS_NUM 0xf
+#define VMX_CONTROL_REG_ACCESS_NUM(eq) ((eq) & 0xf)
/* 5:4 - access type (CR write, CR read, CLTS, LMSW) */
-#define VMX_CONTROL_REG_ACCESS_TYPE 0x30
+#define VMX_CONTROL_REG_ACCESS_TYPE(eq) (((eq) >> 4) & 0x3)
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR 0
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR 1
+# define VMX_CONTROL_REG_ACCESS_TYPE_CLTS 2
+# define VMX_CONTROL_REG_ACCESS_TYPE_LMSW 3
/* 10:8 - general purpose register operand */
-#define VMX_CONTROL_REG_ACCESS_GPR 0xf00
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR (0 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR (1 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_CLTS (2 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_LMSW (3 << 4)
-#define VMX_CONTROL_REG_ACCESS_GPR_EAX (0 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ECX (1 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDX (2 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBX (3 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESP (4 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBP (5 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESI (6 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDI (7 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R8 (8 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R9 (9 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R10 (10 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R11 (11 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R12 (12 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R13 (13 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R14 (14 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R15 (15 << 8)
+#define VMX_CONTROL_REG_ACCESS_GPR(eq) (((eq) >> 8) & 0xf)
/*
* Access Rights
Index: xen-4.1.2-testing/xen/include/asm-x86/processor.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/processor.h
+++ xen-4.1.2-testing/xen/include/asm-x86/processor.h
@@ -592,6 +592,8 @@ int wrmsr_hypervisor_regs(uint32_t idx,
int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
int microcode_resume_cpu(int cpu);
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg);
+
#endif /* !__ASSEMBLY__ */
#endif /* __ASM_X86_PROCESSOR_H */

View File

@ -1,75 +0,0 @@
References: FATE#309900
# HG changeset patch
# User Andre Przywara <andre.przywara@amd.com>
# Date 1303116553 -3600
# Node ID bf7afd48339a18cd86d89337f3c055045fb78d3b
# Parent 1276926e3795b11ef6ac2f59df900d8e0ba9f54b
svm: add bit definitions for SVM DecodeAssist
Chapter 15.33 of recent APM Vol.2 manuals describe some additions
to SVM called DecodeAssist. Add the newly added fields to the VMCB
structure and name the associated CPUID bit.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1303117802 -3600
# Node ID 381ab77db71a4739b8a4f4fdad4ef3504999f998
# Parent e324c4d1dd6eeb9417fec513640ca795bd0f5dd4
svm: decode-assists feature must depend on nextrip feature.
...since the decode-assist fast paths assume nextrip vmcb field is
valid.
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -928,11 +928,16 @@ struct hvm_function_table * __init start
printk("SVM: Supported advanced features:\n");
+ /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */
+ if ( !cpu_has_svm_nrips )
+ clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags);
+
#define P(p,s) if ( p ) { printk(" - %s\n", s); printed = 1; }
P(cpu_has_svm_npt, "Nested Page Tables (NPT)");
P(cpu_has_svm_lbrv, "Last Branch Record (LBR) Virtualisation");
P(cpu_has_svm_nrips, "Next-RIP Saved on #VMEXIT");
P(cpu_has_svm_cleanbits, "VMCB Clean Bits");
+ P(cpu_has_svm_decode, "DecodeAssists");
P(cpu_has_pause_filter, "Pause-Intercept Filter");
#undef P
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/svm.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h
@@ -80,6 +80,7 @@ extern u32 svm_feature_flags;
#define cpu_has_svm_svml cpu_has_svm_feature(SVM_FEATURE_SVML)
#define cpu_has_svm_nrips cpu_has_svm_feature(SVM_FEATURE_NRIPS)
#define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
+#define cpu_has_svm_decode cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
#define cpu_has_pause_filter cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
#endif /* __ASM_X86_HVM_SVM_H__ */
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/vmcb.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/vmcb.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -432,7 +432,9 @@ struct vmcb_struct {
vmcbcleanbits_t cleanbits; /* offset 0xC0 */
u32 res09; /* offset 0xC4 */
u64 nextrip; /* offset 0xC8 */
- u64 res10a[102]; /* offset 0xD0 pad to save area */
+ u8 guest_ins_len; /* offset 0xD0 */
+ u8 guest_ins[15]; /* offset 0xD1 */
+ u64 res10a[100]; /* offset 0xE0 pad to save area */
svm_segment_register_t es; /* offset 1024 - cleanbit 8 */
svm_segment_register_t cs; /* cleanbit 8 */

View File

@ -1,66 +0,0 @@
References: FATE#309900
# HG changeset patch
# User Andre Przywara <andre.przywara@amd.com>
# Date 1303117266 -3600
# Node ID 2c8ad607ece18b4740b9fc4ffe267a0e0893c141
# Parent bf7afd48339a18cd86d89337f3c055045fb78d3b
svm: implement CR access part of DecodeAssist
Newer SVM implementations (Bulldozer) now give the used general
purpose register on a MOV-CR intercept explictly. This avoids
fetching and decoding the instruction from guest's memory and speeds
up some Windows guest, which exercise CR8 quite often.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -1039,6 +1039,22 @@ static void svm_vmexit_do_cpuid(struct c
__update_guest_eip(regs, inst_len);
}
+static void svm_vmexit_do_cr_access(
+ struct vmcb_struct *vmcb, struct cpu_user_regs *regs)
+{
+ int gp, cr, dir, rc;
+
+ cr = vmcb->exitcode - VMEXIT_CR0_READ;
+ dir = (cr > 15);
+ cr &= 0xf;
+ gp = vmcb->exitinfo1 & 0xf;
+
+ rc = dir ? hvm_mov_to_cr(cr, gp) : hvm_mov_from_cr(cr, gp);
+
+ if ( rc == X86EMUL_OKAY )
+ __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+}
+
static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
{
HVMTRACE_0D(DR_WRITE);
@@ -1620,11 +1636,19 @@ asmlinkage void svm_vmexit_handler(struc
int dir = (vmcb->exitinfo1 & 1) ? IOREQ_READ : IOREQ_WRITE;
if ( handle_pio(port, bytes, dir) )
__update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
- break;
}
- /* fallthrough to emulation if a string instruction */
+ else if ( !handle_mmio() )
+ hvm_inject_exception(TRAP_gp_fault, 0, 0);
+ break;
+
case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
+ if ( cpu_has_svm_decode && (vmcb->exitinfo1 & (1ULL << 63)) )
+ svm_vmexit_do_cr_access(vmcb, regs);
+ else if ( !handle_mmio() )
+ hvm_inject_exception(TRAP_gp_fault, 0, 0);
+ break;
+
case VMEXIT_INVLPG:
case VMEXIT_INVLPGA:
if ( !handle_mmio() )

View File

@ -34,10 +34,10 @@ Fixes endless loop.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/emulate.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/svm/emulate.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/emulate.c --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/svm/emulate.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/emulate.c +++ xen-4.1.3-testing/xen/arch/x86/hvm/svm/emulate.c
@@ -102,6 +102,7 @@ MAKE_INSTR(INT3, 1, 0xcc); @@ -102,6 +102,7 @@ MAKE_INSTR(INT3, 1, 0xcc);
MAKE_INSTR(RDTSC, 2, 0x0f, 0x31); MAKE_INSTR(RDTSC, 2, 0x0f, 0x31);
MAKE_INSTR(PAUSE, 1, 0x90); MAKE_INSTR(PAUSE, 1, 0x90);
@ -54,39 +54,27 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/emulate.c
}; };
static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len) static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len)
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c +++ xen-4.1.3-testing/xen/arch/x86/hvm/svm/svm.c
@@ -1650,11 +1650,22 @@ asmlinkage void svm_vmexit_handler(struc @@ -1748,8 +1748,10 @@ asmlinkage void svm_vmexit_handler(struc
break; break;
case VMEXIT_INVLPG: case VMEXIT_INVLPGA:
- case VMEXIT_INVLPGA:
- if ( !handle_mmio() ) - if ( !handle_mmio() )
+ if ( cpu_has_svm_decode ) - hvm_inject_exception(TRAP_gp_fault, 0, 0);
+ {
+ svm_invlpg_intercept(vmcb->exitinfo1);
+ __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+ }
+ else if ( !handle_mmio() )
hvm_inject_exception(TRAP_gp_fault, 0, 0);
break;
+ case VMEXIT_INVLPGA:
+ if ( (inst_len = __get_instruction_length(v, INSTR_INVLPGA)) == 0 ) + if ( (inst_len = __get_instruction_length(v, INSTR_INVLPGA)) == 0 )
+ break; + break;
+ svm_invlpga(regs->eax, v->arch.hvm_vcpu.asid); + svm_invlpga(regs->eax, v->arch.hvm_vcpu.asid);
+ __update_guest_eip(regs, inst_len); + __update_guest_eip(regs, inst_len);
+ break; break;
+
case VMEXIT_VMMCALL: case VMEXIT_VMMCALL:
if ( (inst_len = __get_instruction_length(v, INSTR_VMCALL)) == 0 ) Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/asid.h
break;
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/asid.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/asid.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/asid.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/asid.h +++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/asid.h
@@ -34,10 +34,7 @@ static inline void svm_asid_g_invlpg(str @@ -34,10 +34,7 @@ static inline void svm_asid_g_invlpg(str
{ {
#if 0 #if 0
@ -99,10 +87,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/asid.h
#endif #endif
/* Safe fallback. Take a new ASID. */ /* Safe fallback. Take a new ASID. */
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/emulate.h Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/emulate.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/emulate.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/emulate.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/emulate.h +++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/emulate.h
@@ -33,6 +33,7 @@ enum instruction_index { @@ -33,6 +33,7 @@ enum instruction_index {
INSTR_RDTSC, INSTR_RDTSC,
INSTR_PAUSE, INSTR_PAUSE,
@ -111,10 +99,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/emulate.h
INSTR_MAX_COUNT /* Must be last - Number of instructions supported */ INSTR_MAX_COUNT /* Must be last - Number of instructions supported */
}; };
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/svm.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/svm.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/svm.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h +++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/svm.h
@@ -62,6 +62,15 @@ static inline void svm_vmsave(void *vmcb @@ -62,6 +62,15 @@ static inline void svm_vmsave(void *vmcb
: : "a" (__pa(vmcb)) : "memory" ); : : "a" (__pa(vmcb)) : "memory" );
} }

View File

@ -1,135 +0,0 @@
References: FATE#309900
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1303130170 -3600
# Node ID 60f5df2afcbbe1e8d8438c2b7b8223d9d2102e06
# Parent 381ab77db71a4739b8a4f4fdad4ef3504999f998
svm: implement instruction fetch part of DecodeAssist (on #PF/#NPF)
Newer SVM implementations (Bulldozer) copy up to 15 bytes from the
instruction stream into the VMCB when a #PF or #NPF exception is
intercepted. This patch makes use of this information if available.
This saves us from a) traversing the guest's page tables, b) mapping
the guest's memory and c) copy the instructions from there into the
hypervisor's address space.
This speeds up #NPF intercepts quite a lot and avoids cache and TLB
trashing.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/emulate.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/emulate.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/emulate.c
@@ -996,6 +996,8 @@ int hvm_emulate_one(
hvmemul_ctxt->insn_buf_eip = regs->eip;
hvmemul_ctxt->insn_buf_bytes =
+ hvm_get_insn_bytes(curr, hvmemul_ctxt->insn_buf)
+ ? :
(hvm_virtual_to_linear_addr(
x86_seg_cs, &hvmemul_ctxt->seg_reg[x86_seg_cs],
regs->eip, sizeof(hvmemul_ctxt->insn_buf),
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -603,6 +603,21 @@ static void svm_set_rdtsc_exiting(struct
vmcb_set_general1_intercepts(vmcb, general1_intercepts);
}
+static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+ unsigned int len = v->arch.hvm_svm.cached_insn_len;
+
+ if ( len != 0 )
+ {
+ /* Latch and clear the cached instruction. */
+ memcpy(buf, vmcb->guest_ins, 15);
+ v->arch.hvm_svm.cached_insn_len = 0;
+ }
+
+ return len;
+}
+
static void svm_init_hypercall_page(struct domain *d, void *hypercall_page)
{
char *p;
@@ -1448,7 +1463,8 @@ static struct hvm_function_table __read_
.msr_read_intercept = svm_msr_read_intercept,
.msr_write_intercept = svm_msr_write_intercept,
.invlpg_intercept = svm_invlpg_intercept,
- .set_rdtsc_exiting = svm_set_rdtsc_exiting
+ .set_rdtsc_exiting = svm_set_rdtsc_exiting,
+ .get_insn_bytes = svm_get_insn_bytes
};
asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs)
@@ -1554,7 +1570,12 @@ asmlinkage void svm_vmexit_handler(struc
(unsigned long)regs->ecx, (unsigned long)regs->edx,
(unsigned long)regs->esi, (unsigned long)regs->edi);
- if ( paging_fault(va, regs) )
+ if ( cpu_has_svm_decode )
+ v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
+ rc = paging_fault(va, regs);
+ v->arch.hvm_svm.cached_insn_len = 0;
+
+ if ( rc )
{
if ( trace_will_trace_event(TRC_SHADOW) )
break;
@@ -1720,7 +1741,10 @@ asmlinkage void svm_vmexit_handler(struc
case VMEXIT_NPF:
perfc_incra(svmexits, VMEXIT_NPF_PERFC);
regs->error_code = vmcb->exitinfo1;
+ if ( cpu_has_svm_decode )
+ v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
svm_do_nested_pgfault(vmcb->exitinfo2);
+ v->arch.hvm_svm.cached_insn_len = 0;
break;
case VMEXIT_IRET: {
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/hvm.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/hvm.h
@@ -132,6 +132,9 @@ struct hvm_function_table {
int (*cpu_up)(void);
void (*cpu_down)(void);
+ /* Copy up to 15 bytes from cached instruction bytes at current rIP. */
+ unsigned int (*get_insn_bytes)(struct vcpu *v, uint8_t *buf);
+
/* Instruction intercepts: non-void return values are X86EMUL codes. */
void (*cpuid_intercept)(
unsigned int *eax, unsigned int *ebx,
@@ -328,6 +331,11 @@ static inline void hvm_cpu_down(void)
hvm_funcs.cpu_down();
}
+static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+ return (hvm_funcs.get_insn_bytes ? hvm_funcs.get_insn_bytes(v, buf) : 0);
+}
+
enum hvm_task_switch_reason { TSW_jmp, TSW_iret, TSW_call_or_int };
void hvm_task_switch(
uint16_t tss_sel, enum hvm_task_switch_reason taskswitch_reason,
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/vmcb.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/vmcb.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -498,6 +498,9 @@ struct arch_svm_struct {
int launch_core;
bool_t vmcb_in_sync; /* VMCB sync'ed with VMSAVE? */
+ /* VMCB has a cached instruction from #PF/#NPF Decode Assist? */
+ uint8_t cached_insn_len; /* Zero if no cached instruction. */
+
/* Upper four bytes are undefined in the VMCB, therefore we can't
* use the fields in the VMCB. Write a 64bit value and then read a 64bit
* value is fine unless there's a VMRUN/VMEXIT in between which clears

View File

@ -9,8 +9,10 @@ xen/x86: re-enable xsave by default now that it supports live migration.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
--- a/xen/arch/x86/cpu/common.c Index: xen-4.1.3-testing/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-4.1.3-testing/xen/arch/x86/cpu/common.c
@@ -25,7 +25,7 @@ boolean_param("nofxsr", disable_x86_fxsr @@ -25,7 +25,7 @@ boolean_param("nofxsr", disable_x86_fxsr
static bool_t __cpuinitdata disable_x86_serial_nr; static bool_t __cpuinitdata disable_x86_serial_nr;
boolean_param("noserialnumber", disable_x86_serial_nr); boolean_param("noserialnumber", disable_x86_serial_nr);
@ -18,5 +20,5 @@ Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
-static bool_t __cpuinitdata use_xsave; -static bool_t __cpuinitdata use_xsave;
+static bool_t __cpuinitdata use_xsave = 1; +static bool_t __cpuinitdata use_xsave = 1;
boolean_param("xsave", use_xsave); boolean_param("xsave", use_xsave);
unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u; unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u;
integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);

View File

@ -1,42 +0,0 @@
References: FATE#309893, FATE#309902, FATE#309903, FATE#309906
# HG changeset patch
# User Jacob Shin <jacob.shin@amd.com>
# Date 1304930954 -3600
# Node ID 8981b582be3e2f6647ef5ff3d93e167436ed357a
# Parent 82180954eda9cfe279e7ecf8c9ed4ffa29796bfb
xenoprof: Update cpu_type to sync with upstream oprofile
Update xenoprof's cpu_type to match upstream oprofile. Currently AMD
Family 11h ~ Family 15h are broken due to string mismatches.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/oprofile/nmi_int.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/oprofile/nmi_int.c
+++ xen-4.1.2-testing/xen/arch/x86/oprofile/nmi_int.c
@@ -435,19 +435,19 @@ static int __init nmi_init(void)
break;
case 0x11:
model = &op_athlon_spec;
- cpu_type = "x86-64/family11";
+ cpu_type = "x86-64/family11h";
break;
case 0x12:
model = &op_athlon_spec;
- cpu_type = "x86-64/family12";
+ cpu_type = "x86-64/family12h";
break;
case 0x14:
model = &op_athlon_spec;
- cpu_type = "x86-64/family14";
+ cpu_type = "x86-64/family14h";
break;
case 0x15:
model = &op_athlon_spec;
- cpu_type = "x86-64/family15";
+ cpu_type = "x86-64/family15h";
break;
}
break;

View File

@ -1,223 +0,0 @@
References: FATE#309893, FATE#309906
# HG changeset patch
# User Jacob Shin <jacob.shin@amd.com>
# Date 1304931187 -3600
# Node ID 014ee4e09644bd3ae55919d267f742c1d60c337a
# Parent 8981b582be3e2f6647ef5ff3d93e167436ed357a
xenoprof: Add support for AMD Family 15h processors
AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates xenoprof
to take advantage of the new counters.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Rename fam15h -> amd_fam15h in a few places, as suggested by Jan
Beulich.
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/oprofile/nmi_int.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/oprofile/nmi_int.c
+++ xen-4.1.2-testing/xen/arch/x86/oprofile/nmi_int.c
@@ -30,7 +30,7 @@
struct op_counter_config counter_config[OP_MAX_COUNTER];
struct op_ibs_config ibs_config;
-static struct op_x86_model_spec const *__read_mostly model;
+struct op_x86_model_spec const *__read_mostly model;
static struct op_msrs cpu_msrs[NR_CPUS];
static unsigned long saved_lvtpc[NR_CPUS];
@@ -446,7 +446,7 @@ static int __init nmi_init(void)
cpu_type = "x86-64/family14h";
break;
case 0x15:
- model = &op_athlon_spec;
+ model = &op_amd_fam15h_spec;
cpu_type = "x86-64/family15h";
break;
}
Index: xen-4.1.2-testing/xen/arch/x86/oprofile/op_model_athlon.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/oprofile/op_model_athlon.c
+++ xen-4.1.2-testing/xen/arch/x86/oprofile/op_model_athlon.c
@@ -24,8 +24,13 @@
#include "op_x86_model.h"
#include "op_counter.h"
-#define NUM_COUNTERS 4
-#define NUM_CONTROLS 4
+#define K7_NUM_COUNTERS 4
+#define K7_NUM_CONTROLS 4
+
+#define FAM15H_NUM_COUNTERS 6
+#define FAM15H_NUM_CONTROLS 6
+
+#define MAX_COUNTERS FAM15H_NUM_COUNTERS
#define CTR_READ(msr_content,msrs,c) do {rdmsrl(msrs->counters[(c)].addr, (msr_content));} while (0)
#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0)
@@ -44,9 +49,10 @@
#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 0x1ULL) << 41))
#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 0x1ULL) << 40))
-static unsigned long reset_value[NUM_COUNTERS];
+static unsigned long reset_value[MAX_COUNTERS];
extern char svm_stgi_label[];
+extern struct op_x86_model_spec const *__read_mostly model;
#ifdef CONFIG_X86_64
u32 ibs_caps = 0;
@@ -175,26 +181,44 @@ static void athlon_fill_in_addresses(str
msrs->controls[3].addr = MSR_K7_EVNTSEL3;
}
-
+static void fam15h_fill_in_addresses(struct op_msrs * const msrs)
+{
+ msrs->counters[0].addr = MSR_AMD_FAM15H_PERFCTR0;
+ msrs->counters[1].addr = MSR_AMD_FAM15H_PERFCTR1;
+ msrs->counters[2].addr = MSR_AMD_FAM15H_PERFCTR2;
+ msrs->counters[3].addr = MSR_AMD_FAM15H_PERFCTR3;
+ msrs->counters[4].addr = MSR_AMD_FAM15H_PERFCTR4;
+ msrs->counters[5].addr = MSR_AMD_FAM15H_PERFCTR5;
+
+ msrs->controls[0].addr = MSR_AMD_FAM15H_EVNTSEL0;
+ msrs->controls[1].addr = MSR_AMD_FAM15H_EVNTSEL1;
+ msrs->controls[2].addr = MSR_AMD_FAM15H_EVNTSEL2;
+ msrs->controls[3].addr = MSR_AMD_FAM15H_EVNTSEL3;
+ msrs->controls[4].addr = MSR_AMD_FAM15H_EVNTSEL4;
+ msrs->controls[5].addr = MSR_AMD_FAM15H_EVNTSEL5;
+}
+
static void athlon_setup_ctrs(struct op_msrs const * const msrs)
{
uint64_t msr_content;
int i;
+ unsigned int const nr_ctrs = model->num_counters;
+ unsigned int const nr_ctrls = model->num_controls;
/* clear all counters */
- for (i = 0 ; i < NUM_CONTROLS; ++i) {
+ for (i = 0 ; i < nr_ctrls; ++i) {
CTRL_READ(msr_content, msrs, i);
CTRL_CLEAR(msr_content);
CTRL_WRITE(msr_content, msrs, i);
}
/* avoid a false detection of ctr overflows in NMI handler */
- for (i = 0; i < NUM_COUNTERS; ++i) {
+ for (i = 0; i < nr_ctrs; ++i) {
CTR_WRITE(1, msrs, i);
}
/* enable active counters */
- for (i = 0; i < NUM_COUNTERS; ++i) {
+ for (i = 0; i < nr_ctrs; ++i) {
if (counter_config[i].enabled) {
reset_value[i] = counter_config[i].count;
@@ -300,6 +324,7 @@ static int athlon_check_ctrs(unsigned in
int mode = 0;
struct vcpu *v = current;
struct cpu_user_regs *guest_regs = guest_cpu_user_regs();
+ unsigned int const nr_ctrs = model->num_counters;
if (!guest_mode(regs) &&
(regs->eip == (unsigned long)svm_stgi_label)) {
@@ -312,7 +337,7 @@ static int athlon_check_ctrs(unsigned in
mode = xenoprofile_get_mode(v, regs);
}
- for (i = 0 ; i < NUM_COUNTERS; ++i) {
+ for (i = 0 ; i < nr_ctrs; ++i) {
CTR_READ(msr_content, msrs, i);
if (CTR_OVERFLOWED(msr_content)) {
xenoprof_log_event(current, regs, eip, mode, i);
@@ -373,7 +398,8 @@ static void athlon_start(struct op_msrs
{
uint64_t msr_content;
int i;
- for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+ unsigned int const nr_ctrs = model->num_counters;
+ for (i = 0 ; i < nr_ctrs ; ++i) {
if (reset_value[i]) {
CTRL_READ(msr_content, msrs, i);
CTRL_SET_ACTIVE(msr_content);
@@ -401,10 +427,11 @@ static void athlon_stop(struct op_msrs c
{
uint64_t msr_content;
int i;
+ unsigned int const nr_ctrs = model->num_counters;
/* Subtle: stop on all counters to avoid race with
* setting our pm callback */
- for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+ for (i = 0 ; i < nr_ctrs ; ++i) {
CTRL_READ(msr_content, msrs, i);
CTRL_SET_INACTIVE(msr_content);
CTRL_WRITE(msr_content, msrs, i);
@@ -512,11 +539,21 @@ void __init ibs_init(void)
#endif /* CONFIG_X86_64 */
struct op_x86_model_spec const op_athlon_spec = {
- .num_counters = NUM_COUNTERS,
- .num_controls = NUM_CONTROLS,
+ .num_counters = K7_NUM_COUNTERS,
+ .num_controls = K7_NUM_CONTROLS,
.fill_in_addresses = &athlon_fill_in_addresses,
.setup_ctrs = &athlon_setup_ctrs,
.check_ctrs = &athlon_check_ctrs,
.start = &athlon_start,
+ .stop = &athlon_stop
+};
+
+struct op_x86_model_spec const op_amd_fam15h_spec = {
+ .num_counters = FAM15H_NUM_COUNTERS,
+ .num_controls = FAM15H_NUM_CONTROLS,
+ .fill_in_addresses = &fam15h_fill_in_addresses,
+ .setup_ctrs = &athlon_setup_ctrs,
+ .check_ctrs = &athlon_check_ctrs,
+ .start = &athlon_start,
.stop = &athlon_stop
};
Index: xen-4.1.2-testing/xen/arch/x86/oprofile/op_x86_model.h
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/oprofile/op_x86_model.h
+++ xen-4.1.2-testing/xen/arch/x86/oprofile/op_x86_model.h
@@ -48,6 +48,7 @@ extern struct op_x86_model_spec op_arch_
extern struct op_x86_model_spec const op_p4_spec;
extern struct op_x86_model_spec const op_p4_ht2_spec;
extern struct op_x86_model_spec const op_athlon_spec;
+extern struct op_x86_model_spec const op_amd_fam15h_spec;
void arch_perfmon_setup_counters(void);
#endif /* OP_X86_MODEL_H */
Index: xen-4.1.2-testing/xen/include/asm-x86/msr-index.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/msr-index.h
+++ xen-4.1.2-testing/xen/include/asm-x86/msr-index.h
@@ -219,6 +219,19 @@
#define MSR_K8_VM_CR 0xc0010114
#define MSR_K8_VM_HSAVE_PA 0xc0010117
+#define MSR_AMD_FAM15H_EVNTSEL0 0xc0010200
+#define MSR_AMD_FAM15H_PERFCTR0 0xc0010201
+#define MSR_AMD_FAM15H_EVNTSEL1 0xc0010202
+#define MSR_AMD_FAM15H_PERFCTR1 0xc0010203
+#define MSR_AMD_FAM15H_EVNTSEL2 0xc0010204
+#define MSR_AMD_FAM15H_PERFCTR2 0xc0010205
+#define MSR_AMD_FAM15H_EVNTSEL3 0xc0010206
+#define MSR_AMD_FAM15H_PERFCTR3 0xc0010207
+#define MSR_AMD_FAM15H_EVNTSEL4 0xc0010208
+#define MSR_AMD_FAM15H_PERFCTR4 0xc0010209
+#define MSR_AMD_FAM15H_EVNTSEL5 0xc001020a
+#define MSR_AMD_FAM15H_PERFCTR5 0xc001020b
+
#define MSR_K8_FEATURE_MASK 0xc0011004
#define MSR_K8_EXT_FEATURE_MASK 0xc0011005

View File

@ -1,261 +0,0 @@
References: FATE#309893, FATE#309906
# HG changeset patch
# User Jacob Shin <jacob.shin@amd.com>
# Date 1304931286 -3600
# Node ID e787d4f2e5acdba48728a9390710de800315a540
# Parent 014ee4e09644bd3ae55919d267f742c1d60c337a
hvm: vpmu: Add support for AMD Family 15h processors
AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates HVM VPMU
to take advantage of the new counters.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -1142,6 +1142,18 @@ static int svm_msr_read_intercept(unsign
case MSR_K7_EVNTSEL1:
case MSR_K7_EVNTSEL2:
case MSR_K7_EVNTSEL3:
+ case MSR_AMD_FAM15H_PERFCTR0:
+ case MSR_AMD_FAM15H_PERFCTR1:
+ case MSR_AMD_FAM15H_PERFCTR2:
+ case MSR_AMD_FAM15H_PERFCTR3:
+ case MSR_AMD_FAM15H_PERFCTR4:
+ case MSR_AMD_FAM15H_PERFCTR5:
+ case MSR_AMD_FAM15H_EVNTSEL0:
+ case MSR_AMD_FAM15H_EVNTSEL1:
+ case MSR_AMD_FAM15H_EVNTSEL2:
+ case MSR_AMD_FAM15H_EVNTSEL3:
+ case MSR_AMD_FAM15H_EVNTSEL4:
+ case MSR_AMD_FAM15H_EVNTSEL5:
vpmu_do_rdmsr(msr, msr_content);
break;
@@ -1237,6 +1249,18 @@ static int svm_msr_write_intercept(unsig
case MSR_K7_EVNTSEL1:
case MSR_K7_EVNTSEL2:
case MSR_K7_EVNTSEL3:
+ case MSR_AMD_FAM15H_PERFCTR0:
+ case MSR_AMD_FAM15H_PERFCTR1:
+ case MSR_AMD_FAM15H_PERFCTR2:
+ case MSR_AMD_FAM15H_PERFCTR3:
+ case MSR_AMD_FAM15H_PERFCTR4:
+ case MSR_AMD_FAM15H_PERFCTR5:
+ case MSR_AMD_FAM15H_EVNTSEL0:
+ case MSR_AMD_FAM15H_EVNTSEL1:
+ case MSR_AMD_FAM15H_EVNTSEL2:
+ case MSR_AMD_FAM15H_EVNTSEL3:
+ case MSR_AMD_FAM15H_EVNTSEL4:
+ case MSR_AMD_FAM15H_EVNTSEL5:
vpmu_do_wrmsr(msr, msr_content);
break;
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/vpmu.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/vpmu.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/vpmu.c
@@ -36,7 +36,9 @@
#include <public/hvm/save.h>
#include <asm/hvm/vpmu.h>
-#define NUM_COUNTERS 4
+#define F10H_NUM_COUNTERS 4
+#define F15H_NUM_COUNTERS 6
+#define MAX_NUM_COUNTERS F15H_NUM_COUNTERS
#define MSR_F10H_EVNTSEL_GO_SHIFT 40
#define MSR_F10H_EVNTSEL_EN_SHIFT 22
@@ -47,6 +49,11 @@
#define set_guest_mode(msr) (msr |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
#define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH-1))))
+static int __read_mostly num_counters = 0;
+static u32 __read_mostly *counters = NULL;
+static u32 __read_mostly *ctrls = NULL;
+static bool_t __read_mostly k7_counters_mirrored = 0;
+
/* PMU Counter MSRs. */
u32 AMD_F10H_COUNTERS[] = {
MSR_K7_PERFCTR0,
@@ -63,10 +70,28 @@ u32 AMD_F10H_CTRLS[] = {
MSR_K7_EVNTSEL3
};
+u32 AMD_F15H_COUNTERS[] = {
+ MSR_AMD_FAM15H_PERFCTR0,
+ MSR_AMD_FAM15H_PERFCTR1,
+ MSR_AMD_FAM15H_PERFCTR2,
+ MSR_AMD_FAM15H_PERFCTR3,
+ MSR_AMD_FAM15H_PERFCTR4,
+ MSR_AMD_FAM15H_PERFCTR5
+};
+
+u32 AMD_F15H_CTRLS[] = {
+ MSR_AMD_FAM15H_EVNTSEL0,
+ MSR_AMD_FAM15H_EVNTSEL1,
+ MSR_AMD_FAM15H_EVNTSEL2,
+ MSR_AMD_FAM15H_EVNTSEL3,
+ MSR_AMD_FAM15H_EVNTSEL4,
+ MSR_AMD_FAM15H_EVNTSEL5
+};
+
/* storage for context switching */
struct amd_vpmu_context {
- u64 counters[NUM_COUNTERS];
- u64 ctrls[NUM_COUNTERS];
+ u64 counters[MAX_NUM_COUNTERS];
+ u64 ctrls[MAX_NUM_COUNTERS];
u32 hw_lapic_lvtpc;
};
@@ -78,10 +103,45 @@ static inline int get_pmu_reg_type(u32 a
if ( (addr >= MSR_K7_PERFCTR0) && (addr <= MSR_K7_PERFCTR3) )
return MSR_TYPE_COUNTER;
+ if ( (addr >= MSR_AMD_FAM15H_EVNTSEL0) &&
+ (addr <= MSR_AMD_FAM15H_PERFCTR5 ) )
+ {
+ if (addr & 1)
+ return MSR_TYPE_COUNTER;
+ else
+ return MSR_TYPE_CTRL;
+ }
+
/* unsupported registers */
return -1;
}
+static inline u32 get_fam15h_addr(u32 addr)
+{
+ switch ( addr )
+ {
+ case MSR_K7_PERFCTR0:
+ return MSR_AMD_FAM15H_PERFCTR0;
+ case MSR_K7_PERFCTR1:
+ return MSR_AMD_FAM15H_PERFCTR1;
+ case MSR_K7_PERFCTR2:
+ return MSR_AMD_FAM15H_PERFCTR2;
+ case MSR_K7_PERFCTR3:
+ return MSR_AMD_FAM15H_PERFCTR3;
+ case MSR_K7_EVNTSEL0:
+ return MSR_AMD_FAM15H_EVNTSEL0;
+ case MSR_K7_EVNTSEL1:
+ return MSR_AMD_FAM15H_EVNTSEL1;
+ case MSR_K7_EVNTSEL2:
+ return MSR_AMD_FAM15H_EVNTSEL2;
+ case MSR_K7_EVNTSEL3:
+ return MSR_AMD_FAM15H_EVNTSEL3;
+ default:
+ break;
+ }
+
+ return addr;
+}
static int amd_vpmu_do_interrupt(struct cpu_user_regs *regs)
{
@@ -110,12 +170,12 @@ static inline void context_restore(struc
struct vpmu_struct *vpmu = vcpu_vpmu(v);
struct amd_vpmu_context *ctxt = vpmu->context;
- for ( i = 0; i < NUM_COUNTERS; i++ )
- wrmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+ for ( i = 0; i < num_counters; i++ )
+ wrmsrl(ctrls[i], ctxt->ctrls[i]);
- for ( i = 0; i < NUM_COUNTERS; i++ )
+ for ( i = 0; i < num_counters; i++ )
{
- wrmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+ wrmsrl(counters[i], ctxt->counters[i]);
/* Force an interrupt to allow guest reset the counter,
if the value is positive */
@@ -147,11 +207,11 @@ static inline void context_save(struct v
struct vpmu_struct *vpmu = vcpu_vpmu(v);
struct amd_vpmu_context *ctxt = vpmu->context;
- for ( i = 0; i < NUM_COUNTERS; i++ )
- rdmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+ for ( i = 0; i < num_counters; i++ )
+ rdmsrl(counters[i], ctxt->counters[i]);
- for ( i = 0; i < NUM_COUNTERS; i++ )
- rdmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+ for ( i = 0; i < num_counters; i++ )
+ rdmsrl(ctrls[i], ctxt->ctrls[i]);
}
static void amd_vpmu_save(struct vcpu *v)
@@ -175,12 +235,18 @@ static void context_update(unsigned int
struct vpmu_struct *vpmu = vcpu_vpmu(v);
struct amd_vpmu_context *ctxt = vpmu->context;
- for ( i = 0; i < NUM_COUNTERS; i++ )
- if ( msr == AMD_F10H_COUNTERS[i] )
+ if ( k7_counters_mirrored &&
+ ((msr >= MSR_K7_EVNTSEL0) && (msr <= MSR_K7_PERFCTR3)) )
+ {
+ msr = get_fam15h_addr(msr);
+ }
+
+ for ( i = 0; i < num_counters; i++ )
+ if ( msr == counters[i] )
ctxt->counters[i] = msr_content;
- for ( i = 0; i < NUM_COUNTERS; i++ )
- if ( msr == AMD_F10H_CTRLS[i] )
+ for ( i = 0; i < num_counters; i++ )
+ if ( msr == ctrls[i] )
ctxt->ctrls[i] = msr_content;
ctxt->hw_lapic_lvtpc = apic_read(APIC_LVTPC);
@@ -235,10 +301,31 @@ static void amd_vpmu_initialise(struct v
{
struct amd_vpmu_context *ctxt = NULL;
struct vpmu_struct *vpmu = vcpu_vpmu(v);
+ __u8 family = current_cpu_data.x86;
if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
return;
+ if ( counters == NULL )
+ {
+ switch ( family )
+ {
+ case 0x15:
+ num_counters = F15H_NUM_COUNTERS;
+ counters = AMD_F15H_COUNTERS;
+ ctrls = AMD_F15H_CTRLS;
+ k7_counters_mirrored = 1;
+ break;
+ case 0x10:
+ default:
+ num_counters = F10H_NUM_COUNTERS;
+ counters = AMD_F10H_COUNTERS;
+ ctrls = AMD_F10H_CTRLS;
+ k7_counters_mirrored = 0;
+ break;
+ }
+ }
+
ctxt = xmalloc_bytes(sizeof(struct amd_vpmu_context));
if ( !ctxt )
Index: xen-4.1.2-testing/xen/arch/x86/hvm/vpmu.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/vpmu.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/vpmu.c
@@ -101,6 +101,7 @@ void vpmu_initialise(struct vcpu *v)
switch ( family )
{
case 0x10:
+ case 0x15:
vpmu->arch_vpmu_ops = &amd_vpmu_ops;
break;
default:

View File

@ -17,11 +17,11 @@ Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com> Acked-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Index: xen-4.1.2-testing/tools/libxc/xc_domain_restore.c Index: xen-4.1.3-testing/tools/libxc/xc_domain_restore.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_domain_restore.c --- xen-4.1.3-testing.orig/tools/libxc/xc_domain_restore.c
+++ xen-4.1.2-testing/tools/libxc/xc_domain_restore.c +++ xen-4.1.3-testing/tools/libxc/xc_domain_restore.c
@@ -1134,23 +1134,19 @@ int xc_domain_restore(xc_interface *xch, @@ -1145,23 +1145,19 @@ int xc_domain_restore(xc_interface *xch,
int orig_io_fd_flags; int orig_io_fd_flags;
@ -49,10 +49,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_domain_restore.c
ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt)); ctxt = xc_hypercall_buffer_alloc(xch, ctxt, sizeof(*ctxt));
if ( ctxt == NULL ) if ( ctxt == NULL )
Index: xen-4.1.2-testing/tools/libxc/xc_domain_save.c Index: xen-4.1.3-testing/tools/libxc/xc_domain_save.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_domain_save.c --- xen-4.1.3-testing.orig/tools/libxc/xc_domain_save.c
+++ xen-4.1.2-testing/tools/libxc/xc_domain_save.c +++ xen-4.1.3-testing/tools/libxc/xc_domain_save.c
@@ -958,11 +958,8 @@ int xc_domain_save(xc_interface *xch, in @@ -958,11 +958,8 @@ int xc_domain_save(xc_interface *xch, in
unsigned long mfn; unsigned long mfn;

View File

@ -1,133 +0,0 @@
References: FATE#309901
# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1306569488 -3600
# Node ID d7c755c25bb9d6ed77d64cb6736b6c4f339db1bf
# Parent f6ce871e568949f5817470f6c7bab6ed1f8f6c13
HVM/SVM: enable tsc scaling ratio for SVM
Future AMD CPUs support TSC scaling. It allows guests to have a
different TSC frequency from host system using this formula: guest_tsc
= host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR
contains a fixed-point number in 8.32 format (8 bits for integer part
and 32bits for fractional part). For instance 0x00000003_80000000
means tsc_ratio=3.5.
This patch enables TSC scaling ratio for SVM. With it, guest VMs don't
need take #VMEXIT to calculate a translated TSC value when it is
running under TSC emulation mode. This can substancially reduce the
rdtsc overhead.
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -588,6 +588,22 @@ static void svm_set_segment_register(str
static void svm_set_tsc_offset(struct vcpu *v, u64 offset)
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+ struct domain *d = v->domain;
+
+ /* Re-adjust the offset value when TSC_RATIO is available */
+ if ( cpu_has_tsc_ratio && d->arch.vtsc )
+ {
+ uint64_t host_tsc, guest_tsc;
+
+ rdtscll(host_tsc);
+ guest_tsc = hvm_get_guest_tsc(v);
+
+ /* calculate hi,lo parts in 64bits to prevent overflow */
+ offset = (((host_tsc >> 32) * d->arch.tsc_khz / cpu_khz) << 32) +
+ (host_tsc & 0xffffffffULL) * d->arch.tsc_khz / cpu_khz;
+ offset = guest_tsc - offset;
+ }
+
vmcb_set_tsc_offset(vmcb, offset);
}
@@ -638,6 +654,19 @@ static void svm_init_hypercall_page(stru
*(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
}
+static inline void svm_tsc_ratio_save(struct vcpu *v)
+{
+ /* Other vcpus might not have vtsc enabled. So disable TSC_RATIO here. */
+ if ( cpu_has_tsc_ratio && v->domain->arch.vtsc )
+ wrmsrl(MSR_AMD64_TSC_RATIO, DEFAULT_TSC_RATIO);
+}
+
+static inline void svm_tsc_ratio_load(struct vcpu *v)
+{
+ if ( cpu_has_tsc_ratio && v->domain->arch.vtsc )
+ wrmsrl(MSR_AMD64_TSC_RATIO, vcpu_tsc_ratio(v));
+}
+
static void svm_ctxt_switch_from(struct vcpu *v)
{
int cpu = smp_processor_id();
@@ -646,6 +675,7 @@ static void svm_ctxt_switch_from(struct
svm_save_dr(v);
vpmu_save(v);
+ svm_tsc_ratio_save(v);
svm_sync_vmcb(v);
svm_vmload(per_cpu(root_vmcb, cpu));
@@ -689,6 +719,7 @@ static void svm_ctxt_switch_to(struct vc
svm_vmload(vmcb);
vmcb->cleanbits.bytes = 0;
vpmu_load(v);
+ svm_tsc_ratio_load(v);
if ( cpu_has_rdtscp )
wrmsrl(MSR_TSC_AUX, hvm_msr_tsc_aux(v));
Index: xen-4.1.2-testing/xen/arch/x86/hvm/svm/vmcb.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/svm/vmcb.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/svm/vmcb.c
@@ -165,7 +165,9 @@ static int construct_vmcb(struct vcpu *v
/* TSC. */
vmcb->_tsc_offset = 0;
- if ( v->domain->arch.vtsc )
+
+ /* Don't need to intercept RDTSC if CPU supports TSC rate scaling */
+ if ( v->domain->arch.vtsc && !cpu_has_tsc_ratio )
{
vmcb->_general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
vmcb->_general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/svm.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/svm.h
@@ -91,5 +91,13 @@ extern u32 svm_feature_flags;
#define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
#define cpu_has_svm_decode cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
#define cpu_has_pause_filter cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
+#define cpu_has_tsc_ratio cpu_has_svm_feature(SVM_FEATURE_TSCRATEMSR)
+
+/* TSC rate */
+#define DEFAULT_TSC_RATIO 0x0000000100000000ULL
+#define TSC_RATIO_RSVD_BITS 0xffffff0000000000ULL
+#define TSC_RATIO(g_khz, h_khz) ( (((u64)(g_khz)<<32)/(u64)(h_khz)) & \
+ ~TSC_RATIO_RSVD_BITS )
+#define vcpu_tsc_ratio(v) TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz)
#endif /* __ASM_X86_HVM_SVM_H__ */
Index: xen-4.1.2-testing/xen/include/asm-x86/msr-index.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/msr-index.h
+++ xen-4.1.2-testing/xen/include/asm-x86/msr-index.h
@@ -261,6 +261,9 @@
#define MSR_AMD_PATCHLEVEL 0x0000008b
#define MSR_AMD_PATCHLOADER 0xc0010020
+/* AMD TSC RATE MSR */
+#define MSR_AMD64_TSC_RATIO 0xc0000104
+
/* AMD OS Visible Workaround MSRs */
#define MSR_AMD_OSVW_ID_LENGTH 0xc0010140
#define MSR_AMD_OSVW_STATUS 0xc0010141

View File

@ -12,11 +12,11 @@ is of use to nestedvmx, and every 64-bit cpu should support it.
Signed-off-by: Eddie Dong <eddie.dong@intel.com> Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org> Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/hvm/vmx/vmcs.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmcs.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/vmx/vmcs.c +++ xen-4.1.3-testing/xen/arch/x86/hvm/vmx/vmcs.c
@@ -148,6 +148,11 @@ static int vmx_init_vmcs_config(void) @@ -143,6 +143,11 @@ static int vmx_init_vmcs_config(void)
MSR_IA32_VMX_PINBASED_CTLS, &mismatch); MSR_IA32_VMX_PINBASED_CTLS, &mismatch);
min = (CPU_BASED_HLT_EXITING | min = (CPU_BASED_HLT_EXITING |
@ -28,7 +28,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/vmx/vmcs.c
CPU_BASED_INVLPG_EXITING | CPU_BASED_INVLPG_EXITING |
CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_LOAD_EXITING |
CPU_BASED_CR3_STORE_EXITING | CPU_BASED_CR3_STORE_EXITING |
@@ -166,13 +171,9 @@ static int vmx_init_vmcs_config(void) @@ -161,13 +166,9 @@ static int vmx_init_vmcs_config(void)
MSR_IA32_VMX_PROCBASED_CTLS, &mismatch); MSR_IA32_VMX_PROCBASED_CTLS, &mismatch);
_vmx_cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING; _vmx_cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING;
#ifdef __x86_64__ #ifdef __x86_64__

View File

@ -1,30 +0,0 @@
References: FATE#309893
# HG changeset patch
# User Mark Langsdorf <mark.langsdorf@amd.com>
# Date 1308051989 -3600
# Node ID 450f1d198e1e299b69489d513f591f0301cc5166
# Parent 864a3dd1d9b4664f1ece44c9eaf390969253b7a8
x86/amd: Eliminate cache flushing when entering C3 on select AMD processors
AMD Fam15h processors have a shared cache. It does not need
to be be flushed when entering C3 and doing so causes reduces
performance. Modify acpi_processor_power_init_bm_check to
prevent these processors from flushing when entering C3.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -710,7 +710,8 @@ static void acpi_processor_power_init_bm
flags->bm_check = 0;
if ( num_online_cpus() == 1 )
flags->bm_check = 1;
- else if ( c->x86_vendor == X86_VENDOR_INTEL )
+ else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
+ ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
{
/*
* Today all MP CPUs that support C3 share cache.

View File

@ -10,10 +10,10 @@ iommu=debug is set xen boot parameter.
Signed-off-by: Allen Kay <allen.m.kay@intel.com> Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Index: xen-4.1.2-testing/xen/drivers/passthrough/amd/iommu_acpi.c Index: xen-4.1.3-testing/xen/drivers/passthrough/amd/iommu_acpi.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/amd/iommu_acpi.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/amd/iommu_acpi.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/amd/iommu_acpi.c +++ xen-4.1.3-testing/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -822,7 +822,7 @@ static int __init parse_ivrs_table(struc @@ -822,7 +822,7 @@ static int __init parse_ivrs_table(struc
BUG_ON(!table); BUG_ON(!table);
@ -23,10 +23,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/amd/iommu_acpi.c
dump_acpi_table_header(table); dump_acpi_table_header(table);
/* parse IVRS blocks */ /* parse IVRS blocks */
Index: xen-4.1.2-testing/xen/drivers/passthrough/iommu.c Index: xen-4.1.3-testing/xen/drivers/passthrough/iommu.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/iommu.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/iommu.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/iommu.c +++ xen-4.1.3-testing/xen/drivers/passthrough/iommu.c
@@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1; @@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1;
bool_t __read_mostly iommu_qinval = 1; bool_t __read_mostly iommu_qinval = 1;
bool_t __read_mostly iommu_intremap = 1; bool_t __read_mostly iommu_intremap = 1;
@ -47,11 +47,11 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/iommu.c
else if ( !strcmp(s, "amd-iommu-perdev-intremap") ) else if ( !strcmp(s, "amd-iommu-perdev-intremap") )
amd_iommu_perdev_intremap = 1; amd_iommu_perdev_intremap = 1;
else if ( !strcmp(s, "dom0-passthrough") ) else if ( !strcmp(s, "dom0-passthrough") )
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/iommu.c --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.c
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.c
@@ -821,7 +821,7 @@ static int iommu_page_fault_do_one(struc @@ -844,7 +844,7 @@ static int iommu_page_fault_do_one(struc
if ( fault_type == DMA_REMAP ) if ( fault_type == DMA_REMAP )
{ {
@ -60,7 +60,7 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c
"DMAR:[%s] Request device [%02x:%02x.%d] " "DMAR:[%s] Request device [%02x:%02x.%d] "
"fault addr %"PRIx64", iommu reg = %p\n" "fault addr %"PRIx64", iommu reg = %p\n"
"DMAR:[fault reason %02xh] %s\n", "DMAR:[fault reason %02xh] %s\n",
@@ -830,12 +830,13 @@ static int iommu_page_fault_do_one(struc @@ -853,12 +853,13 @@ static int iommu_page_fault_do_one(struc
PCI_FUNC(source_id & 0xFF), addr, iommu->reg, PCI_FUNC(source_id & 0xFF), addr, iommu->reg,
fault_reason, reason); fault_reason, reason);
#ifndef __i386__ /* map_domain_page() cannot be used in this context */ #ifndef __i386__ /* map_domain_page() cannot be used in this context */
@ -76,7 +76,7 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c
"INTR-REMAP: Request device [%02x:%02x.%d] " "INTR-REMAP: Request device [%02x:%02x.%d] "
"fault index %"PRIx64", iommu reg = %p\n" "fault index %"PRIx64", iommu reg = %p\n"
"INTR-REMAP:[fault reason %02xh] %s\n", "INTR-REMAP:[fault reason %02xh] %s\n",
@@ -849,26 +850,19 @@ static int iommu_page_fault_do_one(struc @@ -872,26 +873,19 @@ static int iommu_page_fault_do_one(struc
static void iommu_fault_status(u32 fault_status) static void iommu_fault_status(u32 fault_status)
{ {
if ( fault_status & DMA_FSTS_PFO ) if ( fault_status & DMA_FSTS_PFO )
@ -110,10 +110,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.c
} }
#define PRIMARY_FAULT_REG_LEN (16) #define PRIMARY_FAULT_REG_LEN (16)
Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h Index: xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/passthrough/vtd/iommu.h --- xen-4.1.3-testing.orig/xen/drivers/passthrough/vtd/iommu.h
+++ xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h +++ xen-4.1.3-testing/xen/drivers/passthrough/vtd/iommu.h
@@ -512,4 +512,11 @@ struct intel_iommu { @@ -512,4 +512,11 @@ struct intel_iommu {
struct acpi_drhd_unit *drhd; struct acpi_drhd_unit *drhd;
}; };
@ -126,10 +126,10 @@ Index: xen-4.1.2-testing/xen/drivers/passthrough/vtd/iommu.h
+ } while(0) + } while(0)
+ +
#endif #endif
Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h Index: xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ xen-4.1.3-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#define AMD_IOMMU_DEBUG(fmt, args...) \ #define AMD_IOMMU_DEBUG(fmt, args...) \
do \ do \
@ -139,10 +139,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \ printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \
} while(0) } while(0)
Index: xen-4.1.2-testing/xen/include/xen/iommu.h Index: xen-4.1.3-testing/xen/include/xen/iommu.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/iommu.h --- xen-4.1.3-testing.orig/xen/include/xen/iommu.h
+++ xen-4.1.2-testing/xen/include/xen/iommu.h +++ xen-4.1.3-testing/xen/include/xen/iommu.h
@@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose @@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose
extern bool_t iommu_workaround_bios_bug, iommu_passthrough; extern bool_t iommu_workaround_bios_bug, iommu_passthrough;
extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; extern bool_t iommu_snoop, iommu_qinval, iommu_intremap;

View File

@ -12,13 +12,13 @@ another prerequisite for native EFI booting support.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c Index: xen-4.1.3-testing/xen/arch/x86/dmi_scan.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/dmi_scan.c --- xen-4.1.3-testing.orig/xen/arch/x86/dmi_scan.c
+++ xen-4.1.2-testing/xen/arch/x86/dmi_scan.c +++ xen-4.1.3-testing/xen/arch/x86/dmi_scan.c
@@ -10,11 +10,31 @@ @@ -12,11 +12,31 @@
#include <asm/system.h> #include <xen/pci.h>
#include <xen/dmi.h> #include <xen/pci_regs.h>
-#define bt_ioremap(b,l) ((u8 *)__acpi_map_table(b,l)) -#define bt_ioremap(b,l) ((u8 *)__acpi_map_table(b,l))
+#define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l)) +#define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l))
@ -49,7 +49,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
struct dmi_header struct dmi_header
{ {
u8 type; u8 type;
@@ -90,62 +110,70 @@ static int __init dmi_table(u32 base, in @@ -92,62 +112,70 @@ static int __init dmi_table(u32 base, in
} }

View File

@ -20,11 +20,11 @@ Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/x86_64/traps.c | 12 ++++++++---- xen/arch/x86/x86_64/traps.c | 12 ++++++++----
6 files changed, 17 insertions(+), 11 deletions(-) 6 files changed, 17 insertions(+), 11 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -151,6 +151,8 @@ unsigned long __read_mostly pdx_group_va @@ -152,6 +152,8 @@ unsigned long __read_mostly pdx_group_va
(FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - 1) (FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - 1)
/ PDX_GROUP_COUNT)] = { [0] = 1 }; / PDX_GROUP_COUNT)] = { [0] = 1 };
@ -33,11 +33,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
#define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT) #define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT)
bool_t __read_mostly opt_allow_superpage; bool_t __read_mostly opt_allow_superpage;
Index: xen-4.1.2-testing/xen/arch/x86/traps.c Index: xen-4.1.3-testing/xen/arch/x86/traps.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c --- xen-4.1.3-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c +++ xen-4.1.3-testing/xen/arch/x86/traps.c
@@ -1428,6 +1428,7 @@ asmlinkage void __init do_early_page_fau @@ -1454,6 +1454,7 @@ asmlinkage void __init do_early_page_fau
unsigned long *stk = (unsigned long *)regs; unsigned long *stk = (unsigned long *)regs;
printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n",
regs->cs, _p(regs->eip), _p(cr2), regs->error_code); regs->cs, _p(regs->eip), _p(cr2), regs->error_code);
@ -45,10 +45,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
printk("Stack dump: "); printk("Stack dump: ");
while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 ) while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 )
printk("%p ", _p(*stk++)); printk("%p ", _p(*stk++));
Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_32/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
@@ -39,8 +39,6 @@ extern l1_pgentry_t l1_identmap[L1_PAGET @@ -39,8 +39,6 @@ extern l1_pgentry_t l1_identmap[L1_PAGET
unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR; unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR;
unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE;
@ -58,10 +58,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c
static unsigned long __read_mostly mpt_size; static unsigned long __read_mostly mpt_size;
void *alloc_xen_pagetable(void) void *alloc_xen_pagetable(void)
Index: xen-4.1.2-testing/xen/arch/x86/x86_32/traps.c Index: xen-4.1.3-testing/xen/arch/x86/x86_32/traps.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_32/traps.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_32/traps.c +++ xen-4.1.3-testing/xen/arch/x86/x86_32/traps.c
@@ -164,7 +164,8 @@ void show_page_walk(unsigned long addr) @@ -164,7 +164,8 @@ void show_page_walk(unsigned long addr)
l3t += (cr3 & 0xFE0UL) >> 3; l3t += (cr3 & 0xFE0UL) >> 3;
l3e = l3t[l3_table_offset(addr)]; l3e = l3t[l3_table_offset(addr)];
@ -92,10 +92,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_32/traps.c
printk(" L1[0x%03lx] = %"PRIpte" %08lx\n", printk(" L1[0x%03lx] = %"PRIpte" %08lx\n",
l1_table_offset(addr), l1e_get_intpte(l1e), pfn); l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
unmap_domain_page(l1t); unmap_domain_page(l1t);
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
@@ -47,8 +47,6 @@ unsigned int __read_mostly pfn_pdx_hole_ @@ -47,8 +47,6 @@ unsigned int __read_mostly pfn_pdx_hole_
unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START; unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;
@ -105,10 +105,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c
/* Top-level master (and idle-domain) page directory. */ /* Top-level master (and idle-domain) page directory. */
l4_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) l4_pgentry_t __attribute__ ((__section__ (".bss.page_aligned")))
idle_pg_table[L4_PAGETABLE_ENTRIES]; idle_pg_table[L4_PAGETABLE_ENTRIES];
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/traps.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/traps.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/traps.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/traps.c +++ xen-4.1.3-testing/xen/arch/x86/x86_64/traps.c
@@ -176,7 +176,8 @@ void show_page_walk(unsigned long addr) @@ -176,7 +176,8 @@ void show_page_walk(unsigned long addr)
l4t = mfn_to_virt(mfn); l4t = mfn_to_virt(mfn);
l4e = l4t[l4_table_offset(addr)]; l4e = l4t[l4_table_offset(addr)];

View File

@ -44,10 +44,10 @@ Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/xenpaging/xenpaging.h | 1 tools/xenpaging/xenpaging.h | 1
12 files changed, 91 insertions(+), 618 deletions(-) 12 files changed, 91 insertions(+), 618 deletions(-)
Index: xen-4.1.2-testing/tools/blktap2/drivers/block-log.c Index: xen-4.1.3-testing/tools/blktap2/drivers/block-log.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/blktap2/drivers/block-log.c --- xen-4.1.3-testing.orig/tools/blktap2/drivers/block-log.c
+++ xen-4.1.2-testing/tools/blktap2/drivers/block-log.c +++ xen-4.1.3-testing/tools/blktap2/drivers/block-log.c
@@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
@ -98,10 +98,10 @@ Index: xen-4.1.2-testing/tools/blktap2/drivers/block-log.c
BWPRINTF("could not allocate dirty bitmap of size %"PRIu64, bmsize); BWPRINTF("could not allocate dirty bitmap of size %"PRIu64, bmsize);
return -1; return -1;
} }
Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_restore.c Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_restore.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/ia64/xc_ia64_linux_restore.c --- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_linux_restore.c
+++ xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_restore.c +++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_restore.c
@@ -218,14 +218,12 @@ xc_ia64_recv_vcpumap(xc_interface *xch, @@ -218,14 +218,12 @@ xc_ia64_recv_vcpumap(xc_interface *xch,
max_virt_cpus, info->max_vcpu_id); max_virt_cpus, info->max_vcpu_id);
return -1; return -1;
@ -139,10 +139,10 @@ Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_restore.c
continue; continue;
if (xc_ia64_recv_vcpu_context(xch, io_fd, dom, i, &ctxt_any)) if (xc_ia64_recv_vcpu_context(xch, io_fd, dom, i, &ctxt_any))
Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_save.c Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_save.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/ia64/xc_ia64_linux_save.c --- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_linux_save.c
+++ xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_save.c +++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_linux_save.c
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
#include <sys/time.h> #include <sys/time.h>
@ -214,10 +214,10 @@ Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_linux_save.c
continue; continue;
if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any)) if (xc_ia64_send_vcpu_context(xch, io_fd, dom, i, &ctxt_any))
Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_save_restore.h Index: xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_save_restore.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/ia64/xc_ia64_save_restore.h --- xen-4.1.3-testing.orig/tools/libxc/ia64/xc_ia64_save_restore.h
+++ xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_save_restore.h +++ xen-4.1.3-testing/tools/libxc/ia64/xc_ia64_save_restore.h
@@ -33,26 +33,6 @@ @@ -33,26 +33,6 @@
#define XC_IA64_SR_FORMAT_VER_CURRENT XC_IA64_SR_FORMAT_VER_THREE #define XC_IA64_SR_FORMAT_VER_CURRENT XC_IA64_SR_FORMAT_VER_THREE
@ -245,10 +245,10 @@ Index: xen-4.1.2-testing/tools/libxc/ia64/xc_ia64_save_restore.h
#endif /* XC_IA64_SAVE_RESTORE_H */ #endif /* XC_IA64_SAVE_RESTORE_H */
Index: xen-4.1.2-testing/tools/libxc/xc_bitops.h Index: xen-4.1.3-testing/tools/libxc/xc_bitops.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/tools/libxc/xc_bitops.h +++ xen-4.1.3-testing/tools/libxc/xc_bitops.h
@@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
+#ifndef XC_BITOPS_H +#ifndef XC_BITOPS_H
+#define XC_BITOPS_H 1 +#define XC_BITOPS_H 1
@ -307,10 +307,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_bitops.h
+} +}
+ +
+#endif /* XC_BITOPS_H */ +#endif /* XC_BITOPS_H */
Index: xen-4.1.2-testing/tools/libxc/xc_domain_save.c Index: xen-4.1.3-testing/tools/libxc/xc_domain_save.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_domain_save.c --- xen-4.1.3-testing.orig/tools/libxc/xc_domain_save.c
+++ xen-4.1.2-testing/tools/libxc/xc_domain_save.c +++ xen-4.1.3-testing/tools/libxc/xc_domain_save.c
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
#include <sys/time.h> #include <sys/time.h>
@ -408,7 +408,7 @@ Index: xen-4.1.2-testing/tools/libxc/xc_domain_save.c
debug = 0; debug = 0;
DPRINTF("Entering debug resend-all mode\n"); DPRINTF("Entering debug resend-all mode\n");
@@ -1959,8 +1909,8 @@ int xc_domain_save(xc_interface *xch, in @@ -1971,8 +1921,8 @@ int xc_domain_save(xc_interface *xch, in
if ( ctx->live_m2p ) if ( ctx->live_m2p )
munmap(ctx->live_m2p, M2P_SIZE(ctx->max_mfn)); munmap(ctx->live_m2p, M2P_SIZE(ctx->max_mfn));
@ -419,9 +419,9 @@ Index: xen-4.1.2-testing/tools/libxc/xc_domain_save.c
free(pfn_type); free(pfn_type);
free(pfn_batch); free(pfn_batch);
Index: xen-4.1.2-testing/tools/xenpaging/bitops.h Index: xen-4.1.3-testing/tools/xenpaging/bitops.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/bitops.h --- xen-4.1.3-testing.orig/tools/xenpaging/bitops.h
+++ /dev/null +++ /dev/null
@@ -1,448 +0,0 @@ @@ -1,448 +0,0 @@
-#ifndef _X86_BITOPS_H -#ifndef _X86_BITOPS_H
@ -872,10 +872,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/bitops.h
-#define hweight8(x) generic_hweight8(x) -#define hweight8(x) generic_hweight8(x)
- -
-#endif /* _X86_BITOPS_H */ -#endif /* _X86_BITOPS_H */
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c Index: xen-4.1.3-testing/tools/xenpaging/policy_default.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c --- xen-4.1.3-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c +++ xen-4.1.3-testing/tools/xenpaging/policy_default.c
@@ -21,8 +21,7 @@ @@ -21,8 +21,7 @@
*/ */
@ -937,10 +937,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
out: out:
return rc; return rc;
} }
Index: xen-4.1.2-testing/tools/xenpaging/xc.c Index: xen-4.1.3-testing/tools/xenpaging/xc.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xc.c --- xen-4.1.3-testing.orig/tools/xenpaging/xc.c
+++ xen-4.1.2-testing/tools/xenpaging/xc.c +++ xen-4.1.3-testing/tools/xenpaging/xc.c
@@ -31,20 +31,6 @@ @@ -31,20 +31,6 @@
#include "xc.h" #include "xc.h"
@ -962,10 +962,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/xc.c
int xc_mem_paging_flush_ioemu_cache(domid_t domain_id) int xc_mem_paging_flush_ioemu_cache(domid_t domain_id)
{ {
Index: xen-4.1.2-testing/tools/xenpaging/xc.h Index: xen-4.1.3-testing/tools/xenpaging/xc.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xc.h --- xen-4.1.3-testing.orig/tools/xenpaging/xc.h
+++ xen-4.1.2-testing/tools/xenpaging/xc.h +++ xen-4.1.3-testing/tools/xenpaging/xc.h
@@ -39,7 +39,6 @@ @@ -39,7 +39,6 @@
#endif #endif
@ -982,10 +982,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/xc.h
int xc_mem_paging_flush_ioemu_cache(domid_t domain_id); int xc_mem_paging_flush_ioemu_cache(domid_t domain_id);
int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce); int xc_wait_for_event(xc_interface *xch, xc_evtchn *xce);
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
#include <xen/mem_event.h> #include <xen/mem_event.h>
@ -1009,10 +1009,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
{ {
ERROR("Error allocating bitmap"); ERROR("Error allocating bitmap");
goto err; goto err;
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.h
@@ -40,7 +40,6 @@ typedef struct xenpaging { @@ -40,7 +40,6 @@ typedef struct xenpaging {
xc_platform_info_t *platform_info; xc_platform_info_t *platform_info;
xc_domaininfo_t *domain_info; xc_domaininfo_t *domain_info;

View File

@ -1,222 +0,0 @@
References: fate#309894
# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1309248811 -3600
# Node ID 87c2013c2aa2d4874f892507e6cc7b52219a3acf
# Parent 819c315a919daec434f80ffb6e790ac492cbd2a7
x86: consolidate cpu_core_id and phys_proc_id into cpuinfo_x86 struct
This patch moves cpu_core_id and phys_proc_id into cpuinfo_x86
structure. This is similar to upstream Linux kernel's approach.
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/cpu/amd.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/amd.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/amd.c
@@ -579,11 +579,11 @@ static void __devinit init_amd(struct cp
while ((1 << bits) < c->x86_max_cores)
bits++;
}
- cpu_core_id[cpu] = phys_proc_id[cpu] & ((1<<bits)-1);
- phys_proc_id[cpu] >>= bits;
+ c->cpu_core_id = c->phys_proc_id & ((1<<bits)-1);
+ c->phys_proc_id >>= bits;
if (opt_cpu_info)
printk("CPU %d(%d) -> Core %d\n",
- cpu, c->x86_max_cores, cpu_core_id[cpu]);
+ cpu, c->x86_max_cores, c->cpu_core_id);
}
#endif
Index: xen-4.1.2-testing/xen/arch/x86/cpu/common.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/common.c
@@ -326,7 +326,7 @@ void __cpuinit generic_identify(struct c
early_intel_workaround(c);
#ifdef CONFIG_X86_HT
- phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
+ c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
#endif
}
@@ -362,6 +362,8 @@ void __cpuinit identify_cpu(struct cpuin
c->x86_max_cores = 1;
c->x86_num_siblings = 1;
c->x86_clflush_size = 0;
+ c->phys_proc_id = BAD_APICID;
+ c->cpu_core_id = BAD_APICID;
memset(&c->x86_capability, 0, sizeof c->x86_capability);
if (!have_cpuid_p()) {
@@ -510,7 +512,6 @@ void __cpuinit detect_extended_topology(
unsigned int ht_mask_width, core_plus_mask_width;
unsigned int core_select_mask, core_level_siblings;
unsigned int initial_apicid;
- int cpu = smp_processor_id();
if ( c->cpuid_level < 0xb )
return;
@@ -545,9 +546,9 @@ void __cpuinit detect_extended_topology(
core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
- cpu_core_id[cpu] = phys_pkg_id(initial_apicid, ht_mask_width)
+ c->cpu_core_id = phys_pkg_id(initial_apicid, ht_mask_width)
& core_select_mask;
- phys_proc_id[cpu] = phys_pkg_id(initial_apicid, core_plus_mask_width);
+ c->phys_proc_id = phys_pkg_id(initial_apicid, core_plus_mask_width);
c->apicid = phys_pkg_id(initial_apicid, 0);
c->x86_max_cores = (core_level_siblings / c->x86_num_siblings);
@@ -555,10 +556,10 @@ void __cpuinit detect_extended_topology(
if ( opt_cpu_info )
{
printk("CPU: Physical Processor ID: %d\n",
- phys_proc_id[cpu]);
+ c->phys_proc_id);
if ( c->x86_max_cores > 1 )
printk("CPU: Processor Core ID: %d\n",
- cpu_core_id[cpu]);
+ c->cpu_core_id);
}
}
@@ -567,7 +568,6 @@ void __cpuinit detect_ht(struct cpuinfo_
{
u32 eax, ebx, ecx, edx;
int index_msb, core_bits;
- int cpu = smp_processor_id();
cpuid(1, &eax, &ebx, &ecx, &edx);
@@ -590,11 +590,11 @@ void __cpuinit detect_ht(struct cpuinfo_
}
index_msb = get_count_order(c->x86_num_siblings);
- phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
+ c->phys_proc_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
if (opt_cpu_info)
printk("CPU: Physical Processor ID: %d\n",
- phys_proc_id[cpu]);
+ c->phys_proc_id);
c->x86_num_siblings = c->x86_num_siblings / c->x86_max_cores;
@@ -602,12 +602,12 @@ void __cpuinit detect_ht(struct cpuinfo_
core_bits = get_count_order(c->x86_max_cores);
- cpu_core_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) &
+ c->cpu_core_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) &
((1 << core_bits) - 1);
if (opt_cpu_info && c->x86_max_cores > 1)
printk("CPU: Processor Core ID: %d\n",
- cpu_core_id[cpu]);
+ c->cpu_core_id);
}
}
#endif
Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/mce.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/mcheck/mce.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/mce.c
@@ -1041,9 +1041,9 @@ void x86_mc_get_cpu_info(unsigned cpu, u
if (nthreads != NULL)
*nthreads = 1;
} else {
- *chipid = phys_proc_id[cpu];
+ *chipid = c->phys_proc_id;
if (c->x86_max_cores > 1)
- *coreid = cpu_core_id[cpu];
+ *coreid = c->cpu_core_id;
else
*coreid = 0;
*threadid = c->apicid & ((1 << (c->x86_num_siblings - 1)) - 1);
Index: xen-4.1.2-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.1.2-testing/xen/arch/x86/smpboot.c
@@ -51,12 +51,6 @@
/* Set if we find a B stepping CPU */
static int smp_b_stepping;
-/* Package ID of each logical CPU */
-int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
-
-/* Core ID of each logical CPU */
-int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
-
/* representing HT siblings of each logical CPU */
DEFINE_PER_CPU_READ_MOSTLY(cpumask_t, cpu_sibling_map);
/* representing HT and core siblings of each logical CPU */
@@ -257,8 +251,8 @@ static void set_cpu_sibling_map(int cpu)
{
for_each_cpu_mask ( i, cpu_sibling_setup_map )
{
- if ( (phys_proc_id[cpu] == phys_proc_id[i]) &&
- (cpu_core_id[cpu] == cpu_core_id[i]) )
+ if ( (c[cpu].phys_proc_id == c[i].phys_proc_id) &&
+ (c[cpu].cpu_core_id == c[i].cpu_core_id) )
{
cpu_set(i, per_cpu(cpu_sibling_map, cpu));
cpu_set(cpu, per_cpu(cpu_sibling_map, i));
@@ -281,7 +275,7 @@ static void set_cpu_sibling_map(int cpu)
for_each_cpu_mask ( i, cpu_sibling_setup_map )
{
- if ( phys_proc_id[cpu] == phys_proc_id[i] )
+ if ( c[cpu].phys_proc_id == c[i].phys_proc_id )
{
cpu_set(i, per_cpu(cpu_core_map, cpu));
cpu_set(cpu, per_cpu(cpu_core_map, i));
@@ -842,8 +836,8 @@ remove_siblinginfo(int cpu)
cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
cpus_clear(per_cpu(cpu_sibling_map, cpu));
cpus_clear(per_cpu(cpu_core_map, cpu));
- phys_proc_id[cpu] = BAD_APICID;
- cpu_core_id[cpu] = BAD_APICID;
+ c[cpu].phys_proc_id = BAD_APICID;
+ c[cpu].cpu_core_id = BAD_APICID;
cpu_clear(cpu, cpu_sibling_setup_map);
}
Index: xen-4.1.2-testing/xen/include/asm-x86/processor.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/processor.h
+++ xen-4.1.2-testing/xen/include/asm-x86/processor.h
@@ -175,6 +175,8 @@ struct cpuinfo_x86 {
__u32 x86_max_cores; /* cpuid returned max cores value */
__u32 booted_cores; /* number of cores as seen by OS */
__u32 x86_num_siblings; /* cpuid logical cpus per chip value */
+ int phys_proc_id; /* package ID of each logical CPU */
+ int cpu_core_id; /* core ID of each logical CPU*/
__u32 apicid;
unsigned short x86_clflush_size;
} __cacheline_aligned;
@@ -196,8 +198,6 @@ extern struct cpuinfo_x86 cpu_data[];
extern void set_cpuid_faulting(bool_t enable);
extern u64 host_pat;
-extern int phys_proc_id[NR_CPUS];
-extern int cpu_core_id[NR_CPUS];
extern bool_t opt_cpu_info;
/* Maximum width of physical addresses supported by the hardware */
@@ -217,8 +217,8 @@ extern void detect_ht(struct cpuinfo_x86
static always_inline void detect_ht(struct cpuinfo_x86 *c) {}
#endif
-#define cpu_to_core(_cpu) (cpu_core_id[_cpu])
-#define cpu_to_socket(_cpu) (phys_proc_id[_cpu])
+#define cpu_to_core(_cpu) (cpu_data[_cpu].cpu_core_id)
+#define cpu_to_socket(_cpu) (cpu_data[_cpu].phys_proc_id)
/*
* Generic CPUID function

View File

@ -1,176 +0,0 @@
References: fate#309894
# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1309248833 -3600
# Node ID c2c12b2dafb5b1d3bfcc4c05a60ca4f9051c90e7
# Parent 87c2013c2aa2d4874f892507e6cc7b52219a3acf
x86: AMD core-pair topology detection code
This patch is to support core-pair topology introduced by AMD CPUs,
which introduces a new concept of [core, compute unit]. There is a new
feature bit for topology extension in CPUID:0x80000001. Also a new
CPUID 0x8000001E is introduced for CPU topology enumeration. This
patch collects the sibling information from the new CPUID and will be
stored in the sibling map in Xen hypervisor.
Signed-off-by: Wei Huang <wei.huang2@amd.com>
Index: xen-4.1.2-testing/xen/arch/x86/cpu/amd.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/amd.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/amd.c
@@ -344,6 +344,49 @@ static void check_syscfg_dram_mod_en(voi
wrmsrl(MSR_K8_SYSCFG, syscfg);
}
+static void __devinit amd_get_topology(struct cpuinfo_x86 *c)
+{
+#ifdef CONFIG_X86_HT
+ int cpu;
+ unsigned bits;
+
+ if (c->x86_max_cores <= 1)
+ return;
+ /*
+ * On a AMD multi core setup the lower bits of the APIC id
+ * distingush the cores.
+ */
+ cpu = smp_processor_id();
+ bits = (cpuid_ecx(0x80000008) >> 12) & 0xf;
+
+ if (bits == 0) {
+ while ((1 << bits) < c->x86_max_cores)
+ bits++;
+ }
+
+ /* Low order bits define the core id */
+ c->cpu_core_id = c->phys_proc_id & ((1<<bits)-1);
+ /* Convert local APIC ID into the socket ID */
+ c->phys_proc_id >>= bits;
+ /* Collect compute unit ID if available */
+ if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
+ u32 eax, ebx, ecx, edx;
+
+ cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
+ c->compute_unit_id = ebx & 0xFF;
+ c->x86_num_siblings = ((ebx >> 8) & 0x3) + 1;
+ }
+
+ if (opt_cpu_info)
+ printk("CPU %d(%d) -> Processor %d, %s %d\n",
+ cpu, c->x86_max_cores, c->phys_proc_id,
+ cpu_has(c, X86_FEATURE_TOPOEXT) ? "Compute Unit" :
+ "Core",
+ cpu_has(c, X86_FEATURE_TOPOEXT) ? c->compute_unit_id :
+ c->cpu_core_id);
+#endif
+}
+
static void __devinit init_amd(struct cpuinfo_x86 *c)
{
u32 l, h;
@@ -566,26 +609,7 @@ static void __devinit init_amd(struct cp
}
}
-#ifdef CONFIG_X86_HT
- /*
- * On a AMD multi core setup the lower bits of the APIC id
- * distingush the cores.
- */
- if (c->x86_max_cores > 1) {
- int cpu = smp_processor_id();
- unsigned bits = (cpuid_ecx(0x80000008) >> 12) & 0xf;
-
- if (bits == 0) {
- while ((1 << bits) < c->x86_max_cores)
- bits++;
- }
- c->cpu_core_id = c->phys_proc_id & ((1<<bits)-1);
- c->phys_proc_id >>= bits;
- if (opt_cpu_info)
- printk("CPU %d(%d) -> Core %d\n",
- cpu, c->x86_max_cores, c->cpu_core_id);
- }
-#endif
+ amd_get_topology(c);
/* Pointless to use MWAIT on Family10 as it does not deep sleep. */
if (c->x86 >= 0x10 && !force_mwait)
Index: xen-4.1.2-testing/xen/arch/x86/cpu/common.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/common.c
@@ -364,6 +364,7 @@ void __cpuinit identify_cpu(struct cpuin
c->x86_clflush_size = 0;
c->phys_proc_id = BAD_APICID;
c->cpu_core_id = BAD_APICID;
+ c->compute_unit_id = BAD_APICID;
memset(&c->x86_capability, 0, sizeof c->x86_capability);
if (!have_cpuid_p()) {
Index: xen-4.1.2-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.1.2-testing/xen/arch/x86/smpboot.c
@@ -240,6 +240,14 @@ static int booting_cpu;
/* CPUs for which sibling maps can be computed. */
static cpumask_t cpu_sibling_setup_map;
+static void link_thread_siblings(int cpu1, int cpu2)
+{
+ cpu_set(cpu1, per_cpu(cpu_sibling_map, cpu2));
+ cpu_set(cpu2, per_cpu(cpu_sibling_map, cpu1));
+ cpu_set(cpu1, per_cpu(cpu_core_map, cpu2));
+ cpu_set(cpu2, per_cpu(cpu_core_map, cpu1));
+}
+
static void set_cpu_sibling_map(int cpu)
{
int i;
@@ -251,13 +259,13 @@ static void set_cpu_sibling_map(int cpu)
{
for_each_cpu_mask ( i, cpu_sibling_setup_map )
{
- if ( (c[cpu].phys_proc_id == c[i].phys_proc_id) &&
- (c[cpu].cpu_core_id == c[i].cpu_core_id) )
- {
- cpu_set(i, per_cpu(cpu_sibling_map, cpu));
- cpu_set(cpu, per_cpu(cpu_sibling_map, i));
- cpu_set(i, per_cpu(cpu_core_map, cpu));
- cpu_set(cpu, per_cpu(cpu_core_map, i));
+ if ( cpu_has(c, X86_FEATURE_TOPOEXT) ) {
+ if ( (c[cpu].phys_proc_id == c[i].phys_proc_id) &&
+ (c[cpu].compute_unit_id == c[i].compute_unit_id) )
+ link_thread_siblings(cpu, i);
+ } else if ( (c[cpu].phys_proc_id == c[i].phys_proc_id) &&
+ (c[cpu].cpu_core_id == c[i].cpu_core_id) ) {
+ link_thread_siblings(cpu, i);
}
}
}
@@ -838,6 +846,7 @@ remove_siblinginfo(int cpu)
cpus_clear(per_cpu(cpu_core_map, cpu));
c[cpu].phys_proc_id = BAD_APICID;
c[cpu].cpu_core_id = BAD_APICID;
+ c[cpu].compute_unit_id = BAD_APICID;
cpu_clear(cpu, cpu_sibling_setup_map);
}
Index: xen-4.1.2-testing/xen/include/asm-x86/processor.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/processor.h
+++ xen-4.1.2-testing/xen/include/asm-x86/processor.h
@@ -175,9 +175,10 @@ struct cpuinfo_x86 {
__u32 x86_max_cores; /* cpuid returned max cores value */
__u32 booted_cores; /* number of cores as seen by OS */
__u32 x86_num_siblings; /* cpuid logical cpus per chip value */
+ __u32 apicid;
int phys_proc_id; /* package ID of each logical CPU */
int cpu_core_id; /* core ID of each logical CPU*/
- __u32 apicid;
+ int compute_unit_id; /* AMD compute unit ID of each logical CPU */
unsigned short x86_clflush_size;
} __cacheline_aligned;

View File

@ -11,10 +11,10 @@ Taken from gnu-efi-3.0k (slightly edited).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/include/asm-x86/efibind.h Index: xen-4.1.3-testing/xen/include/asm-x86/efibind.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/asm-x86/efibind.h +++ xen-4.1.3-testing/xen/include/asm-x86/efibind.h
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
+#include <xen/types.h> +#include <xen/types.h>
+#if defined(__i386__) +#if defined(__i386__)
@ -22,10 +22,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/efibind.h
+#elif defined(__x86_64__) +#elif defined(__x86_64__)
+# include <asm/x86_64/efibind.h> +# include <asm/x86_64/efibind.h>
+#endif +#endif
Index: xen-4.1.2-testing/xen/include/asm-x86/x86_64/efibind.h Index: xen-4.1.3-testing/xen/include/asm-x86/x86_64/efibind.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/asm-x86/x86_64/efibind.h +++ xen-4.1.3-testing/xen/include/asm-x86/x86_64/efibind.h
@@ -0,0 +1,276 @@ @@ -0,0 +1,276 @@
+/*++ +/*++
+ +
@ -303,10 +303,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/x86_64/efibind.h
+#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP +#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
+#endif +#endif
+ +
Index: xen-4.1.2-testing/xen/include/efi/efiapi.h Index: xen-4.1.3-testing/xen/include/efi/efiapi.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/efiapi.h +++ xen-4.1.3-testing/xen/include/efi/efiapi.h
@@ -0,0 +1,718 @@ @@ -0,0 +1,718 @@
+#ifndef _EFI_API_H +#ifndef _EFI_API_H
+#define _EFI_API_H +#define _EFI_API_H
@ -1026,10 +1026,10 @@ Index: xen-4.1.2-testing/xen/include/efi/efiapi.h
+ +
+#endif +#endif
+ +
Index: xen-4.1.2-testing/xen/include/efi/eficon.h Index: xen-4.1.3-testing/xen/include/efi/eficon.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/eficon.h +++ xen-4.1.3-testing/xen/include/efi/eficon.h
@@ -0,0 +1,302 @@ @@ -0,0 +1,302 @@
+#ifndef _EFI_CON_H +#ifndef _EFI_CON_H
+#define _EFI_CON_H +#define _EFI_CON_H
@ -1333,10 +1333,10 @@ Index: xen-4.1.2-testing/xen/include/efi/eficon.h
+ +
+#endif +#endif
+ +
Index: xen-4.1.2-testing/xen/include/efi/efidef.h Index: xen-4.1.3-testing/xen/include/efi/efidef.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/efidef.h +++ xen-4.1.3-testing/xen/include/efi/efidef.h
@@ -0,0 +1,196 @@ @@ -0,0 +1,196 @@
+#ifndef _EFI_DEF_H +#ifndef _EFI_DEF_H
+#define _EFI_DEF_H +#define _EFI_DEF_H
@ -1534,10 +1534,10 @@ Index: xen-4.1.2-testing/xen/include/efi/efidef.h
+ ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) ) + ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
+ +
+#endif +#endif
Index: xen-4.1.2-testing/xen/include/efi/efidevp.h Index: xen-4.1.3-testing/xen/include/efi/efidevp.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/efidevp.h +++ xen-4.1.3-testing/xen/include/efi/efidevp.h
@@ -0,0 +1,402 @@ @@ -0,0 +1,402 @@
+#ifndef _DEVPATH_H +#ifndef _DEVPATH_H
+#define _DEVPATH_H +#define _DEVPATH_H
@ -1941,10 +1941,10 @@ Index: xen-4.1.2-testing/xen/include/efi/efidevp.h
+ +
+ +
+#endif +#endif
Index: xen-4.1.2-testing/xen/include/efi/efierr.h Index: xen-4.1.3-testing/xen/include/efi/efierr.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/efierr.h +++ xen-4.1.3-testing/xen/include/efi/efierr.h
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
+#ifndef _EFI_ERR_H +#ifndef _EFI_ERR_H
+#define _EFI_ERR_H +#define _EFI_ERR_H
@ -2006,10 +2006,10 @@ Index: xen-4.1.2-testing/xen/include/efi/efierr.h
+ +
+#endif +#endif
+ +
Index: xen-4.1.2-testing/xen/include/efi/efiprot.h Index: xen-4.1.3-testing/xen/include/efi/efiprot.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/efi/efiprot.h +++ xen-4.1.3-testing/xen/include/efi/efiprot.h
@@ -0,0 +1,728 @@ @@ -0,0 +1,728 @@
+#ifndef _EFI_PROT_H +#ifndef _EFI_PROT_H
+#define _EFI_PROT_H +#define _EFI_PROT_H

View File

@ -59,10 +59,10 @@ corrupt other data.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/Makefile Index: xen-4.1.3-testing/xen/Makefile
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/Makefile --- xen-4.1.3-testing.orig/xen/Makefile
+++ xen-4.1.2-testing/xen/Makefile +++ xen-4.1.3-testing/xen/Makefile
@@ -12,6 +12,8 @@ export XEN_DOMAIN ?= $(shell ([ -x /bin/ @@ -12,6 +12,8 @@ export XEN_DOMAIN ?= $(shell ([ -x /bin/
export BASEDIR := $(CURDIR) export BASEDIR := $(CURDIR)
export XEN_ROOT := $(BASEDIR)/.. export XEN_ROOT := $(BASEDIR)/..
@ -91,10 +91,10 @@ Index: xen-4.1.2-testing/xen/Makefile
.PHONY: _debug .PHONY: _debug
_debug: _debug:
Index: xen-4.1.2-testing/xen/arch/x86/Makefile Index: xen-4.1.3-testing/xen/arch/x86/Makefile
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/Makefile --- xen-4.1.3-testing.orig/xen/arch/x86/Makefile
+++ xen-4.1.2-testing/xen/arch/x86/Makefile +++ xen-4.1.3-testing/xen/arch/x86/Makefile
@@ -61,14 +61,21 @@ obj-$(crash_debug) += gdbstub.o @@ -61,14 +61,21 @@ obj-$(crash_debug) += gdbstub.o
x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
@ -182,10 +182,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/Makefile
rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
+ rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc + rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.o efi/mkreloc
rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin
Index: xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S Index: xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/trampoline.S --- xen-4.1.3-testing.orig/xen/arch/x86/boot/trampoline.S
+++ xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S +++ xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S
@@ -38,6 +38,7 @@ trampoline_gdt: @@ -38,6 +38,7 @@ trampoline_gdt:
.long 0x0000ffff | ((BOOT_TRAMPOLINE & 0x00ffff) << 16) .long 0x0000ffff | ((BOOT_TRAMPOLINE & 0x00ffff) << 16)
.long 0x00009200 | ((BOOT_TRAMPOLINE & 0xff0000) >> 16) .long 0x00009200 | ((BOOT_TRAMPOLINE & 0xff0000) >> 16)
@ -194,10 +194,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S
cpuid_ext_features: cpuid_ext_features:
.long 0 .long 0
Index: xen-4.1.2-testing/xen/arch/x86/boot/x86_64.S Index: xen-4.1.3-testing/xen/arch/x86/boot/x86_64.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/x86_64.S --- xen-4.1.3-testing.orig/xen/arch/x86/boot/x86_64.S
+++ xen-4.1.2-testing/xen/arch/x86/boot/x86_64.S +++ xen-4.1.3-testing/xen/arch/x86/boot/x86_64.S
@@ -84,11 +84,13 @@ multiboot_ptr: @@ -84,11 +84,13 @@ multiboot_ptr:
.long 0 .long 0
@ -212,19 +212,19 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/x86_64.S
idt_descr: idt_descr:
.word 256*16-1 .word 256*16-1
.quad idt_table .quad idt_table
Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c Index: xen-4.1.3-testing/xen/arch/x86/dmi_scan.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/dmi_scan.c --- xen-4.1.3-testing.orig/xen/arch/x86/dmi_scan.c
+++ xen-4.1.2-testing/xen/arch/x86/dmi_scan.c +++ xen-4.1.3-testing/xen/arch/x86/dmi_scan.c
@@ -9,6 +9,7 @@ @@ -11,6 +11,7 @@
#include <asm/io.h>
#include <asm/system.h>
#include <xen/dmi.h> #include <xen/dmi.h>
#include <xen/pci.h>
#include <xen/pci_regs.h>
+#include <xen/efi.h> +#include <xen/efi.h>
#define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l)) #define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l))
#define bt_iounmap(b,l) ((void)0) #define bt_iounmap(b,l) ((void)0)
@@ -122,11 +123,39 @@ static inline bool_t __init dmi_checksum @@ -124,11 +125,39 @@ static inline bool_t __init dmi_checksum
return sum == 0; return sum == 0;
} }
@ -264,7 +264,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
p = maddr_to_virt(0xF0000); p = maddr_to_virt(0xF0000);
for (q = p; q < p + 0x10000; q += 16) { for (q = p; q < p + 0x10000; q += 16) {
memcpy_fromio(&eps, q, 15); memcpy_fromio(&eps, q, 15);
@@ -178,6 +207,39 @@ static int __init dmi_iterate(void (*dec @@ -180,6 +209,39 @@ static int __init dmi_iterate(void (*dec
return -1; return -1;
} }
@ -304,7 +304,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
static char *dmi_ident[DMI_STRING_MAX]; static char *dmi_ident[DMI_STRING_MAX];
/* /*
@@ -468,8 +530,8 @@ static void __init dmi_decode(struct dmi @@ -504,8 +566,8 @@ static void __init dmi_decode(struct dmi
void __init dmi_scan_machine(void) void __init dmi_scan_machine(void)
{ {
@ -315,10 +315,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
dmi_check_system(dmi_blacklist); dmi_check_system(dmi_blacklist);
else else
printk(KERN_INFO "DMI not present.\n"); printk(KERN_INFO "DMI not present.\n");
Index: xen-4.1.2-testing/xen/arch/x86/efi/Makefile Index: xen-4.1.3-testing/xen/arch/x86/efi/Makefile
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/Makefile +++ xen-4.1.3-testing/xen/arch/x86/efi/Makefile
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
+CFLAGS += -fshort-wchar -mno-sse +CFLAGS += -fshort-wchar -mno-sse
+ +
@ -337,10 +337,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/Makefile
+ +
+clean:: +clean::
+ rm -f disabled *.efi + rm -f disabled *.efi
Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c Index: xen-4.1.3-testing/xen/arch/x86/efi/boot.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/boot.c +++ xen-4.1.3-testing/xen/arch/x86/efi/boot.c
@@ -0,0 +1,1221 @@ @@ -0,0 +1,1221 @@
+#include "efi.h" +#include "efi.h"
+#include <efi/efiprot.h> +#include <efi/efiprot.h>
@ -1563,19 +1563,19 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c
+ mdesc_ver, efi_memmap); + mdesc_ver, efi_memmap);
+#endif +#endif
+} +}
Index: xen-4.1.2-testing/xen/arch/x86/efi/check.c Index: xen-4.1.3-testing/xen/arch/x86/efi/check.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/check.c +++ xen-4.1.3-testing/xen/arch/x86/efi/check.c
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+int __attribute__((__ms_abi__)) test(int i) +int __attribute__((__ms_abi__)) test(int i)
+{ +{
+ return i; + return i;
+} +}
Index: xen-4.1.2-testing/xen/arch/x86/efi/compat.c Index: xen-4.1.3-testing/xen/arch/x86/efi/compat.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/compat.c +++ xen-4.1.3-testing/xen/arch/x86/efi/compat.c
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
+#include <xen/guest_access.h> +#include <xen/guest_access.h>
+#include <compat/platform.h> +#include <compat/platform.h>
@ -1593,10 +1593,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/compat.c
+#undef __copy_to_guest_offset +#undef __copy_to_guest_offset
+#define __copy_to_guest_offset __copy_to_compat_offset +#define __copy_to_guest_offset __copy_to_compat_offset
+#include "runtime.c" +#include "runtime.c"
Index: xen-4.1.2-testing/xen/arch/x86/efi/efi.h Index: xen-4.1.3-testing/xen/arch/x86/efi/efi.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/efi.h +++ xen-4.1.3-testing/xen/arch/x86/efi/efi.h
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
+#include <asm/efibind.h> +#include <asm/efibind.h>
+#include <efi/efidef.h> +#include <efi/efidef.h>
@ -1616,10 +1616,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/efi.h
+ +
+extern UINTN efi_memmap_size, efi_mdesc_size; +extern UINTN efi_memmap_size, efi_mdesc_size;
+extern void *efi_memmap; +extern void *efi_memmap;
Index: xen-4.1.2-testing/xen/arch/x86/efi/mkreloc.c Index: xen-4.1.3-testing/xen/arch/x86/efi/mkreloc.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/mkreloc.c +++ xen-4.1.3-testing/xen/arch/x86/efi/mkreloc.c
@@ -0,0 +1,377 @@ @@ -0,0 +1,377 @@
+#include <fcntl.h> +#include <fcntl.h>
+#include <inttypes.h> +#include <inttypes.h>
@ -1998,10 +1998,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/mkreloc.c
+ +
+ return 0; + return 0;
+} +}
Index: xen-4.1.2-testing/xen/arch/x86/efi/relocs-dummy.S Index: xen-4.1.3-testing/xen/arch/x86/efi/relocs-dummy.S
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/relocs-dummy.S +++ xen-4.1.3-testing/xen/arch/x86/efi/relocs-dummy.S
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
+#include <xen/config.h> +#include <xen/config.h>
+ +
@ -2016,10 +2016,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/relocs-dummy.S
+ .globl VIRT_START, ALT_START + .globl VIRT_START, ALT_START
+ .equ VIRT_START, XEN_VIRT_START + .equ VIRT_START, XEN_VIRT_START
+ .equ ALT_START, XEN_VIRT_END + .equ ALT_START, XEN_VIRT_END
Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c Index: xen-4.1.3-testing/xen/arch/x86/efi/runtime.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/runtime.c +++ xen-4.1.3-testing/xen/arch/x86/efi/runtime.c
@@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
+#include "efi.h" +#include "efi.h"
+#include <xen/cache.h> +#include <xen/cache.h>
@ -2109,10 +2109,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c
+ +
+ return 0; + return 0;
+} +}
Index: xen-4.1.2-testing/xen/arch/x86/efi/stub.c Index: xen-4.1.3-testing/xen/arch/x86/efi/stub.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/arch/x86/efi/stub.c +++ xen-4.1.3-testing/xen/arch/x86/efi/stub.c
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
+#include <xen/efi.h> +#include <xen/efi.h>
+#include <xen/errno.h> +#include <xen/errno.h>
@ -2131,19 +2131,19 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/stub.c
+ +
+int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) +int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *)
+ __attribute__((__alias__("efi_get_info"))); + __attribute__((__alias__("efi_get_info")));
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -100,6 +100,7 @@ @@ -101,6 +101,7 @@
#include <xen/iocap.h>
#include <xen/guest_access.h> #include <xen/guest_access.h>
#include <xen/xmalloc.h>
#include <xen/pfn.h> #include <xen/pfn.h>
+#include <xen/efi.h> +#include <xen/efi.h>
#include <asm/paging.h> #include <asm/paging.h>
#include <asm/shadow.h> #include <asm/shadow.h>
#include <asm/page.h> #include <asm/page.h>
@@ -355,6 +356,8 @@ void __init arch_init_memory(void) @@ -356,6 +357,8 @@ void __init arch_init_memory(void)
subarch_init_memory(); subarch_init_memory();
@ -2152,10 +2152,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
mem_sharing_init(); mem_sharing_init();
} }
Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c Index: xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/platform_hypercall.c --- xen-4.1.3-testing.orig/xen/arch/x86/platform_hypercall.c
+++ xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c +++ xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
#include <xen/iocap.h> #include <xen/iocap.h>
#include <xen/guest_access.h> #include <xen/guest_access.h>
@ -2179,10 +2179,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
Index: xen-4.1.2-testing/xen/arch/x86/setup.c Index: xen-4.1.3-testing/xen/arch/x86/setup.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/setup.c --- xen-4.1.3-testing.orig/xen/arch/x86/setup.c
+++ xen-4.1.2-testing/xen/arch/x86/setup.c +++ xen-4.1.3-testing/xen/arch/x86/setup.c
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
#include <xen/serial.h> #include <xen/serial.h>
#include <xen/softirq.h> #include <xen/softirq.h>
@ -2191,7 +2191,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
#include <xen/console.h> #include <xen/console.h>
#include <xen/serial.h> #include <xen/serial.h>
#include <xen/trace.h> #include <xen/trace.h>
@@ -448,6 +449,10 @@ static void __init parse_video_info(void @@ -446,6 +447,10 @@ static void __init parse_video_info(void
{ {
struct boot_video_info *bvi = &bootsym(boot_vid_info); struct boot_video_info *bvi = &bootsym(boot_vid_info);
@ -2202,7 +2202,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
if ( (bvi->orig_video_isVGA == 1) && (bvi->orig_video_mode == 3) ) if ( (bvi->orig_video_isVGA == 1) && (bvi->orig_video_mode == 3) )
{ {
vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3; vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;
@@ -619,6 +624,7 @@ void __init __start_xen(unsigned long mb @@ -617,6 +622,7 @@ void __init __start_xen(unsigned long mb
vga_console_info.u.text_mode_3.font_height); vga_console_info.u.text_mode_3.font_height);
break; break;
case XEN_VGATYPE_VESA_LFB: case XEN_VGATYPE_VESA_LFB:
@ -2210,7 +2210,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
printk(" VGA is graphics mode %dx%d, %d bpp\n", printk(" VGA is graphics mode %dx%d, %d bpp\n",
vga_console_info.u.vesa_lfb.width, vga_console_info.u.vesa_lfb.width,
vga_console_info.u.vesa_lfb.height, vga_console_info.u.vesa_lfb.height,
@@ -664,7 +670,24 @@ void __init __start_xen(unsigned long mb @@ -662,7 +668,24 @@ void __init __start_xen(unsigned long mb
if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 ) if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 )
EARLY_FAIL("Misaligned CPU0 stack.\n"); EARLY_FAIL("Misaligned CPU0 stack.\n");
@ -2236,7 +2236,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
{ {
memmap_type = "Xen-e820"; memmap_type = "Xen-e820";
} }
@@ -762,7 +785,7 @@ void __init __start_xen(unsigned long mb @@ -760,7 +783,7 @@ void __init __start_xen(unsigned long mb
* we can relocate the dom0 kernel and other multiboot modules. Also, on * we can relocate the dom0 kernel and other multiboot modules. Also, on
* x86/64, we relocate Xen to higher memory. * x86/64, we relocate Xen to higher memory.
*/ */
@ -2245,7 +2245,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
{ {
if ( mod[i].mod_start & (PAGE_SIZE - 1) ) if ( mod[i].mod_start & (PAGE_SIZE - 1) )
EARLY_FAIL("Bootloader didn't honor module alignment request.\n"); EARLY_FAIL("Bootloader didn't honor module alignment request.\n");
@@ -811,7 +834,6 @@ void __init __start_xen(unsigned long mb @@ -809,7 +832,6 @@ void __init __start_xen(unsigned long mb
end = 0; end = 0;
if ( end > s ) if ( end > s )
{ {
@ -2253,7 +2253,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
l4_pgentry_t *pl4e; l4_pgentry_t *pl4e;
l3_pgentry_t *pl3e; l3_pgentry_t *pl3e;
l2_pgentry_t *pl2e; l2_pgentry_t *pl2e;
@@ -951,7 +973,8 @@ void __init __start_xen(unsigned long mb @@ -949,7 +971,8 @@ void __init __start_xen(unsigned long mb
#else #else
if ( !xen_phys_start ) if ( !xen_phys_start )
EARLY_FAIL("Not enough memory to relocate Xen.\n"); EARLY_FAIL("Not enough memory to relocate Xen.\n");
@ -2263,10 +2263,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
#endif #endif
/* Late kexec reservation (dynamic start address). */ /* Late kexec reservation (dynamic start address). */
Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_32/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
@@ -34,8 +34,6 @@ @@ -34,8 +34,6 @@
l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned")))
idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES]; idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES];
@ -2276,10 +2276,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c
unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR; unsigned int __read_mostly PAGE_HYPERVISOR = __PAGE_HYPERVISOR;
unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE;
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#include <xen/lib.h> #include <xen/lib.h>
#include <xen/init.h> #include <xen/init.h>
@ -2298,10 +2298,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c
} }
void *compat_arg_xlat_virt_base(void) void *compat_arg_xlat_virt_base(void)
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/platform_hypercall.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/platform_hypercall.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/platform_hypercall.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/platform_hypercall.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/platform_hypercall.c +++ xen-4.1.3-testing/xen/arch/x86/x86_64/platform_hypercall.c
@@ -11,6 +11,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ @@ -11,6 +11,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
#define xen_platform_op_t compat_platform_op_t #define xen_platform_op_t compat_platform_op_t
#define do_platform_op(x) compat_platform_op(_##x) #define do_platform_op(x) compat_platform_op(_##x)
@ -2311,10 +2311,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/platform_hypercall.c
#define xen_processor_px compat_processor_px #define xen_processor_px compat_processor_px
#define xen_processor_px_t compat_processor_px_t #define xen_processor_px_t compat_processor_px_t
#define xen_processor_performance compat_processor_performance #define xen_processor_performance compat_processor_performance
Index: xen-4.1.2-testing/xen/arch/x86/xen.lds.S Index: xen-4.1.3-testing/xen/arch/x86/xen.lds.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/xen.lds.S --- xen-4.1.3-testing.orig/xen/arch/x86/xen.lds.S
+++ xen-4.1.2-testing/xen/arch/x86/xen.lds.S +++ xen-4.1.3-testing/xen/arch/x86/xen.lds.S
@@ -8,15 +8,34 @@ @@ -8,15 +8,34 @@
#undef ENTRY #undef ENTRY
#undef ALIGN #undef ALIGN
@ -2384,10 +2384,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/xen.lds.S
} }
/* Stabs debugging sections. */ /* Stabs debugging sections. */
Index: xen-4.1.2-testing/xen/drivers/acpi/osl.c Index: xen-4.1.3-testing/xen/drivers/acpi/osl.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/acpi/osl.c --- xen-4.1.3-testing.orig/xen/drivers/acpi/osl.c
+++ xen-4.1.2-testing/xen/drivers/acpi/osl.c +++ xen-4.1.3-testing/xen/drivers/acpi/osl.c
@@ -37,9 +37,7 @@ @@ -37,9 +37,7 @@
#include <acpi/platform/aclinux.h> #include <acpi/platform/aclinux.h>
#include <xen/spinlock.h> #include <xen/spinlock.h>
@ -2418,10 +2418,10 @@ Index: xen-4.1.2-testing/xen/drivers/acpi/osl.c
acpi_physical_address pa = 0; acpi_physical_address pa = 0;
acpi_find_root_pointer(&pa); acpi_find_root_pointer(&pa);
Index: xen-4.1.2-testing/xen/drivers/video/vga.c Index: xen-4.1.3-testing/xen/drivers/video/vga.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/video/vga.c --- xen-4.1.3-testing.orig/xen/drivers/video/vga.c
+++ xen-4.1.2-testing/xen/drivers/video/vga.c +++ xen-4.1.3-testing/xen/drivers/video/vga.c
@@ -89,6 +89,7 @@ void __init vga_init(void) @@ -89,6 +89,7 @@ void __init vga_init(void)
vga_puts = vga_text_puts; vga_puts = vga_text_puts;
break; break;
@ -2438,10 +2438,10 @@ Index: xen-4.1.2-testing/xen/drivers/video/vga.c
vesa_endboot(vgacon_keep); vesa_endboot(vgacon_keep);
break; break;
default: default:
Index: xen-4.1.2-testing/xen/include/asm-x86/page.h Index: xen-4.1.3-testing/xen/include/asm-x86/page.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/page.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/page.h
+++ xen-4.1.2-testing/xen/include/asm-x86/page.h +++ xen-4.1.3-testing/xen/include/asm-x86/page.h
@@ -301,8 +301,14 @@ extern l2_pgentry_t idle_pg_table_l2[ @@ -301,8 +301,14 @@ extern l2_pgentry_t idle_pg_table_l2[
#elif CONFIG_PAGING_LEVELS == 4 #elif CONFIG_PAGING_LEVELS == 4
extern l2_pgentry_t *compat_idle_pg_table_l2; extern l2_pgentry_t *compat_idle_pg_table_l2;
@ -2457,10 +2457,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/page.h
void paging_init(void); void paging_init(void);
void setup_idle_pagetable(void); void setup_idle_pagetable(void);
#endif /* !defined(__ASSEMBLY__) */ #endif /* !defined(__ASSEMBLY__) */
Index: xen-4.1.2-testing/xen/include/public/platform.h Index: xen-4.1.3-testing/xen/include/public/platform.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/platform.h --- xen-4.1.3-testing.orig/xen/include/public/platform.h
+++ xen-4.1.2-testing/xen/include/public/platform.h +++ xen-4.1.3-testing/xen/include/public/platform.h
@@ -118,6 +118,11 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q @@ -118,6 +118,11 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q
#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ #define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ #define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
@ -2498,10 +2498,10 @@ Index: xen-4.1.2-testing/xen/include/public/platform.h
} u; } u;
}; };
typedef struct xenpf_firmware_info xenpf_firmware_info_t; typedef struct xenpf_firmware_info xenpf_firmware_info_t;
Index: xen-4.1.2-testing/xen/include/public/xen.h Index: xen-4.1.3-testing/xen/include/public/xen.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/xen.h --- xen-4.1.3-testing.orig/xen/include/public/xen.h
+++ xen-4.1.2-testing/xen/include/public/xen.h +++ xen-4.1.3-testing/xen/include/public/xen.h
@@ -638,6 +638,7 @@ typedef struct dom0_vga_console_info { @@ -638,6 +638,7 @@ typedef struct dom0_vga_console_info {
uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */ uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
#define XEN_VGATYPE_TEXT_MODE_3 0x03 #define XEN_VGATYPE_TEXT_MODE_3 0x03
@ -2510,10 +2510,10 @@ Index: xen-4.1.2-testing/xen/include/public/xen.h
union { union {
struct { struct {
Index: xen-4.1.2-testing/xen/include/xen/compat.h Index: xen-4.1.3-testing/xen/include/xen/compat.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/compat.h --- xen-4.1.3-testing.orig/xen/include/xen/compat.h
+++ xen-4.1.2-testing/xen/include/xen/compat.h +++ xen-4.1.3-testing/xen/include/xen/compat.h
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
/* Cast a compat handle to the specified type of handle. */ /* Cast a compat handle to the specified type of handle. */
#define compat_handle_cast(chnd, type) ({ \ #define compat_handle_cast(chnd, type) ({ \
@ -2523,10 +2523,10 @@ Index: xen-4.1.2-testing/xen/include/xen/compat.h
}) })
#define guest_from_compat_handle(ghnd, chnd) \ #define guest_from_compat_handle(ghnd, chnd) \
Index: xen-4.1.2-testing/xen/include/xen/dmi.h Index: xen-4.1.3-testing/xen/include/xen/dmi.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/dmi.h --- xen-4.1.3-testing.orig/xen/include/xen/dmi.h
+++ xen-4.1.2-testing/xen/include/xen/dmi.h +++ xen-4.1.3-testing/xen/include/xen/dmi.h
@@ -36,5 +36,6 @@ extern int dmi_check_system(struct dmi_s @@ -36,5 +36,6 @@ extern int dmi_check_system(struct dmi_s
extern char * dmi_get_system_info(int field); extern char * dmi_get_system_info(int field);
extern void dmi_scan_machine(void); extern void dmi_scan_machine(void);
@ -2534,10 +2534,10 @@ Index: xen-4.1.2-testing/xen/include/xen/dmi.h
+extern void dmi_efi_get_table(void *); +extern void dmi_efi_get_table(void *);
#endif /* __DMI_H__ */ #endif /* __DMI_H__ */
Index: xen-4.1.2-testing/xen/include/xen/efi.h Index: xen-4.1.3-testing/xen/include/xen/efi.h
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ xen-4.1.2-testing/xen/include/xen/efi.h +++ xen-4.1.3-testing/xen/include/xen/efi.h
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
+#ifndef __XEN_EFI_H__ +#ifndef __XEN_EFI_H__
+#define __XEN_EFI_H__ +#define __XEN_EFI_H__

View File

@ -14,11 +14,11 @@ other pages beyond _end when checking for aliases.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -778,7 +778,7 @@ static int update_xen_mappings(unsigned @@ -779,7 +779,7 @@ static int update_xen_mappings(unsigned
int err = 0; int err = 0;
#ifdef __x86_64__ #ifdef __x86_64__
bool_t alias = mfn >= PFN_DOWN(xen_phys_start) && bool_t alias = mfn >= PFN_DOWN(xen_phys_start) &&
@ -27,11 +27,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
unsigned long xen_va = unsigned long xen_va =
XEN_VIRT_START + ((mfn - PFN_DOWN(xen_phys_start)) << PAGE_SHIFT); XEN_VIRT_START + ((mfn - PFN_DOWN(xen_phys_start)) << PAGE_SHIFT);
Index: xen-4.1.2-testing/xen/arch/x86/setup.c Index: xen-4.1.3-testing/xen/arch/x86/setup.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/setup.c --- xen-4.1.3-testing.orig/xen/arch/x86/setup.c
+++ xen-4.1.2-testing/xen/arch/x86/setup.c +++ xen-4.1.3-testing/xen/arch/x86/setup.c
@@ -99,6 +99,8 @@ unsigned long __read_mostly xen_phys_sta @@ -97,6 +97,8 @@ unsigned long __read_mostly xen_phys_sta
/* Limits of Xen heap, used to initialise the allocator. */ /* Limits of Xen heap, used to initialise the allocator. */
unsigned long __initdata xenheap_initial_phys_start; unsigned long __initdata xenheap_initial_phys_start;
unsigned long __read_mostly xenheap_phys_end; unsigned long __read_mostly xenheap_phys_end;
@ -40,7 +40,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
#endif #endif
DEFINE_PER_CPU(struct tss_struct, init_tss); DEFINE_PER_CPU(struct tss_struct, init_tss);
@@ -1098,6 +1100,9 @@ void __init __start_xen(unsigned long mb @@ -1096,6 +1098,9 @@ void __init __start_xen(unsigned long mb
map_pages_to_xen((unsigned long)__va(kexec_crash_area.start), map_pages_to_xen((unsigned long)__va(kexec_crash_area.start),
kexec_crash_area.start >> PAGE_SHIFT, kexec_crash_area.start >> PAGE_SHIFT,
PFN_UP(kexec_crash_area.size), PAGE_HYPERVISOR); PFN_UP(kexec_crash_area.size), PAGE_HYPERVISOR);
@ -50,10 +50,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/setup.c
#endif #endif
memguard_init(); memguard_init();
Index: xen-4.1.2-testing/xen/include/asm-x86/x86_64/page.h Index: xen-4.1.3-testing/xen/include/asm-x86/x86_64/page.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/x86_64/page.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/x86_64/page.h
+++ xen-4.1.2-testing/xen/include/asm-x86/x86_64/page.h +++ xen-4.1.3-testing/xen/include/asm-x86/x86_64/page.h
@@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
#include <xen/config.h> #include <xen/config.h>
#include <asm/types.h> #include <asm/types.h>

View File

@ -1,43 +0,0 @@
# HG changeset patch
# User tools/pygrub: fix solaris kernel sniff
# Date 1310663398 -3600
# Node ID 7c39a2c0d870f9a374f181b581bcf82a2a7ff364
# Parent 5239811f92e1ffb185a50172fdcf47372e71ba7e
tools/pygrub: fix solaris kernel sniff
Solaris 11 build 163+ removes '/platform/i86xpv/kernel/unix' and only the
64-bit PV kernel file '/platform/i86xpv/kernel/amd64/unix' exists.
This patch fixes the detection.
Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: Frank Che <frank.che@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r 5239811f92e1 -r 7c39a2c0d870 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Thu Jul 14 15:49:49 2011 +0100
+++ b/tools/pygrub/src/pygrub Thu Jul 14 18:09:58 2011 +0100
@@ -594,7 +594,8 @@
# If nothing has been specified, look for a Solaris domU. If found, perform the
# necessary tweaks.
def sniff_solaris(fs, cfg):
- if not fs.file_exists("/platform/i86xpv/kernel/unix"):
+ if not fs.file_exists("/platform/i86xpv/kernel/unix") and \
+ not fs.file_exists("/platform/i86xpv/kernel/amd64/unix"):
return cfg
if not cfg["kernel"]:
@@ -602,9 +603,11 @@
fs.file_exists("/platform/i86xpv/kernel/amd64/unix"):
cfg["kernel"] = "/platform/i86xpv/kernel/amd64/unix"
cfg["ramdisk"] = "/platform/i86pc/amd64/boot_archive"
- else:
+ elif fs.file_exists("/platform/i86xpv/kernel/unix"):
cfg["kernel"] = "/platform/i86xpv/kernel/unix"
cfg["ramdisk"] = "/platform/i86pc/boot_archive"
+ else:
+ return cfg
# Unpleasant. Typically we'll have 'root=foo -k' or 'root=foo /kernel -k',
# and we need to maintain Xen properties (root= and ip=) and the kernel

View File

@ -11,10 +11,11 @@ Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r c1d7fa123dae -r 5e1032229546 tools/pygrub/src/pygrub Index: xen-4.1.3-testing/tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Fri Jul 15 18:09:49 2011 +0100 ===================================================================
+++ b/tools/pygrub/src/pygrub Fri Jul 15 18:12:55 2011 +0100 --- xen-4.1.3-testing.orig/tools/pygrub/src/pygrub
@@ -385,14 +385,14 @@ +++ xen-4.1.3-testing/tools/pygrub/src/pygrub
@@ -394,15 +394,14 @@ class Grub:
# fallbacks # fallbacks
["/efi/boot/elilo.conf", "/elilo.conf",]) ["/efi/boot/elilo.conf", "/elilo.conf",])
else: else:
@ -22,8 +23,10 @@ diff -r c1d7fa123dae -r 5e1032229546 tools/pygrub/src/pygrub
- ["/boot/grub/menu.lst", "/boot/grub/grub.conf", - ["/boot/grub/menu.lst", "/boot/grub/grub.conf",
- "/grub/menu.lst", "/grub/grub.conf"]) + \ - "/grub/menu.lst", "/grub/grub.conf"]) + \
- map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), - map(lambda x: (x,grub.GrubConf.Grub2ConfigFile),
- ["/boot/grub/grub.cfg", "/grub/grub.cfg",
- "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \
+ cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile), + cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile),
["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \ + ["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \
map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile), map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile),
["/boot/isolinux/isolinux.cfg", ["/boot/isolinux/isolinux.cfg",
- "/boot/extlinux.conf"]) - "/boot/extlinux.conf"])

View File

@ -18,10 +18,10 @@ for PCI config space method 1 accesses.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c Index: xen-4.1.3-testing/xen/arch/x86/efi/runtime.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/efi/runtime.c --- xen-4.1.3-testing.orig/xen/arch/x86/efi/runtime.c
+++ xen-4.1.2-testing/xen/arch/x86/efi/runtime.c +++ xen-4.1.3-testing/xen/arch/x86/efi/runtime.c
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
#include <xen/errno.h> #include <xen/errno.h>
#include <xen/guest_access.h> #include <xen/guest_access.h>
@ -98,10 +98,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/runtime.c
efi_rs_leave(cr3); efi_rs_leave(cr3);
op->misc = 0; op->misc = 0;
Index: xen-4.1.2-testing/xen/arch/x86/hpet.c Index: xen-4.1.3-testing/xen/arch/x86/hpet.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hpet.c --- xen-4.1.3-testing.orig/xen/arch/x86/hpet.c
+++ xen-4.1.2-testing/xen/arch/x86/hpet.c +++ xen-4.1.3-testing/xen/arch/x86/hpet.c
@@ -525,18 +525,10 @@ static void hpet_detach_channel(int cpu, @@ -525,18 +525,10 @@ static void hpet_detach_channel(int cpu,
#include <asm/mc146818rtc.h> #include <asm/mc146818rtc.h>
@ -123,10 +123,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/hpet.c
if ( index != RTC_REG_B ) if ( index != RTC_REG_B )
return; return;
Index: xen-4.1.2-testing/xen/arch/x86/traps.c Index: xen-4.1.3-testing/xen/arch/x86/traps.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c --- xen-4.1.3-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c +++ xen-4.1.3-testing/xen/arch/x86/traps.c
@@ -67,6 +67,8 @@ @@ -67,6 +67,8 @@
#include <asm/hypercall.h> #include <asm/hypercall.h>
#include <asm/mce.h> #include <asm/mce.h>
@ -136,7 +136,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
#include <public/arch-x86/cpuid.h> #include <public/arch-x86/cpuid.h>
/* /*
@@ -1630,6 +1632,10 @@ static int admin_io_okay( @@ -1656,6 +1658,10 @@ static int admin_io_okay(
if ( (port == 0xcf8) && (bytes == 4) ) if ( (port == 0xcf8) && (bytes == 4) )
return 0; return 0;
@ -147,7 +147,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
return ioports_access_permitted(v->domain, port, port + bytes - 1); return ioports_access_permitted(v->domain, port, port + bytes - 1);
} }
@@ -1659,6 +1665,21 @@ static uint32_t guest_io_read( @@ -1685,6 +1691,21 @@ static uint32_t guest_io_read(
{ {
sub_data = pv_pit_handler(port, 0, 0); sub_data = pv_pit_handler(port, 0, 0);
} }
@ -169,7 +169,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
else if ( (port == 0xcf8) && (bytes == 4) ) else if ( (port == 0xcf8) && (bytes == 4) )
{ {
size = 4; size = 4;
@@ -1684,8 +1705,6 @@ static uint32_t guest_io_read( @@ -1710,8 +1731,6 @@ static uint32_t guest_io_read(
return data; return data;
} }
@ -178,7 +178,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
static void guest_io_write( static void guest_io_write(
unsigned int port, unsigned int bytes, uint32_t data, unsigned int port, unsigned int bytes, uint32_t data,
struct vcpu *v, struct cpu_user_regs *regs) struct vcpu *v, struct cpu_user_regs *regs)
@@ -1694,8 +1713,6 @@ static void guest_io_write( @@ -1720,8 +1739,6 @@ static void guest_io_write(
{ {
switch ( bytes ) { switch ( bytes ) {
case 1: case 1:
@ -187,7 +187,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
outb((uint8_t)data, port); outb((uint8_t)data, port);
if ( pv_post_outb_hook ) if ( pv_post_outb_hook )
pv_post_outb_hook(port, (uint8_t)data); pv_post_outb_hook(port, (uint8_t)data);
@@ -1718,6 +1735,23 @@ static void guest_io_write( @@ -1744,6 +1761,23 @@ static void guest_io_write(
{ {
pv_pit_handler(port, (uint8_t)data, 1); pv_pit_handler(port, (uint8_t)data, 1);
} }
@ -211,7 +211,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
else if ( (port == 0xcf8) && (bytes == 4) ) else if ( (port == 0xcf8) && (bytes == 4) )
{ {
size = 4; size = 4;
@@ -2083,10 +2117,6 @@ static int emulate_privileged_op(struct @@ -2109,10 +2143,6 @@ static int emulate_privileged_op(struct
goto fail; goto fail;
if ( admin_io_okay(port, op_bytes, v, regs) ) if ( admin_io_okay(port, op_bytes, v, regs) )
{ {
@ -222,10 +222,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
io_emul(regs); io_emul(regs);
if ( (op_bytes == 1) && pv_post_outb_hook ) if ( (op_bytes == 1) && pv_post_outb_hook )
pv_post_outb_hook(port, regs->eax); pv_post_outb_hook(port, regs->eax);
Index: xen-4.1.2-testing/xen/include/asm-x86/domain.h Index: xen-4.1.3-testing/xen/include/asm-x86/domain.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/domain.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/domain.h
+++ xen-4.1.2-testing/xen/include/asm-x86/domain.h +++ xen-4.1.3-testing/xen/include/asm-x86/domain.h
@@ -251,6 +251,7 @@ struct arch_domain @@ -251,6 +251,7 @@ struct arch_domain
/* I/O-port admin-specified access capabilities. */ /* I/O-port admin-specified access capabilities. */
struct rangeset *ioport_caps; struct rangeset *ioport_caps;
@ -234,10 +234,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/domain.h
struct list_head pdev_list; struct list_head pdev_list;
struct hvm_domain hvm_domain; struct hvm_domain hvm_domain;
Index: xen-4.1.2-testing/xen/include/asm-x86/hpet.h Index: xen-4.1.3-testing/xen/include/asm-x86/hpet.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/hpet.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/hpet.h
+++ xen-4.1.2-testing/xen/include/asm-x86/hpet.h +++ xen-4.1.3-testing/xen/include/asm-x86/hpet.h
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
#define HPET_TN_FSB_CAP 0x8000 #define HPET_TN_FSB_CAP 0x8000
#define HPET_TN_ROUTE_SHIFT 9 #define HPET_TN_ROUTE_SHIFT 9
@ -246,10 +246,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/hpet.h
#define hpet_read32(x) \ #define hpet_read32(x) \
(*(volatile u32 *)(fix_to_virt(FIX_HPET_BASE) + (x))) (*(volatile u32 *)(fix_to_virt(FIX_HPET_BASE) + (x)))
Index: xen-4.1.2-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h Index: xen-4.1.3-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/mach-default/smpboot_hooks.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/mach-default/smpboot_hooks.h
+++ xen-4.1.2-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h +++ xen-4.1.3-testing/xen/include/asm-x86/mach-default/smpboot_hooks.h
@@ -3,7 +3,11 @@ @@ -3,7 +3,11 @@
static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)

View File

@ -1,107 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@citrix.com>
# Date 1311081181 -3600
# Node ID b3434f24b0827c5ef34e4b4a72893288e2ffbe40
# Parent 18653a163b1e8e10b4353272bcb9e8302bfd2e19
x86: Remove timeouts from INIT-SIPI-SIPI sequence when using x2apic.
Some of the timeouts are pointless since they're waiting for the ICR
to ack the IPI delivery and that doesn't happen on x2apic.
The others should be benign (and are suggested in the SDM) but
removing them makes AP bringup much more reliable on some test boxes.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Index: xen-4.1.2-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.1.2-testing/xen/arch/x86/smpboot.c
@@ -447,29 +447,30 @@ static int wakeup_secondary_cpu(int phys
apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT,
phys_apicid);
- Dprintk("Waiting for send to finish...\n");
- timeout = 0;
- do {
- Dprintk("+");
- udelay(100);
- if ( !x2apic_enabled )
+ if ( !x2apic_enabled )
+ {
+ Dprintk("Waiting for send to finish...\n");
+ timeout = 0;
+ do {
+ Dprintk("+");
+ udelay(100);
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
- } while ( send_status && (timeout++ < 1000) );
+ } while ( send_status && (timeout++ < 1000) );
- mdelay(10);
+ mdelay(10);
- Dprintk("Deasserting INIT.\n");
+ Dprintk("Deasserting INIT.\n");
- apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid);
+ apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid);
- Dprintk("Waiting for send to finish...\n");
- timeout = 0;
- do {
- Dprintk("+");
- udelay(100);
- if ( !x2apic_enabled )
+ Dprintk("Waiting for send to finish...\n");
+ timeout = 0;
+ do {
+ Dprintk("+");
+ udelay(100);
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
- } while ( send_status && (timeout++ < 1000) );
+ } while ( send_status && (timeout++ < 1000) );
+ }
/*
* Should we send STARTUP IPIs ?
@@ -498,22 +499,24 @@ static int wakeup_secondary_cpu(int phys
*/
apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12), phys_apicid);
- /* Give the other CPU some time to accept the IPI. */
- udelay(300);
-
- Dprintk("Startup point 1.\n");
-
- Dprintk("Waiting for send to finish...\n");
- timeout = 0;
- do {
- Dprintk("+");
- udelay(100);
- if ( !x2apic_enabled )
- send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
- } while ( send_status && (timeout++ < 1000) );
-
- /* Give the other CPU some time to accept the IPI. */
- udelay(200);
+ if ( !x2apic_enabled )
+ {
+ /* Give the other CPU some time to accept the IPI. */
+ udelay(300);
+
+ Dprintk("Startup point 1.\n");
+
+ Dprintk("Waiting for send to finish...\n");
+ timeout = 0;
+ do {
+ Dprintk("+");
+ udelay(100);
+ send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
+ } while ( send_status && (timeout++ < 1000) );
+
+ /* Give the other CPU some time to accept the IPI. */
+ udelay(200);
+ }
/* Due to the Pentium erratum 3AP. */
if ( maxlvt > 3 )

View File

@ -1,127 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1311081291 -3600
# Node ID fd97ca086df6808bffc6ecf3f79cebca64c60bc3
# Parent 4dc6a9ba90d60fdf0cc0898fc9a8fe84ae9030fc
x86: update Intel CPUID masking code to latest spec
..., which adds masking of the xsave feature leaf.
Also fix the printing (to actually make it do what it was supposed to
do from the beginning) of what specific masking couldn't be done in
case the user requested something the hardware doesn't support.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1311255291 -3600
# Node ID 48f72b389b04cfa8d44924577a69ed59e48fbe77
# Parent dd5eecf739d152fb16bd44897875ea878d4c9d59
x86: add change missing in c/s 23726:fd97ca086df6
The early "do we need to do anything" check needs adjustment, too.
Thanks to Haitao Shan for pointing this out.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -27,10 +27,15 @@ boolean_param("noserialnumber", disable_
static bool_t __cpuinitdata use_xsave = 1;
boolean_param("xsave", use_xsave);
+
unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u;
integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
unsigned int __devinitdata opt_cpuid_mask_edx = ~0u;
integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
+
+unsigned int __devinitdata opt_cpuid_mask_xsave_eax = ~0u;
+integer_param("cpuid_mask_xsave_eax", opt_cpuid_mask_xsave_eax);
+
unsigned int __devinitdata opt_cpuid_mask_ext_ecx = ~0u;
integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx);
unsigned int __devinitdata opt_cpuid_mask_ext_edx = ~0u;
--- a/xen/arch/x86/cpu/cpu.h
+++ b/xen/arch/x86/cpu/cpu.h
@@ -22,6 +22,7 @@ struct cpu_dev {
extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM];
extern unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
+extern unsigned int opt_cpuid_mask_xsave_eax;
extern unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx;
extern int get_model_name(struct cpuinfo_x86 *c);
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -59,10 +59,12 @@ void set_cpuid_faulting(bool_t enable)
*/
static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c)
{
+ u32 eax, edx;
const char *extra = "";
if (!~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx &
- opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+ opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx &
+ opt_cpuid_mask_xsave_eax))
return;
/* Only family 6 supports this feature */
@@ -75,9 +77,12 @@ static void __devinit set_cpuidmask(cons
wrmsr(MSR_INTEL_CPUID_FEATURE_MASK,
opt_cpuid_mask_ecx,
opt_cpuid_mask_edx);
- if (!~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+ if (~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+ extra = "extended ";
+ else if (~opt_cpuid_mask_xsave_eax)
+ extra = "xsave ";
+ else
return;
- extra = "extended ";
break;
/*
* CPU supports this feature if the processor signature meets the following:
@@ -97,11 +102,25 @@ static void __devinit set_cpuidmask(cons
wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK,
opt_cpuid_mask_ext_ecx,
opt_cpuid_mask_ext_edx);
+ if (!~opt_cpuid_mask_xsave_eax)
+ return;
+ extra = "xsave ";
+ break;
+ case 0x2a:
+ wrmsr(MSR_INTEL_CPUID1_FEATURE_MASK_V2,
+ opt_cpuid_mask_ecx,
+ opt_cpuid_mask_edx);
+ rdmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK, eax, edx);
+ wrmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK,
+ opt_cpuid_mask_xsave_eax, edx);
+ wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK_V2,
+ opt_cpuid_mask_ext_ecx,
+ opt_cpuid_mask_ext_edx);
return;
}
- printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n",
- smp_processor_id());
+ printk(XENLOG_ERR "Cannot set CPU %sfeature mask on CPU#%d\n",
+ extra, smp_processor_id());
}
void __devinit early_intel_workaround(struct cpuinfo_x86 *c)
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -488,6 +488,10 @@
#define MSR_INTEL_CPUID1_FEATURE_MASK 0x00000130
#define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
+#define MSR_INTEL_CPUID1_FEATURE_MASK_V2 0x00000132
+#define MSR_INTEL_CPUID80000001_FEATURE_MASK_V2 0x00000133
+#define MSR_INTEL_CPUIDD_01_FEATURE_MASK 0x00000134
+
/* Intel cpuid faulting MSRs */
#define MSR_INTEL_PLATFORM_INFO 0x000000ce
#define MSR_INTEL_MISC_FEATURES_ENABLES 0x00000140

View File

@ -42,10 +42,10 @@ tests...
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c Index: xen-4.1.3-testing/tools/libxc/xc_dom_elfloader.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_dom_elfloader.c --- xen-4.1.3-testing.orig/tools/libxc/xc_dom_elfloader.c
+++ xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c +++ xen-4.1.3-testing/tools/libxc/xc_dom_elfloader.c
@@ -286,6 +286,13 @@ static int xc_dom_parse_elf_kernel(struc @@ -286,6 +286,13 @@ static int xc_dom_parse_elf_kernel(struc
if ( (rc = elf_xen_parse(elf, &dom->parms)) != 0 ) if ( (rc = elf_xen_parse(elf, &dom->parms)) != 0 )
return rc; return rc;
@ -60,11 +60,11 @@ Index: xen-4.1.2-testing/tools/libxc/xc_dom_elfloader.c
/* find kernel segment */ /* find kernel segment */
dom->kernel_seg.vstart = dom->parms.virt_kstart; dom->kernel_seg.vstart = dom->parms.virt_kstart;
dom->kernel_seg.vend = dom->parms.virt_kend; dom->kernel_seg.vend = dom->parms.virt_kend;
Index: xen-4.1.2-testing/xen/arch/ia64/xen/domain.c Index: xen-4.1.3-testing/xen/arch/ia64/xen/domain.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/ia64/xen/domain.c --- xen-4.1.3-testing.orig/xen/arch/ia64/xen/domain.c
+++ xen-4.1.2-testing/xen/arch/ia64/xen/domain.c +++ xen-4.1.3-testing/xen/arch/ia64/xen/domain.c
@@ -2164,6 +2164,13 @@ int __init construct_dom0(struct domain @@ -2165,6 +2165,13 @@ int __init construct_dom0(struct domain
return -1; return -1;
} }
@ -78,10 +78,10 @@ Index: xen-4.1.2-testing/xen/arch/ia64/xen/domain.c
p_start = parms.virt_base; p_start = parms.virt_base;
pkern_start = parms.virt_kstart; pkern_start = parms.virt_kstart;
pkern_end = parms.virt_kend; pkern_end = parms.virt_kend;
Index: xen-4.1.2-testing/xen/arch/x86/domain_build.c Index: xen-4.1.3-testing/xen/arch/x86/domain_build.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/domain_build.c --- xen-4.1.3-testing.orig/xen/arch/x86/domain_build.c
+++ xen-4.1.2-testing/xen/arch/x86/domain_build.c +++ xen-4.1.3-testing/xen/arch/x86/domain_build.c
@@ -417,6 +417,13 @@ int __init construct_dom0( @@ -417,6 +417,13 @@ int __init construct_dom0(
return -EINVAL; return -EINVAL;
} }
@ -96,11 +96,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/domain_build.c
#if defined(__x86_64__) #if defined(__x86_64__)
if ( compat32 ) if ( compat32 )
{ {
Index: xen-4.1.2-testing/xen/common/kernel.c Index: xen-4.1.3-testing/xen/common/kernel.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/common/kernel.c --- xen-4.1.3-testing.orig/xen/common/kernel.c
+++ xen-4.1.2-testing/xen/common/kernel.c +++ xen-4.1.3-testing/xen/common/kernel.c
@@ -287,6 +287,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL @@ -289,6 +289,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL
(1U << XENFEAT_auto_translated_physmap); (1U << XENFEAT_auto_translated_physmap);
if ( supervisor_mode_kernel ) if ( supervisor_mode_kernel )
fi.submap |= 1U << XENFEAT_supervisor_mode_kernel; fi.submap |= 1U << XENFEAT_supervisor_mode_kernel;
@ -109,10 +109,10 @@ Index: xen-4.1.2-testing/xen/common/kernel.c
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if ( !is_hvm_vcpu(current) ) if ( !is_hvm_vcpu(current) )
fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
Index: xen-4.1.2-testing/xen/common/libelf/libelf-dominfo.c Index: xen-4.1.3-testing/xen/common/libelf/libelf-dominfo.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/common/libelf/libelf-dominfo.c --- xen-4.1.3-testing.orig/xen/common/libelf/libelf-dominfo.c
+++ xen-4.1.2-testing/xen/common/libelf/libelf-dominfo.c +++ xen-4.1.3-testing/xen/common/libelf/libelf-dominfo.c
@@ -26,7 +26,8 @@ static const char *const elf_xen_feature @@ -26,7 +26,8 @@ static const char *const elf_xen_feature
[XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables", [XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables",
[XENFEAT_auto_translated_physmap] = "auto_translated_physmap", [XENFEAT_auto_translated_physmap] = "auto_translated_physmap",
@ -161,10 +161,10 @@ Index: xen-4.1.2-testing/xen/common/libelf/libelf-dominfo.c
} }
return 0; return 0;
} }
Index: xen-4.1.2-testing/xen/common/libelf/libelf-tools.c Index: xen-4.1.3-testing/xen/common/libelf/libelf-tools.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/common/libelf/libelf-tools.c --- xen-4.1.3-testing.orig/xen/common/libelf/libelf-tools.c
+++ xen-4.1.2-testing/xen/common/libelf/libelf-tools.c +++ xen-4.1.3-testing/xen/common/libelf/libelf-tools.c
@@ -227,6 +227,27 @@ uint64_t elf_note_numeric(struct elf_bin @@ -227,6 +227,27 @@ uint64_t elf_note_numeric(struct elf_bin
return 0; return 0;
} }
@ -193,10 +193,10 @@ Index: xen-4.1.2-testing/xen/common/libelf/libelf-tools.c
const elf_note *elf_note_next(struct elf_binary *elf, const elf_note * note) const elf_note *elf_note_next(struct elf_binary *elf, const elf_note * note)
{ {
int namesz = (elf_uval(elf, note, namesz) + 3) & ~3; int namesz = (elf_uval(elf, note, namesz) + 3) & ~3;
Index: xen-4.1.2-testing/xen/include/public/elfnote.h Index: xen-4.1.3-testing/xen/include/public/elfnote.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/elfnote.h --- xen-4.1.3-testing.orig/xen/include/public/elfnote.h
+++ xen-4.1.2-testing/xen/include/public/elfnote.h +++ xen-4.1.3-testing/xen/include/public/elfnote.h
@@ -179,9 +179,22 @@ @@ -179,9 +179,22 @@
#define XEN_ELFNOTE_MOD_START_PFN 16 #define XEN_ELFNOTE_MOD_START_PFN 16
@ -221,10 +221,10 @@ Index: xen-4.1.2-testing/xen/include/public/elfnote.h
/* /*
* System information exported through crash notes. * System information exported through crash notes.
Index: xen-4.1.2-testing/xen/include/public/features.h Index: xen-4.1.3-testing/xen/include/public/features.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/features.h --- xen-4.1.3-testing.orig/xen/include/public/features.h
+++ xen-4.1.2-testing/xen/include/public/features.h +++ xen-4.1.3-testing/xen/include/public/features.h
@@ -75,7 +75,10 @@ @@ -75,7 +75,10 @@
#define XENFEAT_hvm_safe_pvclock 9 #define XENFEAT_hvm_safe_pvclock 9
@ -237,10 +237,10 @@ Index: xen-4.1.2-testing/xen/include/public/features.h
#define XENFEAT_NR_SUBMAPS 1 #define XENFEAT_NR_SUBMAPS 1
Index: xen-4.1.2-testing/xen/include/xen/libelf.h Index: xen-4.1.3-testing/xen/include/xen/libelf.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/libelf.h --- xen-4.1.3-testing.orig/xen/include/xen/libelf.h
+++ xen-4.1.2-testing/xen/include/xen/libelf.h +++ xen-4.1.3-testing/xen/include/xen/libelf.h
@@ -179,6 +179,8 @@ const elf_sym *elf_sym_by_index(struct e @@ -179,6 +179,8 @@ const elf_sym *elf_sym_by_index(struct e
const char *elf_note_name(struct elf_binary *elf, const elf_note * note); const char *elf_note_name(struct elf_binary *elf, const elf_note * note);
const void *elf_note_desc(struct elf_binary *elf, const elf_note * note); const void *elf_note_desc(struct elf_binary *elf, const elf_note * note);

View File

@ -25,8 +25,10 @@ x86-64/mmcfg: remove __initdata annotation overlooked in 23749:e8d1c8f074ba
Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/physdev.c Index: xen-4.1.3-testing/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/physdev.c
+++ xen-4.1.3-testing/xen/arch/x86/physdev.c
@@ -16,6 +16,10 @@ @@ -16,6 +16,10 @@
#include <xsm/xsm.h> #include <xsm/xsm.h>
#include <asm/p2m.h> #include <asm/p2m.h>
@ -38,7 +40,7 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
#ifndef COMPAT #ifndef COMPAT
typedef long ret_t; typedef long ret_t;
#endif #endif
@@ -512,6 +516,24 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H @@ -540,6 +544,24 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
break; break;
} }
@ -63,8 +65,10 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
case PHYSDEVOP_restore_msi: { case PHYSDEVOP_restore_msi: {
struct physdev_restore_msi restore_msi; struct physdev_restore_msi restore_msi;
struct pci_dev *pdev; struct pci_dev *pdev;
--- a/xen/arch/x86/x86_64/mmconfig.h Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig.h
+++ b/xen/arch/x86/x86_64/mmconfig.h ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig.h
+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig.h
@@ -84,6 +84,11 @@ extern int pci_mmcfg_config_num; @@ -84,6 +84,11 @@ extern int pci_mmcfg_config_num;
extern struct acpi_mcfg_allocation *pci_mmcfg_config; extern struct acpi_mcfg_allocation *pci_mmcfg_config;
@ -78,8 +82,10 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
-void pci_mmcfg_arch_free(void); -void pci_mmcfg_arch_free(void);
+int pci_mmcfg_arch_enable(unsigned int); +int pci_mmcfg_arch_enable(unsigned int);
+void pci_mmcfg_arch_disable(unsigned int); +void pci_mmcfg_arch_disable(unsigned int);
--- a/xen/arch/x86/x86_64/mmconfig-shared.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c
+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -22,10 +22,10 @@ @@ -22,10 +22,10 @@
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/msr.h> #include <asm/msr.h>
@ -185,12 +191,12 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
- /* for late to exit */ - /* for late to exit */
- if (known_bridge) - if (known_bridge)
- return; - return;
-
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
+ if (pci_mmcfg_check_hostbridge()) { + if (pci_mmcfg_check_hostbridge()) {
+ unsigned int i; + unsigned int i;
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
-
- if (!known_bridge) { - if (!known_bridge) {
+ pci_mmcfg_arch_init(); + pci_mmcfg_arch_init();
+ for (i = 0; i < pci_mmcfg_config_num; ++i) + for (i = 0; i < pci_mmcfg_config_num; ++i)
@ -247,8 +253,10 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
} }
/** /**
--- a/xen/arch/x86/x86_64/mmconfig_64.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig_64.c
+++ b/xen/arch/x86/x86_64/mmconfig_64.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mmconfig_64.c
+++ xen-4.1.3-testing/xen/arch/x86/x86_64/mmconfig_64.c
@@ -23,7 +23,7 @@ struct mmcfg_virt { @@ -23,7 +23,7 @@ struct mmcfg_virt {
char __iomem *virt; char __iomem *virt;
}; };
@ -360,8 +368,10 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
- xfree(pci_mmcfg_virt); - xfree(pci_mmcfg_virt);
- pci_mmcfg_virt = NULL; - pci_mmcfg_virt = NULL;
-} -}
--- a/xen/arch/x86/x86_64/physdev.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/physdev.c
+++ b/xen/arch/x86/x86_64/physdev.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/physdev.c
+++ xen-4.1.3-testing/xen/arch/x86/x86_64/physdev.c
@@ -54,6 +54,10 @@ @@ -54,6 +54,10 @@
#define physdev_get_free_pirq compat_physdev_get_free_pirq #define physdev_get_free_pirq compat_physdev_get_free_pirq
#define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t #define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t
@ -373,9 +383,11 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
#define COMPAT #define COMPAT
#undef guest_handle_okay #undef guest_handle_okay
#define guest_handle_okay compat_handle_okay #define guest_handle_okay compat_handle_okay
--- a/xen/include/public/physdev.h Index: xen-4.1.3-testing/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h ===================================================================
@@ -255,6 +255,19 @@ struct physdev_get_free_pirq { --- xen-4.1.3-testing.orig/xen/include/public/physdev.h
+++ xen-4.1.3-testing/xen/include/public/physdev.h
@@ -263,6 +263,19 @@ struct physdev_get_free_pirq {
typedef struct physdev_get_free_pirq physdev_get_free_pirq_t; typedef struct physdev_get_free_pirq physdev_get_free_pirq_t;
DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t); DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t);
@ -395,8 +407,10 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
/* /*
* Notify that some PIRQ-bound event channels have been unmasked. * Notify that some PIRQ-bound event channels have been unmasked.
* ** This command is obsolete since interface version 0x00030202 and is ** * ** This command is obsolete since interface version 0x00030202 and is **
--- a/xen/include/xlat.lst Index: xen-4.1.3-testing/xen/include/xlat.lst
+++ b/xen/include/xlat.lst ===================================================================
--- xen-4.1.3-testing.orig/xen/include/xlat.lst
+++ xen-4.1.3-testing/xen/include/xlat.lst
@@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
! memory_map memory.h ! memory_map memory.h
! memory_reservation memory.h ! memory_reservation memory.h

View File

@ -1,147 +0,0 @@
References: bnc#713503
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1311701818 -3600
# Node ID ef9ed3d2aa870a37ed5e611be9c524d526a2d604
# Parent 590aadf7c46ae979da3552332f592f9492ce6d8b
xen: Infrastructure to allow irqs to share vector maps
Laying the groundwork for per-device vector maps. This generic
code allows any irq to point to a vector map; all irqs sharing the
same vector map will avoid sharing vectors.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1314026133 -3600
# Node ID 3a05da2dc7c0a5fc0fcfc40c535d1fcb71203625
# Parent d1cd78a73a79e0e648937322cdb8d92a7f86327a
x86: Fix up irq vector map logic
We need to make sure that cfg->used_vector is only cleared once;
otherwise there may be a race condition that allows the same vector to
be assigned twice, defeating the whole purpose of the map.
This makes two changes:
* __clear_irq_vector() only clears the vector if the irq is not being
moved
* smp_iqr_move_cleanup_interrupt() only clears used_vector if this
is the last place it's being used (move_cleanup_count==0 after
decrement).
Also make use of asserts more consistent, to catch this kind of logic
bug in the future.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -548,6 +548,13 @@ fastcall void smp_irq_move_cleanup_inter
}
__get_cpu_var(vector_irq)[vector] = -1;
cfg->move_cleanup_count--;
+
+ if ( cfg->move_cleanup_count == 0
+ && cfg->used_vectors )
+ {
+ ASSERT(test_bit(vector, cfg->used_vectors));
+ clear_bit(vector, cfg->used_vectors);
+ }
unlock:
spin_unlock(&desc->lock);
}
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -94,6 +94,11 @@ static int __init __bind_irq_vector(int
per_cpu(vector_irq, cpu)[vector] = irq;
cfg->vector = vector;
cfg->cpu_mask = online_mask;
+ if ( cfg->used_vectors )
+ {
+ ASSERT(!test_bit(vector, cfg->used_vectors));
+ set_bit(vector, cfg->used_vectors);
+ }
irq_status[irq] = IRQ_USED;
if (IO_APIC_IRQ(irq))
irq_vector[irq] = vector;
@@ -159,6 +164,7 @@ static void dynamic_irq_cleanup(unsigned
desc->depth = 1;
desc->msi_desc = NULL;
desc->handler = &no_irq_type;
+ desc->chip_data->used_vectors=NULL;
cpus_setall(desc->affinity);
spin_unlock_irqrestore(&desc->lock, flags);
@@ -191,6 +197,7 @@ static void __clear_irq_vector(int irq)
if (likely(!cfg->move_in_progress))
return;
+
cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
for_each_cpu_mask(cpu, tmp_mask) {
for (vector = FIRST_DYNAMIC_VECTOR; vector <= LAST_DYNAMIC_VECTOR;
@@ -202,6 +209,12 @@ static void __clear_irq_vector(int irq)
}
}
+ if ( cfg->used_vectors )
+ {
+ ASSERT(test_bit(vector, cfg->used_vectors));
+ clear_bit(vector, cfg->used_vectors);
+ }
+
cfg->move_in_progress = 0;
}
@@ -261,6 +274,7 @@ static void init_one_irq_cfg(struct irq_
cfg->vector = IRQ_VECTOR_UNASSIGNED;
cpus_clear(cfg->cpu_mask);
cpus_clear(cfg->old_cpu_mask);
+ cfg->used_vectors = NULL;
}
int init_irq_data(void)
@@ -387,6 +401,10 @@ next:
if (test_bit(vector, used_vectors))
goto next;
+ if (cfg->used_vectors
+ && test_bit(vector, cfg->used_vectors) )
+ goto next;
+
for_each_cpu_mask(new_cpu, tmp_mask)
if (per_cpu(vector_irq, new_cpu)[vector] != -1)
goto next;
@@ -402,6 +420,11 @@ next:
per_cpu(vector_irq, new_cpu)[vector] = irq;
cfg->vector = vector;
cpus_copy(cfg->cpu_mask, tmp_mask);
+ if ( cfg->used_vectors )
+ {
+ ASSERT(!test_bit(vector, cfg->used_vectors));
+ set_bit(vector, cfg->used_vectors);
+ }
irq_status[irq] = IRQ_USED;
if (IO_APIC_IRQ(irq))
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -23,11 +23,16 @@
#define irq_to_desc(irq) (&irq_desc[irq])
#define irq_cfg(irq) (&irq_cfg[irq])
+typedef struct {
+ DECLARE_BITMAP(_bits,NR_VECTORS);
+} vmask_t;
+
struct irq_cfg {
int vector;
cpumask_t cpu_mask;
cpumask_t old_cpu_mask;
unsigned move_cleanup_count;
+ vmask_t *used_vectors;
u8 move_in_progress : 1;
};

View File

@ -1,361 +0,0 @@
References: bnc#713503
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1311701836 -3600
# Node ID 2e0cf9428554da666616982cd0074024ff85b221
# Parent ef9ed3d2aa870a37ed5e611be9c524d526a2d604
xen: Option to allow per-device vector maps for MSI IRQs
Add a vector-map to pci_dev, and add an option to point MSI-related
IRQs to the vector-map of the device.
This prevents irqs from the same device from being assigned
the same vector on different pcpus. This is required for systems
using an AMD IOMMU, since the intremap tables on AMD only look at
vector, and not destination ID.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1311701852 -3600
# Node ID fa4e2ca9ecffbc432b451f495ad0a403644a6be8
# Parent 2e0cf9428554da666616982cd0074024ff85b221
xen: AMD IOMMU: Automatically enable per-device vector maps
Automatically enable per-device vector maps when using IOMMU,
unless disabled specifically by an IOMMU parameter.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1315231215 -3600
# Node ID 32814ad7458dc842a7c588eee13e5c4ee11709a3
# Parent f1349a968a5ac5577d67ad4a3f3490c580dbe264
xen: Add global irq_vector_map option, set if using AMD global intremap tables
As mentioned in previous changesets, AMD IOMMU interrupt
remapping tables only look at the vector, not the destination
id of an interrupt. This means that all IRQs going through
the same interrupt remapping table need to *not* share vectors.
The irq "vector map" functionality was originally introduced
after a patch which disabled global AMD IOMMUs entirely. That
patch has since been reverted, meaning that AMD intremap tables
can either be per-device or global.
This patch therefore introduces a global irq vector map option,
and enables it if we're using an AMD IOMMU with a global
interrupt remapping table.
This patch removes the "irq-perdev-vector-map" boolean
command-line optino and replaces it with "irq_vector_map",
which can have one of three values: none, global, or per-device.
Setting the irq_vector_map to any value will override the
default that the AMD code sets.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1317730316 -7200
# Node ID a99d75671a911f9c0d5d11e0fe88a0a65863cb44
# Parent 3d1664cc9e458809e399320204aca8536e401ee1
AMD-IOMMU: remove dead variable references
These got orphaned up by recent changes.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/docs/src/user.tex
+++ b/docs/src/user.tex
@@ -4197,6 +4197,10 @@ writing to the VGA console after domain
\item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of
vcpu migration in microseconds (default 0). This parameter avoids agressive
vcpu migration. For example, the linux kernel uses 0.5ms by default.
+\item [ irq_vector_map=xxx ] Enable irq vector non-sharing maps. Setting 'global'
+ will ensure that no IRQs will share vectors. Setting 'per-device' will ensure
+ that no IRQs from the same device will share vectors. Setting to 'none' will
+ disable it entirely, overriding any defaults the IOMMU code may set.
\end{description}
In addition, the following options may be specified on the Xen command
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -24,6 +24,8 @@
#include <asm/mach-generic/mach_apic.h>
#include <public/physdev.h>
+static void parse_irq_vector_map_param(char *s);
+
/* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
bool_t __read_mostly opt_noirqbalance = 0;
boolean_param("noirqbalance", opt_noirqbalance);
@@ -32,6 +34,12 @@ unsigned int __read_mostly nr_irqs_gsi =
unsigned int __read_mostly nr_irqs;
integer_param("nr_irqs", nr_irqs);
+/* This default may be changed by the AMD IOMMU code */
+int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
+custom_param("irq_vector_map", parse_irq_vector_map_param);
+
+vmask_t global_used_vector_map;
+
u8 __read_mostly *irq_vector;
struct irq_desc __read_mostly *irq_desc = NULL;
@@ -60,6 +68,26 @@ static struct timer irq_ratelimit_timer;
static unsigned int __read_mostly irq_ratelimit_threshold = 10000;
integer_param("irq_ratelimit", irq_ratelimit_threshold);
+static void __init parse_irq_vector_map_param(char *s)
+{
+ char *ss;
+
+ do {
+ ss = strchr(s, ',');
+ if ( ss )
+ *ss = '\0';
+
+ if ( !strcmp(s, "none"))
+ opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_NONE;
+ else if ( !strcmp(s, "global"))
+ opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_GLOBAL;
+ else if ( !strcmp(s, "per-device"))
+ opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_PERDEV;
+
+ s = ss + 1;
+ } while ( ss );
+}
+
/* Must be called when irq disabled */
void lock_vector_lock(void)
{
@@ -344,6 +372,41 @@ hw_irq_controller no_irq_type = {
end_none
};
+static vmask_t *irq_get_used_vector_mask(int irq)
+{
+ vmask_t *ret = NULL;
+
+ if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_GLOBAL )
+ {
+ struct irq_desc *desc = irq_to_desc(irq);
+
+ ret = &global_used_vector_map;
+
+ if ( desc->chip_data->used_vectors )
+ {
+ printk(XENLOG_INFO "%s: Strange, unassigned irq %d already has used_vectors!\n",
+ __func__, irq);
+ }
+ else
+ {
+ int vector;
+
+ vector = irq_to_vector(irq);
+ if ( vector > 0 )
+ {
+ printk(XENLOG_INFO "%s: Strange, irq %d already assigned vector %d!\n",
+ __func__, irq, vector);
+
+ ASSERT(!test_bit(vector, ret));
+
+ set_bit(vector, ret);
+ }
+ }
+ }
+
+ return ret;
+}
+
int __assign_irq_vector(int irq, struct irq_cfg *cfg, const cpumask_t *mask)
{
/*
@@ -362,6 +425,7 @@ int __assign_irq_vector(int irq, struct
int cpu, err;
unsigned long flags;
cpumask_t tmp_mask;
+ vmask_t *irq_used_vectors = NULL;
old_vector = irq_to_vector(irq);
if (old_vector) {
@@ -376,6 +440,17 @@ int __assign_irq_vector(int irq, struct
return -EAGAIN;
err = -ENOSPC;
+
+ /* This is the only place normal IRQs are ever marked
+ * as "in use". If they're not in use yet, check to see
+ * if we need to assign a global vector mask. */
+ if ( irq_status[irq] == IRQ_USED )
+ {
+ irq_used_vectors = cfg->used_vectors;
+ }
+ else
+ irq_used_vectors = irq_get_used_vector_mask(irq);
+
for_each_cpu_mask(cpu, *mask) {
int new_cpu;
int vector, offset;
@@ -401,8 +476,8 @@ next:
if (test_bit(vector, used_vectors))
goto next;
- if (cfg->used_vectors
- && test_bit(vector, cfg->used_vectors) )
+ if (irq_used_vectors
+ && test_bit(vector, irq_used_vectors) )
goto next;
for_each_cpu_mask(new_cpu, tmp_mask)
@@ -420,15 +495,22 @@ next:
per_cpu(vector_irq, new_cpu)[vector] = irq;
cfg->vector = vector;
cpus_copy(cfg->cpu_mask, tmp_mask);
+
+ irq_status[irq] = IRQ_USED;
+ ASSERT((cfg->used_vectors == NULL)
+ || (cfg->used_vectors == irq_used_vectors));
+ cfg->used_vectors = irq_used_vectors;
+
+ if (IO_APIC_IRQ(irq))
+ irq_vector[irq] = vector;
+
if ( cfg->used_vectors )
{
ASSERT(!test_bit(vector, cfg->used_vectors));
+
set_bit(vector, cfg->used_vectors);
}
- irq_status[irq] = IRQ_USED;
- if (IO_APIC_IRQ(irq))
- irq_vector[irq] = vector;
err = 0;
local_irq_restore(flags);
break;
@@ -1523,7 +1605,7 @@ int map_domain_pirq(
if ( !IS_PRIV(current->domain) &&
!(IS_PRIV_FOR(current->domain, d) &&
- irq_access_permitted(current->domain, pirq)))
+ irq_access_permitted(current->domain, pirq)))
return -EPERM;
if ( pirq < 0 || pirq >= d->nr_pirqs || irq < 0 || irq >= nr_irqs )
@@ -1571,8 +1653,22 @@ int map_domain_pirq(
if ( desc->handler != &no_irq_type )
dprintk(XENLOG_G_ERR, "dom%d: irq %d in use\n",
- d->domain_id, irq);
+ d->domain_id, irq);
desc->handler = &pci_msi_type;
+
+ if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
+ && !desc->chip_data->used_vectors )
+ {
+ desc->chip_data->used_vectors = &pdev->info.used_vectors;
+ if ( desc->chip_data->vector != IRQ_VECTOR_UNASSIGNED )
+ {
+ int vector = desc->chip_data->vector;
+ ASSERT(!test_bit(vector, desc->chip_data->used_vectors));
+
+ set_bit(vector, desc->chip_data->used_vectors);
+ }
+ }
+
d->arch.pirq_irq[pirq] = irq;
d->arch.irq_pirq[irq] = pirq;
setup_msi_irq(pdev, msi_desc, irq);
@@ -1583,9 +1679,12 @@ int map_domain_pirq(
d->arch.pirq_irq[pirq] = irq;
d->arch.irq_pirq[irq] = pirq;
spin_unlock_irqrestore(&desc->lock, flags);
+
+ if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV )
+ printk(XENLOG_INFO "Per-device vector maps for GSIs not implemented yet.\n");
}
- done:
+done:
return ret;
}
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -166,6 +166,35 @@ int __init amd_iov_detect(void)
return -ENODEV;
}
+ /*
+ * AMD IOMMUs don't distinguish between vectors destined for
+ * different cpus when doing interrupt remapping. This means
+ * that interrupts going through the same intremap table
+ * can't share the same vector.
+ *
+ * If irq_vector_map isn't specified, choose a sensible default:
+ * - If we're using per-device interemap tables, per-device
+ * vector non-sharing maps
+ * - If we're using a global interemap table, global vector
+ * non-sharing map
+ */
+ if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_DEFAULT )
+ {
+ if ( amd_iommu_perdev_intremap )
+ {
+ printk("AMD-Vi: Enabling per-device vector maps\n");
+ opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_PERDEV;
+ }
+ else
+ {
+ printk("AMD-Vi: Enabling global vector map\n");
+ opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_GLOBAL;
+ }
+ }
+ else
+ {
+ printk("AMD-Vi: Not overriding irq_vector_map setting\n");
+ }
return scan_pci_devices();
}
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -45,6 +45,13 @@ extern u8 *irq_vector;
extern bool_t opt_noirqbalance;
+#define OPT_IRQ_VECTOR_MAP_DEFAULT 0 /* Do the default thing */
+#define OPT_IRQ_VECTOR_MAP_NONE 1 /* None */
+#define OPT_IRQ_VECTOR_MAP_GLOBAL 2 /* One global vector map (no vector sharing) */
+#define OPT_IRQ_VECTOR_MAP_PERDEV 3 /* Per-device vetor map (no vector sharing w/in a device) */
+
+extern int opt_irq_vector_map;
+
/*
* Per-cpu current frame pointer - the location of the last exception frame on
* the stack
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -11,6 +11,7 @@
#include <xen/types.h>
#include <xen/list.h>
#include <xen/spinlock.h>
+#include <xen/irq.h>
/*
* The PCI interface treats multi-function devices as independent
@@ -38,6 +39,7 @@ struct pci_dev_info {
u8 bus;
u8 devfn;
} physfn;
+ vmask_t used_vectors;
};
struct pci_dev {

View File

@ -19,11 +19,11 @@ in the "raw" pass, though I haven't observed this case in practice).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/io_apic.c Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/io_apic.c --- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c
+++ xen-4.1.2-testing/xen/arch/x86/io_apic.c +++ xen-4.1.3-testing/xen/arch/x86/io_apic.c
@@ -471,14 +471,12 @@ static void eoi_IO_APIC_irq(unsigned int @@ -458,14 +458,12 @@ static void eoi_IO_APIC_irq(unsigned int
spin_unlock_irqrestore(&ioapic_lock, flags); spin_unlock_irqrestore(&ioapic_lock, flags);
} }
@ -40,7 +40,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/io_apic.c
if (entry.delivery_mode == dest_SMI) if (entry.delivery_mode == dest_SMI)
return; return;
@@ -487,7 +485,7 @@ static void __clear_IO_APIC_pin(unsigned @@ -474,7 +472,7 @@ static void __clear_IO_APIC_pin(unsigned
*/ */
memset(&entry, 0, sizeof(entry)); memset(&entry, 0, sizeof(entry));
entry.mask = 1; entry.mask = 1;
@ -49,7 +49,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/io_apic.c
} }
static void clear_IO_APIC (void) static void clear_IO_APIC (void)
@@ -495,10 +493,8 @@ static void clear_IO_APIC (void) @@ -482,10 +480,8 @@ static void clear_IO_APIC (void)
int apic, pin; int apic, pin;
for (apic = 0; apic < nr_ioapics; apic++) { for (apic = 0; apic < nr_ioapics; apic++) {

View File

@ -17,10 +17,10 @@ code.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/boot/Makefile Index: xen-4.1.3-testing/xen/arch/x86/boot/Makefile
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/Makefile --- xen-4.1.3-testing.orig/xen/arch/x86/boot/Makefile
+++ xen-4.1.2-testing/xen/arch/x86/boot/Makefile +++ xen-4.1.3-testing/xen/arch/x86/boot/Makefile
@@ -2,8 +2,8 @@ obj-y += head.o @@ -2,8 +2,8 @@ obj-y += head.o
head.o: reloc.S head.o: reloc.S
@ -32,10 +32,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/Makefile
-reloc.S: $(BASEDIR)/include/asm-x86/config.h -reloc.S: $(BASEDIR)/include/asm-x86/config.h
+reloc.S: head.S +reloc.S: head.S
Index: xen-4.1.2-testing/xen/arch/x86/boot/head.S Index: xen-4.1.3-testing/xen/arch/x86/boot/head.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/head.S --- xen-4.1.3-testing.orig/xen/arch/x86/boot/head.S
+++ xen-4.1.2-testing/xen/arch/x86/boot/head.S +++ xen-4.1.3-testing/xen/arch/x86/boot/head.S
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
.text .text
.code32 .code32
@ -63,10 +63,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/head.S
/* Copy bootstrap trampoline to low memory, below 1MB. */ /* Copy bootstrap trampoline to low memory, below 1MB. */
mov $sym_phys(trampoline_start),%esi mov $sym_phys(trampoline_start),%esi
mov $bootsym_phys(trampoline_start),%edi mov $bootsym_phys(trampoline_start),%edi
Index: xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S Index: xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/trampoline.S --- xen-4.1.3-testing.orig/xen/arch/x86/boot/trampoline.S
+++ xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S +++ xen-4.1.3-testing/xen/arch/x86/boot/trampoline.S
@@ -4,6 +4,13 @@ @@ -4,6 +4,13 @@
#undef bootsym #undef bootsym
#define bootsym(s) ((s)-trampoline_start) #define bootsym(s) ((s)-trampoline_start)
@ -139,10 +139,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/trampoline.S
.code64 .code64
start64: start64:
Index: xen-4.1.2-testing/xen/arch/x86/boot/wakeup.S Index: xen-4.1.3-testing/xen/arch/x86/boot/wakeup.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/boot/wakeup.S --- xen-4.1.3-testing.orig/xen/arch/x86/boot/wakeup.S
+++ xen-4.1.2-testing/xen/arch/x86/boot/wakeup.S +++ xen-4.1.3-testing/xen/arch/x86/boot/wakeup.S
@@ -42,15 +42,13 @@ ENTRY(wakeup_start) @@ -42,15 +42,13 @@ ENTRY(wakeup_start)
# boot trampoline is under 1M, and shift its start into # boot trampoline is under 1M, and shift its start into
@ -210,10 +210,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/boot/wakeup.S
.code64 .code64
wakeup_64: wakeup_64:
Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c Index: xen-4.1.3-testing/xen/arch/x86/efi/boot.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/efi/boot.c --- xen-4.1.3-testing.orig/xen/arch/x86/efi/boot.c
+++ xen-4.1.2-testing/xen/arch/x86/efi/boot.c +++ xen-4.1.3-testing/xen/arch/x86/efi/boot.c
@@ -599,6 +599,9 @@ static void __init relocate_image(unsign @@ -599,6 +599,9 @@ static void __init relocate_image(unsign
} }
} }
@ -291,11 +291,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/efi/boot.c
/* Set system registers and transfer control. */ /* Set system registers and transfer control. */
asm volatile("pushq $0\n\tpopfq"); asm volatile("pushq $0\n\tpopfq");
Index: xen-4.1.2-testing/xen/arch/x86/smpboot.c Index: xen-4.1.3-testing/xen/arch/x86/smpboot.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/smpboot.c --- xen-4.1.3-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.1.2-testing/xen/arch/x86/smpboot.c +++ xen-4.1.3-testing/xen/arch/x86/smpboot.c
@@ -48,6 +48,8 @@ @@ -49,6 +49,8 @@
#define setup_trampoline() (bootsym_phys(trampoline_realmode_entry)) #define setup_trampoline() (bootsym_phys(trampoline_realmode_entry))
@ -304,10 +304,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/smpboot.c
/* Set if we find a B stepping CPU */ /* Set if we find a B stepping CPU */
static int smp_b_stepping; static int smp_b_stepping;
Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_32/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_32/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_32/mm.c
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
#include <xen/lib.h> #include <xen/lib.h>
#include <xen/init.h> #include <xen/init.h>
@ -328,10 +328,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_32/mm.c
} }
void __init subarch_init_memory(void) void __init subarch_init_memory(void)
Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c Index: xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/x86_64/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c +++ xen-4.1.3-testing/xen/arch/x86/x86_64/mm.c
@@ -830,7 +830,7 @@ void __init zap_low_mappings(void) @@ -830,7 +830,7 @@ void __init zap_low_mappings(void)
flush_local(FLUSH_TLB_GLOBAL); flush_local(FLUSH_TLB_GLOBAL);
@ -341,10 +341,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/x86_64/mm.c
PFN_UP(trampoline_end - trampoline_start), PFN_UP(trampoline_end - trampoline_start),
__PAGE_HYPERVISOR); __PAGE_HYPERVISOR);
} }
Index: xen-4.1.2-testing/xen/arch/x86/xen.lds.S Index: xen-4.1.3-testing/xen/arch/x86/xen.lds.S
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/xen.lds.S --- xen-4.1.3-testing.orig/xen/arch/x86/xen.lds.S
+++ xen-4.1.2-testing/xen/arch/x86/xen.lds.S +++ xen-4.1.3-testing/xen/arch/x86/xen.lds.S
@@ -103,6 +103,13 @@ SECTIONS @@ -103,6 +103,13 @@ SECTIONS
*(.init.data) *(.init.data)
*(.init.data.rel) *(.init.data.rel)
@ -359,10 +359,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/xen.lds.S
} :text } :text
. = ALIGN(32); . = ALIGN(32);
.init.setup : { .init.setup : {
Index: xen-4.1.2-testing/xen/include/asm-x86/config.h Index: xen-4.1.3-testing/xen/include/asm-x86/config.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/config.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/config.h
+++ xen-4.1.2-testing/xen/include/asm-x86/config.h +++ xen-4.1.3-testing/xen/include/asm-x86/config.h
@@ -95,13 +95,13 @@ @@ -95,13 +95,13 @@
/* Primary stack is restricted to 8kB by guard pages. */ /* Primary stack is restricted to 8kB by guard pages. */
#define PRIMARY_STACK_SIZE 8192 #define PRIMARY_STACK_SIZE 8192

View File

@ -1,74 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1314004239 -3600
# Node ID 0849b0e59e2418e8215616df147f955b01b07577
# Parent 07f78b5bd03c02e32324eaa00487643d27b7ffa8
pm: don't truncate processors' ACPI IDs to 8 bits
This is just another adjustment to allow systems with very many CPUs
(or unusual ACPI IDs) to be properly power-managed.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/ia64/linux-xen/acpi.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/ia64/linux-xen/acpi.c
+++ xen-4.1.2-testing/xen/arch/ia64/linux-xen/acpi.c
@@ -223,11 +223,14 @@ static u16 ia64_acpiid_to_sapicid[ MAX_L
{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
/* acpi id to cpu id */
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
{
int i;
u16 apic_id;
+ if ( acpi_id >= MAX_LOCAL_SAPIC )
+ return -EINVAL;
+
apic_id = ia64_acpiid_to_sapicid[acpi_id];
if ( apic_id == 0xffff )
return -EINVAL;
Index: xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -901,11 +901,14 @@ static void set_cx(
acpi_power->safe_state = cx;
}
-int get_cpu_id(u8 acpi_id)
+int get_cpu_id(u32 acpi_id)
{
int i;
u32 apic_id;
+ if ( acpi_id >= MAX_MADT_ENTRIES )
+ return -1;
+
apic_id = x86_acpiid_to_apicid[acpi_id];
if ( apic_id == BAD_APICID )
return -1;
@@ -982,7 +985,7 @@ long set_cx_pminfo(uint32_t cpu, struct
print_cx_pminfo(cpu, power);
/* map from acpi_id to cpu_id */
- cpu_id = get_cpu_id((u8)cpu);
+ cpu_id = get_cpu_id(cpu);
if ( cpu_id == -1 )
{
printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu);
Index: xen-4.1.2-testing/xen/include/acpi/cpufreq/processor_perf.h
===================================================================
--- xen-4.1.2-testing.orig/xen/include/acpi/cpufreq/processor_perf.h
+++ xen-4.1.2-testing/xen/include/acpi/cpufreq/processor_perf.h
@@ -6,7 +6,7 @@
#define XEN_PX_INIT 0x80000000
-int get_cpu_id(u8);
+int get_cpu_id(u32);
int powernow_cpufreq_init(void);
unsigned int powernow_register_driver(void);
unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);

View File

@ -20,9 +20,11 @@ Based on a Linux patch from suresh.b.siddha@intel.com.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/xen/arch/x86/io_apic.c Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c ===================================================================
@@ -481,11 +481,35 @@ static void clear_IO_APIC_pin(unsigned i --- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c
+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c
@@ -468,11 +468,35 @@ static void clear_IO_APIC_pin(unsigned i
return; return;
/* /*

View File

@ -17,10 +17,10 @@ extension (which the Dom0 kernel should have no need to know about).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/ia64/linux-xen/acpi.c Index: xen-4.1.3-testing/xen/arch/ia64/linux-xen/acpi.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/ia64/linux-xen/acpi.c --- xen-4.1.3-testing.orig/xen/arch/ia64/linux-xen/acpi.c
+++ xen-4.1.2-testing/xen/arch/ia64/linux-xen/acpi.c +++ xen-4.1.3-testing/xen/arch/ia64/linux-xen/acpi.c
@@ -243,6 +243,13 @@ int get_cpu_id(u32 acpi_id) @@ -243,6 +243,13 @@ int get_cpu_id(u32 acpi_id)
return -1; return -1;
@ -35,11 +35,11 @@ Index: xen-4.1.2-testing/xen/arch/ia64/linux-xen/acpi.c
#endif #endif
static int __init static int __init
Index: xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c Index: xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c --- xen-4.1.3-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c +++ xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -649,12 +649,6 @@ static int cpuidle_init_cpu(int cpu) @@ -644,12 +644,6 @@ static int cpuidle_init_cpu(int cpu)
return 0; return 0;
} }
@ -52,10 +52,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/acpi/cpu_idle.c
#define MWAIT_SUBSTATE_MASK (0xf) #define MWAIT_SUBSTATE_MASK (0xf)
#define MWAIT_SUBSTATE_SIZE (4) #define MWAIT_SUBSTATE_SIZE (4)
Index: xen-4.1.2-testing/xen/arch/x86/acpi/boot.c Index: xen-4.1.3-testing/xen/arch/x86/acpi/boot.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/acpi/boot.c --- xen-4.1.3-testing.orig/xen/arch/x86/acpi/boot.c
+++ xen-4.1.2-testing/xen/arch/x86/acpi/boot.c +++ xen-4.1.3-testing/xen/arch/x86/acpi/boot.c
@@ -1006,3 +1006,47 @@ unsigned int acpi_get_processor_id(unsig @@ -1006,3 +1006,47 @@ unsigned int acpi_get_processor_id(unsig
return INVALID_ACPIID; return INVALID_ACPIID;
@ -104,10 +104,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/acpi/boot.c
+ +
+ return 0; + return 0;
+} +}
Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c Index: xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/platform_hypercall.c --- xen-4.1.3-testing.orig/xen/arch/x86/platform_hypercall.c
+++ xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c +++ xen-4.1.3-testing/xen/arch/x86/platform_hypercall.c
@@ -419,6 +419,15 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe @@ -419,6 +419,15 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
ret = -EINVAL; ret = -EINVAL;
break; break;
@ -124,11 +124,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
Index: xen-4.1.2-testing/xen/drivers/acpi/pmstat.c Index: xen-4.1.3-testing/xen/drivers/acpi/pmstat.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/drivers/acpi/pmstat.c --- xen-4.1.3-testing.orig/xen/drivers/acpi/pmstat.c
+++ xen-4.1.2-testing/xen/drivers/acpi/pmstat.c +++ xen-4.1.3-testing/xen/drivers/acpi/pmstat.c
@@ -519,3 +519,34 @@ int do_pm_op(struct xen_sysctl_pm_op *op @@ -521,3 +521,34 @@ int do_pm_op(struct xen_sysctl_pm_op *op
return ret; return ret;
} }
@ -163,10 +163,10 @@ Index: xen-4.1.2-testing/xen/drivers/acpi/pmstat.c
+ +
+ return ret; + return ret;
+} +}
Index: xen-4.1.2-testing/xen/include/acpi/cpufreq/processor_perf.h Index: xen-4.1.3-testing/xen/include/acpi/cpufreq/processor_perf.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/acpi/cpufreq/processor_perf.h --- xen-4.1.3-testing.orig/xen/include/acpi/cpufreq/processor_perf.h
+++ xen-4.1.2-testing/xen/include/acpi/cpufreq/processor_perf.h +++ xen-4.1.3-testing/xen/include/acpi/cpufreq/processor_perf.h
@@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
#include <public/platform.h> #include <public/platform.h>
@ -179,10 +179,10 @@ Index: xen-4.1.2-testing/xen/include/acpi/cpufreq/processor_perf.h
int powernow_cpufreq_init(void); int powernow_cpufreq_init(void);
unsigned int powernow_register_driver(void); unsigned int powernow_register_driver(void);
unsigned int get_measured_perf(unsigned int cpu, unsigned int flag); unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
Index: xen-4.1.2-testing/xen/include/acpi/pdc_intel.h Index: xen-4.1.3-testing/xen/include/acpi/pdc_intel.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/acpi/pdc_intel.h --- xen-4.1.3-testing.orig/xen/include/acpi/pdc_intel.h
+++ xen-4.1.2-testing/xen/include/acpi/pdc_intel.h +++ xen-4.1.3-testing/xen/include/acpi/pdc_intel.h
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
#ifndef __PDC_INTEL_H__ #ifndef __PDC_INTEL_H__
#define __PDC_INTEL_H__ #define __PDC_INTEL_H__
@ -226,10 +226,10 @@ Index: xen-4.1.2-testing/xen/include/acpi/pdc_intel.h
+ ACPI_PDC_SMP_T_SWCOORD) + ACPI_PDC_SMP_T_SWCOORD)
+ +
#endif /* __PDC_INTEL_H__ */ #endif /* __PDC_INTEL_H__ */
Index: xen-4.1.2-testing/xen/include/asm-x86/cpufeature.h Index: xen-4.1.3-testing/xen/include/asm-x86/cpufeature.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/cpufeature.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/cpufeature.h
+++ xen-4.1.2-testing/xen/include/asm-x86/cpufeature.h +++ xen-4.1.3-testing/xen/include/asm-x86/cpufeature.h
@@ -151,6 +151,10 @@ @@ -151,6 +151,10 @@
#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)
#define cpufeat_mask(idx) (1u << ((idx) & 31)) #define cpufeat_mask(idx) (1u << ((idx) & 31))
@ -241,10 +241,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/cpufeature.h
#ifdef __i386__ #ifdef __i386__
#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME) #define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)
#define cpu_has_de boot_cpu_has(X86_FEATURE_DE) #define cpu_has_de boot_cpu_has(X86_FEATURE_DE)
Index: xen-4.1.2-testing/xen/include/public/platform.h Index: xen-4.1.3-testing/xen/include/public/platform.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/platform.h --- xen-4.1.3-testing.orig/xen/include/public/platform.h
+++ xen-4.1.2-testing/xen/include/public/platform.h +++ xen-4.1.3-testing/xen/include/public/platform.h
@@ -304,6 +304,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim @@ -304,6 +304,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim
#define XEN_PM_CX 0 #define XEN_PM_CX 0
#define XEN_PM_PX 1 #define XEN_PM_PX 1
@ -261,10 +261,10 @@ Index: xen-4.1.2-testing/xen/include/public/platform.h
} u; } u;
}; };
typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
Index: xen-4.1.2-testing/xen/include/xen/acpi.h Index: xen-4.1.3-testing/xen/include/xen/acpi.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/acpi.h --- xen-4.1.3-testing.orig/xen/include/xen/acpi.h
+++ xen-4.1.2-testing/xen/include/xen/acpi.h +++ xen-4.1.3-testing/xen/include/xen/acpi.h
@@ -334,6 +334,8 @@ static inline int acpi_boot_table_init(v @@ -334,6 +334,8 @@ static inline int acpi_boot_table_init(v
#endif /*!CONFIG_ACPI_BOOT*/ #endif /*!CONFIG_ACPI_BOOT*/

View File

@ -1,82 +0,0 @@
References: bnc#683580
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1314443678 -3600
# Node ID e17f70940d1f57fe04dde3bf4e243f75c89f0d0e
# Parent 4705eca37c9fac9d13867a856bdcfa8b7bad56c6
x86: work around certain Intel BIOSes causing (transient) hangs during boot
They apparently leave the USB legacy emulation bits set in ICH10's
SMI Control and Enable register, but fail to handle the resulting SMIs
gracefully. The hangs can apparently extend indefinitely, but are
commonly observed to last between a few seconds and a minute.
This assumes that only ICH10-based systems on Intel main boards with
Intel BIOS may be affected. Until Intel comes up with a more precise
identification of affected BIOSes, all Intel ones on Intel boards
will get this workaround applied.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/dmi_scan.c
+++ xen-4.1.2-testing/xen/arch/x86/dmi_scan.c
@@ -10,6 +10,8 @@
#include <asm/system.h>
#include <xen/dmi.h>
#include <xen/efi.h>
+#include <xen/pci.h>
+#include <xen/pci_regs.h>
#define bt_ioremap(b,l) ((void *)__acpi_map_table(b,l))
#define bt_iounmap(b,l) ((void)0)
@@ -278,6 +280,28 @@ static __init int broken_toshiba_keyboar
return 0;
}
+static int __init ich10_bios_quirk(struct dmi_system_id *d)
+{
+ u32 port, smictl;
+
+ if ( pci_conf_read16(0, 0x1f, 0, PCI_VENDOR_ID) != 0x8086 )
+ return 0;
+
+ switch ( pci_conf_read16(0, 0x1f, 0, PCI_DEVICE_ID) ) {
+ case 0x3a14:
+ case 0x3a16:
+ case 0x3a18:
+ case 0x3a1a:
+ port = (pci_conf_read16(0, 0x1f, 0, 0x40) & 0xff80) + 0x30;
+ smictl = inl(port);
+ /* turn off LEGACY_USB{,2}_EN if enabled */
+ if ( smictl & 0x20008 )
+ outl(smictl & ~0x20008, port);
+ break;
+ }
+
+ return 0;
+}
#ifdef CONFIG_ACPI_SLEEP
static __init int reset_videomode_after_s3(struct dmi_blacklist *d)
@@ -363,6 +387,18 @@ static __initdata struct dmi_blacklist d
} },
#endif
+ { ich10_bios_quirk, "Intel board & BIOS",
+ /*
+ * BIOS leaves legacy USB emulation enabled while
+ * SMM can't properly handle it.
+ */
+ {
+ MATCH(DMI_BOARD_VENDOR, "Intel Corp"),
+ MATCH(DMI_BIOS_VENDOR, "Intel Corp"),
+ NO_MATCH, NO_MATCH
+ }
+ },
+
#ifdef CONFIG_ACPI_BOOT
/*
* If your system is blacklisted here, but you find that acpi=force

View File

@ -11,9 +11,11 @@ currently counted.
Signed-off-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Kevin Tian <kevin.tian@intel.com>
--- a/xen/arch/x86/apic.c Index: xen-4.1.3-testing/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c ===================================================================
@@ -1372,6 +1372,7 @@ fastcall void smp_apic_timer_interrupt(s --- xen-4.1.3-testing.orig/xen/arch/x86/apic.c
+++ xen-4.1.3-testing/xen/arch/x86/apic.c
@@ -1378,6 +1378,7 @@ fastcall void smp_apic_timer_interrupt(s
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
ack_APIC_irq(); ack_APIC_irq();
perfc_incr(apic_timer); perfc_incr(apic_timer);
@ -21,7 +23,7 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
raise_softirq(TIMER_SOFTIRQ); raise_softirq(TIMER_SOFTIRQ);
set_irq_regs(old_regs); set_irq_regs(old_regs);
} }
@@ -1393,6 +1394,7 @@ fastcall void smp_spurious_interrupt(str @@ -1399,6 +1400,7 @@ fastcall void smp_spurious_interrupt(str
unsigned long v; unsigned long v;
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
@ -29,7 +31,7 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
irq_enter(); irq_enter();
/* /*
@@ -1428,6 +1430,7 @@ fastcall void smp_error_interrupt(struct @@ -1434,6 +1436,7 @@ fastcall void smp_error_interrupt(struct
unsigned long v, v1; unsigned long v, v1;
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
@ -37,7 +39,7 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
irq_enter(); irq_enter();
/* First tickle the hardware, only then report what went on. -- REW */ /* First tickle the hardware, only then report what went on. -- REW */
v = apic_read(APIC_ESR); v = apic_read(APIC_ESR);
@@ -1459,6 +1462,7 @@ fastcall void smp_pmu_apic_interrupt(str @@ -1465,6 +1468,7 @@ fastcall void smp_pmu_apic_interrupt(str
{ {
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
ack_APIC_irq(); ack_APIC_irq();
@ -45,8 +47,10 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
hvm_do_pmu_interrupt(regs); hvm_do_pmu_interrupt(regs);
set_irq_regs(old_regs); set_irq_regs(old_regs);
} }
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -66,6 +66,7 @@ static void (*vendor_thermal_interrupt)( @@ -66,6 +66,7 @@ static void (*vendor_thermal_interrupt)(
fastcall void smp_thermal_interrupt(struct cpu_user_regs *regs) fastcall void smp_thermal_interrupt(struct cpu_user_regs *regs)
{ {
@ -63,9 +67,11 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
irq_enter(); irq_enter();
mctc = mcheck_mca_logout( mctc = mcheck_mca_logout(
--- a/xen/arch/x86/io_apic.c Index: xen-4.1.3-testing/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c ===================================================================
@@ -529,6 +529,7 @@ fastcall void smp_irq_move_cleanup_inter --- xen-4.1.3-testing.orig/xen/arch/x86/io_apic.c
+++ xen-4.1.3-testing/xen/arch/x86/io_apic.c
@@ -516,6 +516,7 @@ fastcall void smp_irq_move_cleanup_inter
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
ack_APIC_irq(); ack_APIC_irq();
@ -73,9 +79,11 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
irq_enter(); irq_enter();
me = smp_processor_id(); me = smp_processor_id();
--- a/xen/arch/x86/smp.c Index: xen-4.1.3-testing/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c ===================================================================
@@ -221,6 +221,7 @@ fastcall void smp_invalidate_interrupt(v --- xen-4.1.3-testing.orig/xen/arch/x86/smp.c
+++ xen-4.1.3-testing/xen/arch/x86/smp.c
@@ -222,6 +222,7 @@ fastcall void smp_invalidate_interrupt(v
{ {
ack_APIC_irq(); ack_APIC_irq();
perfc_incr(ipis); perfc_incr(ipis);
@ -83,7 +91,7 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
irq_enter(); irq_enter();
if ( !__sync_local_execstate() || if ( !__sync_local_execstate() ||
(flush_flags & (FLUSH_TLB_GLOBAL | FLUSH_CACHE)) ) (flush_flags & (FLUSH_TLB_GLOBAL | FLUSH_CACHE)) )
@@ -385,6 +386,7 @@ fastcall void smp_event_check_interrupt( @@ -387,6 +388,7 @@ fastcall void smp_event_check_interrupt(
struct cpu_user_regs *old_regs = set_irq_regs(regs); struct cpu_user_regs *old_regs = set_irq_regs(regs);
ack_APIC_irq(); ack_APIC_irq();
perfc_incr(ipis); perfc_incr(ipis);
@ -91,7 +99,7 @@ Signed-off-by: Kevin Tian <kevin.tian@intel.com>
set_irq_regs(old_regs); set_irq_regs(old_regs);
} }
@@ -421,6 +423,7 @@ fastcall void smp_call_function_interrup @@ -423,6 +425,7 @@ fastcall void smp_call_function_interrup
ack_APIC_irq(); ack_APIC_irq();
perfc_incr(ipis); perfc_incr(ipis);

View File

@ -37,10 +37,10 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
xen/include/xen/sched.h | 1 + xen/include/xen/sched.h | 1 +
5 files changed, 15 insertions(+), 8 deletions(-) 5 files changed, 15 insertions(+), 8 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
@@ -37,8 +37,6 @@ @@ -37,8 +37,6 @@
#define mem_event_ring_lock(_d) spin_lock(&(_d)->mem_event.ring_lock) #define mem_event_ring_lock(_d) spin_lock(&(_d)->mem_event.ring_lock)
#define mem_event_ring_unlock(_d) spin_unlock(&(_d)->mem_event.ring_lock) #define mem_event_ring_unlock(_d) spin_unlock(&(_d)->mem_event.ring_lock)
@ -94,10 +94,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
if ( (curr->domain->domain_id == d->domain_id) && ring_full ) if ( (curr->domain->domain_id == d->domain_id) && ring_full )
{ {
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_sharing.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
@@ -322,7 +322,6 @@ static struct page_info* mem_sharing_all @@ -322,7 +322,6 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
} }
@ -106,11 +106,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c
if(mem_event_check_ring(d)) return page; if(mem_event_check_ring(d)) return page;
req.gfn = gfn; req.gfn = gfn;
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2970,6 +2970,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2976,6 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{ {
/* gfn is already on its way back and vcpu is not paused */ /* gfn is already on its way back and vcpu is not paused */
@ -118,10 +118,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return; return;
} }
Index: xen-4.1.2-testing/xen/include/asm-x86/mem_event.h Index: xen-4.1.3-testing/xen/include/asm-x86/mem_event.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/mem_event.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/mem_event.h
+++ xen-4.1.2-testing/xen/include/asm-x86/mem_event.h +++ xen-4.1.3-testing/xen/include/asm-x86/mem_event.h
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
/* Pauses VCPU while marking pause flag for mem event */ /* Pauses VCPU while marking pause flag for mem event */
void mem_event_mark_and_pause(struct vcpu *v); void mem_event_mark_and_pause(struct vcpu *v);
@ -130,10 +130,10 @@ Index: xen-4.1.2-testing/xen/include/asm-x86/mem_event.h
void mem_event_put_request(struct domain *d, mem_event_request_t *req); void mem_event_put_request(struct domain *d, mem_event_request_t *req);
void mem_event_get_response(struct domain *d, mem_event_response_t *rsp); void mem_event_get_response(struct domain *d, mem_event_response_t *rsp);
void mem_event_unpause_vcpus(struct domain *d); void mem_event_unpause_vcpus(struct domain *d);
Index: xen-4.1.2-testing/xen/include/xen/sched.h Index: xen-4.1.3-testing/xen/include/xen/sched.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h --- xen-4.1.3-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h +++ xen-4.1.3-testing/xen/include/xen/sched.h
@@ -190,6 +190,7 @@ struct mem_event_domain @@ -190,6 +190,7 @@ struct mem_event_domain
{ {
/* ring lock */ /* ring lock */

View File

@ -1,22 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315320580 -3600
# Node ID 5fe770c8a8a35c58893816ee6335a90ed43f3bbd
# Parent 0268e73809532a4a3ca18a075efcee3c62caf458
docs: Fix 'make docs'
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/docs/src/user.tex
===================================================================
--- xen-4.1.2-testing.orig/docs/src/user.tex
+++ xen-4.1.2-testing/docs/src/user.tex
@@ -4197,7 +4197,7 @@ writing to the VGA console after domain
\item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of
vcpu migration in microseconds (default 0). This parameter avoids agressive
vcpu migration. For example, the linux kernel uses 0.5ms by default.
-\item [ irq_vector_map=xxx ] Enable irq vector non-sharing maps. Setting 'global'
+\item [ irq\_vector\_map=xxx ] Enable irq vector non-sharing maps. Setting 'global'
will ensure that no IRQs will share vectors. Setting 'per-device' will ensure
that no IRQs from the same device will share vectors. Setting to 'none' will
disable it entirely, overriding any defaults the IOMMU code may set.

View File

@ -25,11 +25,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/include/asm-x86/mem_event.h | 8 +-- xen/include/asm-x86/mem_event.h | 8 +--
5 files changed, 66 insertions(+), 65 deletions(-) 5 files changed, 66 insertions(+), 65 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/hvm.c --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c +++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
@@ -3909,7 +3909,7 @@ static int hvm_memory_event_traps(long p @@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p
if ( (p & HVMPME_onchangeonly) && (value == old) ) if ( (p & HVMPME_onchangeonly) && (value == old) )
return 1; return 1;
@ -38,7 +38,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
if ( rc ) if ( rc )
return rc; return rc;
@@ -3932,7 +3932,7 @@ static int hvm_memory_event_traps(long p @@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p
req.gla_valid = 1; req.gla_valid = 1;
} }
@ -47,10 +47,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
return 1; return 1;
} }
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
@@ -33,21 +33,21 @@ @@ -33,21 +33,21 @@
#define xen_rmb() rmb() #define xen_rmb() rmb()
#define xen_wmb() wmb() #define xen_wmb() wmb()
@ -271,10 +271,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
} }
break; break;
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_sharing.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all @@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
} }
@ -299,11 +299,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c
/* Unpause domain/vcpu */ /* Unpause domain/vcpu */
if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2923,7 +2923,7 @@ void p2m_mem_paging_drop_page(struct p2m @@ -2929,7 +2929,7 @@ void p2m_mem_paging_drop_page(struct p2m
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -312,7 +312,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
{ {
/* Send release notification to pager */ /* Send release notification to pager */
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -2931,7 +2931,7 @@ void p2m_mem_paging_drop_page(struct p2m @@ -2937,7 +2937,7 @@ void p2m_mem_paging_drop_page(struct p2m
req.gfn = gfn; req.gfn = gfn;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -321,7 +321,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
} }
@@ -2943,7 +2943,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2949,7 +2949,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -330,7 +330,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return; return;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -2970,7 +2970,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2976,7 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{ {
/* gfn is already on its way back and vcpu is not paused */ /* gfn is already on its way back and vcpu is not paused */
@ -339,7 +339,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return; return;
} }
@@ -2979,7 +2979,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2985,7 +2985,7 @@ void p2m_mem_paging_populate(struct p2m_
req.p2mt = p2mt; req.p2mt = p2mt;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -348,7 +348,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
@@ -3008,7 +3008,7 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3014,7 +3014,7 @@ void p2m_mem_paging_resume(struct p2m_do
mfn_t mfn; mfn_t mfn;
/* Pull the response off the ring */ /* Pull the response off the ring */
@ -357,7 +357,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Fix p2m entry if the page was not dropped */ /* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -3055,7 +3055,7 @@ void p2m_mem_access_check(unsigned long @@ -3061,7 +3061,7 @@ void p2m_mem_access_check(paddr_t gpa, b
p2m_unlock(p2m); p2m_unlock(p2m);
/* Otherwise, check if there is a memory event listener, and send the message along */ /* Otherwise, check if there is a memory event listener, and send the message along */
@ -366,7 +366,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
if ( res < 0 ) if ( res < 0 )
{ {
/* No listener */ /* No listener */
@@ -3099,7 +3099,7 @@ void p2m_mem_access_check(unsigned long @@ -3105,7 +3105,7 @@ void p2m_mem_access_check(paddr_t gpa, b
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -375,7 +375,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* VCPU paused, mem event request sent */ /* VCPU paused, mem event request sent */
} }
@@ -3109,7 +3109,7 @@ void p2m_mem_access_resume(struct p2m_do @@ -3115,7 +3115,7 @@ void p2m_mem_access_resume(struct p2m_do
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
mem_event_response_t rsp; mem_event_response_t rsp;
@ -384,10 +384,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Unpause domain */ /* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
Index: xen-4.1.2-testing/xen/include/asm-x86/mem_event.h Index: xen-4.1.3-testing/xen/include/asm-x86/mem_event.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/asm-x86/mem_event.h --- xen-4.1.3-testing.orig/xen/include/asm-x86/mem_event.h
+++ xen-4.1.2-testing/xen/include/asm-x86/mem_event.h +++ xen-4.1.3-testing/xen/include/asm-x86/mem_event.h
@@ -26,10 +26,10 @@ @@ -26,10 +26,10 @@
/* Pauses VCPU while marking pause flag for mem event */ /* Pauses VCPU while marking pause flag for mem event */

View File

@ -45,10 +45,10 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/include/xen/sched.h | 6 + xen/include/xen/sched.h | 6 +
15 files changed, 206 insertions(+), 156 deletions(-) 15 files changed, 206 insertions(+), 156 deletions(-)
Index: xen-4.1.2-testing/tools/libxc/Makefile Index: xen-4.1.3-testing/tools/libxc/Makefile
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/Makefile --- xen-4.1.3-testing.orig/tools/libxc/Makefile
+++ xen-4.1.2-testing/tools/libxc/Makefile +++ xen-4.1.3-testing/tools/libxc/Makefile
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
XEN_ROOT = $(CURDIR)/../.. XEN_ROOT = $(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk include $(XEN_ROOT)/tools/Rules.mk
@ -58,10 +58,10 @@ Index: xen-4.1.2-testing/tools/libxc/Makefile
MINOR = 0 MINOR = 0
CTRL_SRCS-y := CTRL_SRCS-y :=
Index: xen-4.1.2-testing/tools/libxc/xc_mem_access.c Index: xen-4.1.3-testing/tools/libxc/xc_mem_access.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_access.c --- xen-4.1.3-testing.orig/tools/libxc/xc_mem_access.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_access.c +++ xen-4.1.3-testing/tools/libxc/xc_mem_access.c
@@ -24,12 +24,29 @@ @@ -24,12 +24,29 @@
#include "xc_private.h" #include "xc_private.h"
@ -94,10 +94,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_mem_access.c
} }
/* /*
Index: xen-4.1.2-testing/tools/libxc/xc_mem_event.c Index: xen-4.1.3-testing/tools/libxc/xc_mem_event.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_event.c --- xen-4.1.3-testing.orig/tools/libxc/xc_mem_event.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_event.c +++ xen-4.1.3-testing/tools/libxc/xc_mem_event.c
@@ -42,18 +42,3 @@ int xc_mem_event_control(xc_interface *x @@ -42,18 +42,3 @@ int xc_mem_event_control(xc_interface *x
return do_domctl(xch, &domctl); return do_domctl(xch, &domctl);
} }
@ -117,10 +117,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_mem_event.c
- NULL, NULL, INVALID_MFN); - NULL, NULL, INVALID_MFN);
-} -}
- -
Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c Index: xen-4.1.3-testing/tools/libxc/xc_mem_paging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_mem_paging.c --- xen-4.1.3-testing.orig/tools/libxc/xc_mem_paging.c
+++ xen-4.1.2-testing/tools/libxc/xc_mem_paging.c +++ xen-4.1.3-testing/tools/libxc/xc_mem_paging.c
@@ -24,36 +24,53 @@ @@ -24,36 +24,53 @@
#include "xc_private.h" #include "xc_private.h"
@ -183,10 +183,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_mem_paging.c
} }
Index: xen-4.1.2-testing/tools/libxc/xc_memshr.c Index: xen-4.1.3-testing/tools/libxc/xc_memshr.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_memshr.c --- xen-4.1.3-testing.orig/tools/libxc/xc_memshr.c
+++ xen-4.1.2-testing/tools/libxc/xc_memshr.c +++ xen-4.1.3-testing/tools/libxc/xc_memshr.c
@@ -36,7 +36,7 @@ int xc_memshr_control(xc_interface *xch, @@ -36,7 +36,7 @@ int xc_memshr_control(xc_interface *xch,
domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION; domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
domctl.domain = (domid_t)domid; domctl.domain = (domid_t)domid;
@ -259,10 +259,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_memshr.c
op->u.debug.u.gref = gref; op->u.debug.u.gref = gref;
return do_domctl(xch, &domctl); return do_domctl(xch, &domctl);
Index: xen-4.1.2-testing/tools/libxc/xenctrl.h Index: xen-4.1.3-testing/tools/libxc/xenctrl.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h --- xen-4.1.3-testing.orig/tools/libxc/xenctrl.h
+++ xen-4.1.2-testing/tools/libxc/xenctrl.h +++ xen-4.1.3-testing/tools/libxc/xenctrl.h
@@ -1734,16 +1734,19 @@ int xc_mem_event_control(xc_interface *x @@ -1734,16 +1734,19 @@ int xc_mem_event_control(xc_interface *x
unsigned int mode, void *shared_page, unsigned int mode, void *shared_page,
void *ring_page, unsigned long gfn); void *ring_page, unsigned long gfn);
@ -286,10 +286,10 @@ Index: xen-4.1.2-testing/tools/libxc/xenctrl.h
int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, int xc_mem_access_resume(xc_interface *xch, domid_t domain_id,
unsigned long gfn); unsigned long gfn);
Index: xen-4.1.2-testing/tools/tests/xen-access/xen-access.c Index: xen-4.1.3-testing/tools/tests/xen-access/xen-access.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/tests/xen-access/xen-access.c --- xen-4.1.3-testing.orig/tools/tests/xen-access/xen-access.c
+++ xen-4.1.2-testing/tools/tests/xen-access/xen-access.c +++ xen-4.1.3-testing/tools/tests/xen-access/xen-access.c
@@ -241,7 +241,7 @@ xenaccess_t *xenaccess_init(xc_interface @@ -241,7 +241,7 @@ xenaccess_t *xenaccess_init(xc_interface
mem_event_ring_lock_init(&xenaccess->mem_event); mem_event_ring_lock_init(&xenaccess->mem_event);
@ -308,10 +308,10 @@ Index: xen-4.1.2-testing/tools/tests/xen-access/xen-access.c
if ( rc != 0 ) if ( rc != 0 )
{ {
ERROR("Error tearing down domain xenaccess in xen"); ERROR("Error tearing down domain xenaccess in xen");
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c
@@ -234,7 +234,7 @@ static xenpaging_t *xenpaging_init(domid @@ -234,7 +234,7 @@ static xenpaging_t *xenpaging_init(domid
PAGE_SIZE); PAGE_SIZE);
@ -330,10 +330,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
if ( rc != 0 ) if ( rc != 0 )
{ {
ERROR("Error tearing down domain paging in xen"); ERROR("Error tearing down domain paging in xen");
Index: xen-4.1.2-testing/xen/arch/ia64/xen/dom0_ops.c Index: xen-4.1.3-testing/xen/arch/ia64/xen/dom0_ops.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/ia64/xen/dom0_ops.c --- xen-4.1.3-testing.orig/xen/arch/ia64/xen/dom0_ops.c
+++ xen-4.1.2-testing/xen/arch/ia64/xen/dom0_ops.c +++ xen-4.1.3-testing/xen/arch/ia64/xen/dom0_ops.c
@@ -688,7 +688,7 @@ long arch_do_domctl(xen_domctl_t *op, XE @@ -688,7 +688,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
switch(mec->op) switch(mec->op)
@ -343,11 +343,11 @@ Index: xen-4.1.2-testing/xen/arch/ia64/xen/dom0_ops.c
{ {
if (mec->u.enable) { if (mec->u.enable) {
ret = -EINVAL; /* not implemented */ ret = -EINVAL; /* not implemented */
Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/hvm/hvm.c --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c +++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
@@ -3909,7 +3909,7 @@ static int hvm_memory_event_traps(long p @@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p
if ( (p & HVMPME_onchangeonly) && (value == old) ) if ( (p & HVMPME_onchangeonly) && (value == old) )
return 1; return 1;
@ -356,7 +356,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
if ( rc ) if ( rc )
return rc; return rc;
@@ -3932,7 +3932,7 @@ static int hvm_memory_event_traps(long p @@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p
req.gla_valid = 1; req.gla_valid = 1;
} }
@ -365,10 +365,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/hvm/hvm.c
return 1; return 1;
} }
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_event.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
@@ -37,24 +37,52 @@ @@ -37,24 +37,52 @@
#define mem_event_ring_lock(_med) spin_lock(&(_med)->ring_lock) #define mem_event_ring_lock(_med) spin_lock(&(_med)->ring_lock)
#define mem_event_ring_unlock(_med) spin_unlock(&(_med)->ring_lock) #define mem_event_ring_unlock(_med) spin_unlock(&(_med)->ring_lock)
@ -588,10 +588,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_event.c
} }
return rc; return rc;
Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/mem_sharing.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c +++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all @@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
} }
@ -688,11 +688,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/mem_sharing.c
{ {
grant_ref_t gref = mec->u.debug.u.gref; grant_ref_t gref = mec->u.debug.u.gref;
rc = mem_sharing_debug_gref(d, gref); rc = mem_sharing_debug_gref(d, gref);
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2923,7 +2923,7 @@ void p2m_mem_paging_drop_page(struct p2m @@ -2929,7 +2929,7 @@ void p2m_mem_paging_drop_page(struct p2m
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -701,7 +701,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
{ {
/* Send release notification to pager */ /* Send release notification to pager */
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -2931,7 +2931,7 @@ void p2m_mem_paging_drop_page(struct p2m @@ -2937,7 +2937,7 @@ void p2m_mem_paging_drop_page(struct p2m
req.gfn = gfn; req.gfn = gfn;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -710,7 +710,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
} }
@@ -2943,7 +2943,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2949,7 +2949,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -719,7 +719,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return; return;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -2970,7 +2970,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2976,7 +2976,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{ {
/* gfn is already on its way back and vcpu is not paused */ /* gfn is already on its way back and vcpu is not paused */
@ -728,7 +728,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return; return;
} }
@@ -2979,7 +2979,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2985,7 +2985,7 @@ void p2m_mem_paging_populate(struct p2m_
req.p2mt = p2mt; req.p2mt = p2mt;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -737,7 +737,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
@@ -3008,7 +3008,7 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3014,7 +3014,7 @@ void p2m_mem_paging_resume(struct p2m_do
mfn_t mfn; mfn_t mfn;
/* Pull the response off the ring */ /* Pull the response off the ring */
@ -746,7 +746,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Fix p2m entry if the page was not dropped */ /* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -3055,7 +3055,7 @@ void p2m_mem_access_check(unsigned long @@ -3061,7 +3061,7 @@ void p2m_mem_access_check(paddr_t gpa, b
p2m_unlock(p2m); p2m_unlock(p2m);
/* Otherwise, check if there is a memory event listener, and send the message along */ /* Otherwise, check if there is a memory event listener, and send the message along */
@ -755,7 +755,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
if ( res < 0 ) if ( res < 0 )
{ {
/* No listener */ /* No listener */
@@ -3099,7 +3099,7 @@ void p2m_mem_access_check(unsigned long @@ -3105,7 +3105,7 @@ void p2m_mem_access_check(paddr_t gpa, b
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -764,7 +764,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* VCPU paused, mem event request sent */ /* VCPU paused, mem event request sent */
} }
@@ -3109,7 +3109,7 @@ void p2m_mem_access_resume(struct p2m_do @@ -3115,7 +3115,7 @@ void p2m_mem_access_resume(struct p2m_do
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
mem_event_response_t rsp; mem_event_response_t rsp;
@ -773,10 +773,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Unpause domain */ /* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
Index: xen-4.1.2-testing/xen/include/public/domctl.h Index: xen-4.1.3-testing/xen/include/public/domctl.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/domctl.h --- xen-4.1.3-testing.orig/xen/include/public/domctl.h
+++ xen-4.1.2-testing/xen/include/public/domctl.h +++ xen-4.1.3-testing/xen/include/public/domctl.h
@@ -707,20 +707,18 @@ struct xen_domctl_gdbsx_domstatus { @@ -707,20 +707,18 @@ struct xen_domctl_gdbsx_domstatus {
/* XEN_DOMCTL_mem_event_op */ /* XEN_DOMCTL_mem_event_op */
@ -848,10 +848,10 @@ Index: xen-4.1.2-testing/xen/include/public/domctl.h
#define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID (-10) #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID (-10)
#define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID (-9) #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID (-9)
Index: xen-4.1.2-testing/xen/include/xen/sched.h Index: xen-4.1.3-testing/xen/include/xen/sched.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h --- xen-4.1.3-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h +++ xen-4.1.3-testing/xen/include/xen/sched.h
@@ -326,8 +326,12 @@ struct domain @@ -326,8 +326,12 @@ struct domain
/* Non-migratable and non-restoreable? */ /* Non-migratable and non-restoreable? */
bool_t disable_migrate; bool_t disable_migrate;

View File

@ -1,61 +0,0 @@
# HG changeset patch
# User Shan Haitao <haitao.shan@intel.com>
# Date 1316300518 -3600
# Node ID b78235de5c6407023759f9bbf723dd83887fedf0
# Parent c944e82bb092925f31403a129087e9d40e0fa06a
Fix PV CPUID virtualization of XSave
The patch will fix XSave CPUID virtualization for PV guests. The XSave
area size returned by CPUID leaf D is changed dynamically depending on
the XCR0. Tools/libxc only assigns a static value. The fix will adjust
xsave area size during runtime.
Note: This fix is already in HVM cpuid virtualization. And Dom0 is not
affected, either.
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2310,7 +2310,7 @@ void hvm_cpuid(unsigned int input, unsig
{
/* reset EBX to default value first */
*ebx = XSAVE_AREA_MIN_SIZE;
- for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ )
+ for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
{
if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) )
continue;
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -768,6 +768,30 @@ static void pv_cpuid(struct cpu_user_reg
{
if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
domain_cpuid(current->domain, a, c, &a, &b, &c, &d);
+
+ switch ( a )
+ {
+ case 0xd:
+ {
+ unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+ /* EBX value of main leaf 0 depends on enabled xsave features */
+ if ( c == 0 && current->arch.xcr0 )
+ {
+ /* reset EBX to default value first */
+ b = XSAVE_AREA_MIN_SIZE;
+ for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
+ {
+ if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
+ continue;
+ domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
+ &_edx);
+ if ( (_eax + _ebx) > b )
+ b = _eax + _ebx;
+ }
+ }
+ break;
+ }
+ }
goto out;
}

View File

@ -28,10 +28,10 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/include/xen/sched.h | 1 + xen/include/xen/sched.h | 1 +
6 files changed, 11 insertions(+), 1 deletion(-) 6 files changed, 11 insertions(+), 1 deletion(-)
Index: xen-4.1.2-testing/tools/libxc/xc_domain.c Index: xen-4.1.3-testing/tools/libxc/xc_domain.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xc_domain.c --- xen-4.1.3-testing.orig/tools/libxc/xc_domain.c
+++ xen-4.1.2-testing/tools/libxc/xc_domain.c +++ xen-4.1.3-testing/tools/libxc/xc_domain.c
@@ -235,6 +235,7 @@ int xc_domain_getinfo(xc_interface *xch, @@ -235,6 +235,7 @@ int xc_domain_getinfo(xc_interface *xch,
info->ssidref = domctl.u.getdomaininfo.ssidref; info->ssidref = domctl.u.getdomaininfo.ssidref;
info->nr_pages = domctl.u.getdomaininfo.tot_pages; info->nr_pages = domctl.u.getdomaininfo.tot_pages;
@ -40,10 +40,10 @@ Index: xen-4.1.2-testing/tools/libxc/xc_domain.c
info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10); info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10);
info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame; info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
info->cpu_time = domctl.u.getdomaininfo.cpu_time; info->cpu_time = domctl.u.getdomaininfo.cpu_time;
Index: xen-4.1.2-testing/tools/libxc/xenctrl.h Index: xen-4.1.3-testing/tools/libxc/xenctrl.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/libxc/xenctrl.h --- xen-4.1.3-testing.orig/tools/libxc/xenctrl.h
+++ xen-4.1.2-testing/tools/libxc/xenctrl.h +++ xen-4.1.3-testing/tools/libxc/xenctrl.h
@@ -353,6 +353,7 @@ typedef struct xc_dominfo { @@ -353,6 +353,7 @@ typedef struct xc_dominfo {
unsigned int shutdown_reason; /* only meaningful if shutdown==1 */ unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
unsigned long nr_pages; /* current number, not maximum */ unsigned long nr_pages; /* current number, not maximum */
@ -52,11 +52,11 @@ Index: xen-4.1.2-testing/tools/libxc/xenctrl.h
unsigned long shared_info_frame; unsigned long shared_info_frame;
uint64_t cpu_time; uint64_t cpu_time;
unsigned long max_memkb; unsigned long max_memkb;
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2913,6 +2913,9 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2919,6 +2919,9 @@ int p2m_mem_paging_evict(struct p2m_doma
/* Put the page back so it gets freed */ /* Put the page back so it gets freed */
put_page(page); put_page(page);
@ -66,7 +66,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return 0; return 0;
} }
@@ -2997,6 +3000,8 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3003,6 +3006,8 @@ int p2m_mem_paging_prep(struct p2m_domai
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
p2m_unlock(p2m); p2m_unlock(p2m);
@ -75,10 +75,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return 0; return 0;
} }
Index: xen-4.1.2-testing/xen/common/domctl.c Index: xen-4.1.3-testing/xen/common/domctl.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/common/domctl.c --- xen-4.1.3-testing.orig/xen/common/domctl.c
+++ xen-4.1.2-testing/xen/common/domctl.c +++ xen-4.1.3-testing/xen/common/domctl.c
@@ -139,6 +139,7 @@ void getdomaininfo(struct domain *d, str @@ -139,6 +139,7 @@ void getdomaininfo(struct domain *d, str
info->tot_pages = d->tot_pages; info->tot_pages = d->tot_pages;
info->max_pages = d->max_pages; info->max_pages = d->max_pages;
@ -87,10 +87,10 @@ Index: xen-4.1.2-testing/xen/common/domctl.c
info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT); info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT);
BUG_ON(SHARED_M2P(info->shared_info_frame)); BUG_ON(SHARED_M2P(info->shared_info_frame));
Index: xen-4.1.2-testing/xen/include/public/domctl.h Index: xen-4.1.3-testing/xen/include/public/domctl.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/domctl.h --- xen-4.1.3-testing.orig/xen/include/public/domctl.h
+++ xen-4.1.2-testing/xen/include/public/domctl.h +++ xen-4.1.3-testing/xen/include/public/domctl.h
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
#include "xen.h" #include "xen.h"
#include "grant_table.h" #include "grant_table.h"
@ -108,10 +108,10 @@ Index: xen-4.1.2-testing/xen/include/public/domctl.h
uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */ uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
uint64_aligned_t cpu_time; uint64_aligned_t cpu_time;
uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
Index: xen-4.1.2-testing/xen/include/xen/sched.h Index: xen-4.1.3-testing/xen/include/xen/sched.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h --- xen-4.1.3-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h +++ xen-4.1.3-testing/xen/include/xen/sched.h
@@ -215,6 +215,7 @@ struct domain @@ -215,6 +215,7 @@ struct domain
unsigned int tot_pages; /* number of pages currently possesed */ unsigned int tot_pages; /* number of pages currently possesed */
unsigned int max_pages; /* maximum value for tot_pages */ unsigned int max_pages; /* maximum value for tot_pages */

View File

@ -1,89 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1317730526 -7200
# Node ID e09ebf7a31f55bb26c3cce7695a435ed20adf05b
# Parent a99d75671a911f9c0d5d11e0fe88a0a65863cb44
introduce xzalloc() & Co
Rather than having to match a call to one of the xmalloc() flavors with
a subsequent memset(), introduce a zeroing variant of each of those
flavors.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/common/xmalloc_tlsf.c
+++ b/xen/common/xmalloc_tlsf.c
@@ -585,6 +585,13 @@ void *_xmalloc(unsigned long size, unsig
return p;
}
+void *_xzalloc(unsigned long size, unsigned long align)
+{
+ void *p = _xmalloc(size, align);
+
+ return p ? memset(p, 0, size) : p;
+}
+
void xfree(void *p)
{
struct bhdr *b;
--- a/xen/include/acpi/platform/aclinux.h
+++ b/xen/include/acpi/platform/aclinux.h
@@ -77,10 +77,7 @@
#define acpi_thread_id struct vcpu *
#define ACPI_ALLOCATE(a) xmalloc_bytes(a)
-#define ACPI_ALLOCATE_ZEROED(a) ({ \
- void *p = xmalloc_bytes(a); \
- if ( p ) memset(p, 0, a); \
- p; })
+#define ACPI_ALLOCATE_ZEROED(a) xzalloc_bytes(a)
#define ACPI_FREE(a) xfree(a)
#endif /* __ACLINUX_H__ */
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -8,19 +8,25 @@
/* Allocate space for typed object. */
#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
+#define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))
/* Allocate space for array of typed objects. */
#define xmalloc_array(_type, _num) \
((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xzalloc_array(_type, _num) \
+ ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
/* Allocate untyped storage. */
-#define xmalloc_bytes(_bytes) (_xmalloc(_bytes, SMP_CACHE_BYTES))
+#define xmalloc_bytes(_bytes) _xmalloc(_bytes, SMP_CACHE_BYTES)
+#define xzalloc_bytes(_bytes) _xzalloc(_bytes, SMP_CACHE_BYTES)
/* Free any of the above. */
extern void xfree(void *);
/* Underlying functions */
extern void *_xmalloc(unsigned long size, unsigned long align);
+extern void *_xzalloc(unsigned long size, unsigned long align);
+
static inline void *_xmalloc_array(
unsigned long size, unsigned long align, unsigned long num)
{
@@ -30,6 +36,15 @@ static inline void *_xmalloc_array(
return _xmalloc(size * num, align);
}
+static inline void *_xzalloc_array(
+ unsigned long size, unsigned long align, unsigned long num)
+{
+ /* Check for overflow. */
+ if (size && num > UINT_MAX / size)
+ return NULL;
+ return _xzalloc(size * num, align);
+}
+
/*
* Pooled allocator interface.
*/

View File

@ -18,11 +18,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 25 ++++++++++++++++--------- xen/arch/x86/mm/p2m.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-) 1 file changed, 16 insertions(+), 9 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2839,10 +2839,11 @@ int p2m_mem_paging_nominate(struct p2m_d @@ -2845,10 +2845,11 @@ int p2m_mem_paging_nominate(struct p2m_d
{ {
struct page_info *page; struct page_info *page;
p2m_type_t p2mt; p2m_type_t p2mt;
@ -35,7 +35,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Check if mfn is valid */ /* Check if mfn is valid */
ret = -EINVAL; ret = -EINVAL;
@@ -2869,7 +2870,7 @@ int p2m_mem_paging_nominate(struct p2m_d @@ -2875,7 +2876,7 @@ int p2m_mem_paging_nominate(struct p2m_d
/* Fix p2m entry */ /* Fix p2m entry */
p2m_lock(p2m); p2m_lock(p2m);
@ -44,7 +44,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
p2m_unlock(p2m); p2m_unlock(p2m);
@@ -2883,11 +2884,12 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2889,11 +2890,12 @@ int p2m_mem_paging_evict(struct p2m_doma
{ {
struct page_info *page; struct page_info *page;
p2m_type_t p2mt; p2m_type_t p2mt;
@ -58,7 +58,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
if ( unlikely(!mfn_valid(mfn)) ) if ( unlikely(!mfn_valid(mfn)) )
return -EINVAL; return -EINVAL;
@@ -2906,7 +2908,7 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2912,7 +2914,7 @@ int p2m_mem_paging_evict(struct p2m_doma
/* Remove mapping from p2m table */ /* Remove mapping from p2m table */
p2m_lock(p2m); p2m_lock(p2m);
@ -67,7 +67,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
p2m_unlock(p2m); p2m_unlock(p2m);
@@ -2943,6 +2945,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2949,6 +2951,7 @@ void p2m_mem_paging_populate(struct p2m_
struct vcpu *v = current; struct vcpu *v = current;
mem_event_request_t req; mem_event_request_t req;
p2m_type_t p2mt; p2m_type_t p2mt;
@ -75,7 +75,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@@ -2955,11 +2958,11 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2961,11 +2964,11 @@ void p2m_mem_paging_populate(struct p2m_
/* Fix p2m mapping */ /* Fix p2m mapping */
/* XXX: It seems inefficient to have this here, as it's only needed /* XXX: It seems inefficient to have this here, as it's only needed
* in one case (ept guest accessing paging out page) */ * in one case (ept guest accessing paging out page) */
@ -89,7 +89,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
p2m_unlock(p2m); p2m_unlock(p2m);
} }
@@ -2988,7 +2991,10 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2994,7 +2997,10 @@ void p2m_mem_paging_populate(struct p2m_
int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct page_info *page; struct page_info *page;
@ -100,7 +100,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Get a free page */ /* Get a free page */
page = alloc_domheap_page(p2m->domain, 0); page = alloc_domheap_page(p2m->domain, 0);
if ( unlikely(page == NULL) ) if ( unlikely(page == NULL) )
@@ -2996,7 +3002,7 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3002,7 +3008,7 @@ int p2m_mem_paging_prep(struct p2m_domai
/* Fix p2m mapping */ /* Fix p2m mapping */
p2m_lock(p2m); p2m_lock(p2m);
@ -109,7 +109,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
p2m_unlock(p2m); p2m_unlock(p2m);
@@ -3010,6 +3016,7 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3016,6 +3022,7 @@ void p2m_mem_paging_resume(struct p2m_do
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
mem_event_response_t rsp; mem_event_response_t rsp;
p2m_type_t p2mt; p2m_type_t p2mt;
@ -117,7 +117,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
mfn_t mfn; mfn_t mfn;
/* Pull the response off the ring */ /* Pull the response off the ring */
@@ -3018,9 +3025,9 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3024,9 +3031,9 @@ void p2m_mem_paging_resume(struct p2m_do
/* Fix p2m entry if the page was not dropped */ /* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
{ {

View File

@ -17,11 +17,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 42 ++++++++++++++++++++++++++---------------- xen/arch/x86/mm/p2m.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-) 1 file changed, 26 insertions(+), 16 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2843,6 +2843,8 @@ int p2m_mem_paging_nominate(struct p2m_d @@ -2849,6 +2849,8 @@ int p2m_mem_paging_nominate(struct p2m_d
mfn_t mfn; mfn_t mfn;
int ret; int ret;
@ -30,7 +30,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query); mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query);
/* Check if mfn is valid */ /* Check if mfn is valid */
@@ -2869,14 +2871,12 @@ int p2m_mem_paging_nominate(struct p2m_d @@ -2875,14 +2877,12 @@ int p2m_mem_paging_nominate(struct p2m_d
goto out; goto out;
/* Fix p2m entry */ /* Fix p2m entry */
@ -46,7 +46,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
return ret; return ret;
} }
@@ -2887,30 +2887,31 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2893,30 +2893,31 @@ int p2m_mem_paging_evict(struct p2m_doma
p2m_access_t a; p2m_access_t a;
mfn_t mfn; mfn_t mfn;
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
@ -83,7 +83,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Put the page back so it gets freed */ /* Put the page back so it gets freed */
put_page(page); put_page(page);
@@ -2918,7 +2919,11 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2924,7 +2925,11 @@ int p2m_mem_paging_evict(struct p2m_doma
/* Track number of paged gfns */ /* Track number of paged gfns */
atomic_inc(&p2m->domain->paged_pages); atomic_inc(&p2m->domain->paged_pages);
@ -96,7 +96,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn)
@@ -2958,14 +2963,14 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2964,14 +2969,14 @@ void p2m_mem_paging_populate(struct p2m_
/* Fix p2m mapping */ /* Fix p2m mapping */
/* XXX: It seems inefficient to have this here, as it's only needed /* XXX: It seems inefficient to have this here, as it's only needed
* in one case (ept guest accessing paging out page) */ * in one case (ept guest accessing paging out page) */
@ -113,7 +113,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Pause domain */ /* Pause domain */
if ( v->domain->domain_id == d->domain_id ) if ( v->domain->domain_id == d->domain_id )
@@ -2993,22 +2998,27 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -2999,22 +3004,27 @@ int p2m_mem_paging_prep(struct p2m_domai
struct page_info *page; struct page_info *page;
p2m_type_t p2mt; p2m_type_t p2mt;
p2m_access_t a; p2m_access_t a;
@ -145,7 +145,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
} }
void p2m_mem_paging_resume(struct p2m_domain *p2m) void p2m_mem_paging_resume(struct p2m_domain *p2m)
@@ -3025,8 +3035,8 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3031,8 +3041,8 @@ void p2m_mem_paging_resume(struct p2m_do
/* Fix p2m entry if the page was not dropped */ /* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
{ {

View File

@ -20,11 +20,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 2 -- xen/arch/x86/mm/p2m.c | 2 --
1 file changed, 2 deletions(-) 1 file changed, 2 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2961,8 +2961,6 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2967,8 +2967,6 @@ void p2m_mem_paging_populate(struct p2m_
req.type = MEM_EVENT_TYPE_PAGING; req.type = MEM_EVENT_TYPE_PAGING;
/* Fix p2m mapping */ /* Fix p2m mapping */

View File

@ -1,85 +0,0 @@
changeset: 23908:88b6e08b8aa8
user: Olaf Hering <olaf@aepfle.de>
date: Thu Oct 06 14:15:43 2011 +0100
files: xen/arch/x86/mm/p2m.c
description:
p2m: query/modify p2mt with p2m_lock held
Query and update the p2mt in set_mmio_p2m_entry, clear_mmio_p2m_entry
and set_shared_p2m_entry with the p2m_lock held.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---
xen/arch/x86/mm/p2m.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
@@ -2751,9 +2751,11 @@ set_mmio_p2m_entry(struct p2m_domain *p2
if ( !paging_mode_translate(p2m->domain) )
return 0;
+ p2m_lock(p2m);
omfn = gfn_to_mfn_query(p2m, gfn, &ot);
if ( p2m_is_grant(ot) )
{
+ p2m_unlock(p2m);
domain_crash(p2m->domain);
return 0;
}
@@ -2764,7 +2766,6 @@ set_mmio_p2m_entry(struct p2m_domain *p2
}
P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
- p2m_lock(p2m);
rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_mmio_direct, p2m->default_access);
audit_p2m(p2m, 1);
p2m_unlock(p2m);
@@ -2785,18 +2786,20 @@ clear_mmio_p2m_entry(struct p2m_domain *
if ( !paging_mode_translate(p2m->domain) )
return 0;
- mfn = gfn_to_mfn(p2m, gfn, &t);
+ p2m_lock(p2m);
+ mfn = gfn_to_mfn_query(p2m, gfn, &t);
/* Do not use mfn_valid() here as it will usually fail for MMIO pages. */
if ( (INVALID_MFN == mfn_x(mfn)) || (t != p2m_mmio_direct) )
{
gdprintk(XENLOG_ERR,
"clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn);
- return 0;
+ goto out;
}
- p2m_lock(p2m);
rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
audit_p2m(p2m, 1);
+
+out:
p2m_unlock(p2m);
return rc;
@@ -2813,6 +2816,8 @@ set_shared_p2m_entry(struct p2m_domain *
if ( !paging_mode_translate(p2m->domain) )
return 0;
+ if ( need_lock )
+ p2m_lock(p2m);
omfn = gfn_to_mfn_query(p2m, gfn, &ot);
/* At the moment we only allow p2m change if gfn has already been made
* sharable first */
@@ -2822,8 +2827,6 @@ set_shared_p2m_entry(struct p2m_domain *
set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
- if ( need_lock )
- p2m_lock(p2m);
rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared, p2m->default_access);
if ( need_lock )
p2m_unlock(p2m);

View File

@ -1,33 +0,0 @@
# HG changeset patch
# User Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1317976335 -7200
# Node ID 08d6ba4e447d6c13c6dfac5c23e84b73961cb109
# Parent 159be83e5fe9111bb30d8b1f83127f5724d44424
x86/AMD: Do not enable ARAT feature on AMD processors below family 0x12
Determining whether an AMD processor is affected by erratum 400 may
have some corner cases and handling these cases is somewhat complicated.
In the interest of simplicity we won't claim ARAT support on processor
families below 0x12.
Mirrors Linux commit e9cdd343a5e42c43bcda01e609fa23089e026470
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -632,8 +632,11 @@ static void __devinit init_amd(struct cp
}
#endif
- /* As a rule processors have APIC timer running in deep C states */
- if (c->x86 > 0xf && !cpu_has_amd_erratum(c, AMD_ERRATUM_400))
+ /*
+ * Family 0x12 and above processors have APIC timer
+ * running in deep C states.
+ */
+ if (c->x86 > 0x11)
set_bit(X86_FEATURE_ARAT, c->x86_capability);
/* Prevent TSC drift in non single-processor, single-core platforms. */

View File

@ -23,10 +23,10 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 3 +++ xen/arch/x86/mm/p2m.c | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-) 2 files changed, 3 insertions(+), 3 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c
@@ -455,9 +455,6 @@ static int xenpaging_evict_page(xenpagin @@ -455,9 +455,6 @@ static int xenpaging_evict_page(xenpagin
goto out; goto out;
} }
@ -37,11 +37,11 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
munmap(page, PAGE_SIZE); munmap(page, PAGE_SIZE);
/* Tell Xen to evict page */ /* Tell Xen to evict page */
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2916,6 +2916,9 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2919,6 +2919,9 @@ int p2m_mem_paging_evict(struct p2m_doma
set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, a); set_p2m_entry(p2m, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged, a);
audit_p2m(p2m, 1); audit_p2m(p2m, 1);

View File

@ -13,9 +13,10 @@ Signed-off-by: Guido Gunther <agx@sigxcpu.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub Index: xen-4.1.3-testing/tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Tue Oct 11 10:46:28 2011 +0100 ===================================================================
+++ b/tools/pygrub/src/pygrub Tue Oct 11 12:02:58 2011 +0100 --- xen-4.1.3-testing.orig/tools/pygrub/src/pygrub
+++ xen-4.1.3-testing/tools/pygrub/src/pygrub
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
@ -25,7 +26,7 @@ diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
import copy import copy
import logging import logging
import platform import platform
@@ -665,7 +665,7 @@ @@ -674,7 +674,7 @@ if __name__ == "__main__":
["quiet", "interactive", "not-really", "help", ["quiet", "interactive", "not-really", "help",
"output=", "output-format=", "output-directory=", "output=", "output-format=", "output-directory=",
"entry=", "kernel=", "entry=", "kernel=",
@ -34,7 +35,7 @@ diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
except getopt.GetoptError: except getopt.GetoptError:
usage() usage()
sys.exit(1) sys.exit(1)
@@ -679,6 +679,7 @@ @@ -688,6 +688,7 @@ if __name__ == "__main__":
entry = None entry = None
interactive = True interactive = True
isconfig = False isconfig = False
@ -42,7 +43,7 @@ diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
not_really = False not_really = False
output_format = "sxp" output_format = "sxp"
output_directory = "/var/run/xend/boot" output_directory = "/var/run/xend/boot"
@@ -714,6 +715,8 @@ @@ -723,6 +724,8 @@ if __name__ == "__main__":
interactive = False interactive = False
elif o in ("--isconfig",): elif o in ("--isconfig",):
isconfig = True isconfig = True
@ -51,7 +52,7 @@ diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
elif o in ("--output-format",): elif o in ("--output-format",):
if a not in ["sxp", "simple", "simple0"]: if a not in ["sxp", "simple", "simple0"]:
print "unkonwn output format %s" % a print "unkonwn output format %s" % a
@@ -723,6 +726,9 @@ @@ -732,6 +735,9 @@ if __name__ == "__main__":
elif o in ("--output-directory",): elif o in ("--output-directory",):
output_directory = a output_directory = a
@ -61,7 +62,7 @@ diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
if output is None or output == "-": if output is None or output == "-":
fd = sys.stdout.fileno() fd = sys.stdout.fileno()
else: else:
@@ -769,6 +775,8 @@ @@ -778,6 +784,8 @@ if __name__ == "__main__":
except: except:
# IOErrors raised by fsimage.open # IOErrors raised by fsimage.open
# RuntimeErrors raised by run_grub if no menu.lst present # RuntimeErrors raised by run_grub if no menu.lst present

View File

@ -22,10 +22,10 @@ Acked-by: Keir Fraser <keir@xen.org>
xen/include/xen/sched.h | 2 +- xen/include/xen/sched.h | 2 +-
4 files changed, 6 insertions(+), 17 deletions(-) 4 files changed, 6 insertions(+), 17 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c Index: xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c --- xen-4.1.3-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c
+++ xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c +++ xen-4.1.3-testing/xen/arch/x86/cpu/mcheck/vmce.c
@@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val) @@ -304,7 +304,6 @@ int vmce_wrmsr(u32 msr, u64 val)
int inject_vmce(struct domain *d) int inject_vmce(struct domain *d)
{ {
@ -47,11 +47,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/cpu/mcheck/vmce.c
vcpu_kick(d->vcpu[0]); vcpu_kick(d->vcpu[0]);
} }
else else
Index: xen-4.1.2-testing/xen/arch/x86/traps.c Index: xen-4.1.3-testing/xen/arch/x86/traps.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/traps.c --- xen-4.1.3-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.2-testing/xen/arch/x86/traps.c +++ xen-4.1.3-testing/xen/arch/x86/traps.c
@@ -3104,7 +3104,6 @@ static void nmi_mce_softirq(void) @@ -3106,7 +3106,6 @@ static void nmi_mce_softirq(void)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
struct softirq_trap *st = &per_cpu(softirq_trap, cpu); struct softirq_trap *st = &per_cpu(softirq_trap, cpu);
@ -59,7 +59,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
BUG_ON(st == NULL); BUG_ON(st == NULL);
BUG_ON(st->vcpu == NULL); BUG_ON(st->vcpu == NULL);
@@ -3120,9 +3119,7 @@ static void nmi_mce_softirq(void) @@ -3122,9 +3121,7 @@ static void nmi_mce_softirq(void)
* Make sure to wakeup the vcpu on the * Make sure to wakeup the vcpu on the
* specified processor. * specified processor.
*/ */
@ -70,7 +70,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
/* Affinity is restored in the iret hypercall. */ /* Affinity is restored in the iret hypercall. */
} }
@@ -3192,14 +3189,11 @@ void async_exception_cleanup(struct vcpu @@ -3199,14 +3196,11 @@ void async_exception_cleanup(struct vcpu
!test_and_set_bool(curr->mce_pending) ) !test_and_set_bool(curr->mce_pending) )
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
@ -86,11 +86,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/traps.c
} }
} }
} }
Index: xen-4.1.2-testing/xen/common/schedule.c Index: xen-4.1.3-testing/xen/common/schedule.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/common/schedule.c --- xen-4.1.3-testing.orig/xen/common/schedule.c
+++ xen-4.1.2-testing/xen/common/schedule.c +++ xen-4.1.3-testing/xen/common/schedule.c
@@ -593,9 +593,9 @@ int cpu_disable_scheduler(unsigned int c @@ -598,9 +598,9 @@ int cpu_disable_scheduler(unsigned int c
return ret; return ret;
} }
@ -102,7 +102,7 @@ Index: xen-4.1.2-testing/xen/common/schedule.c
cpumask_t *online; cpumask_t *online;
if ( v->domain->is_pinned ) if ( v->domain->is_pinned )
@@ -607,9 +607,7 @@ int vcpu_set_affinity(struct vcpu *v, cp @@ -612,9 +612,7 @@ int vcpu_set_affinity(struct vcpu *v, cp
vcpu_schedule_lock_irq(v); vcpu_schedule_lock_irq(v);
@ -112,11 +112,11 @@ Index: xen-4.1.2-testing/xen/common/schedule.c
if ( !cpu_isset(v->processor, v->cpu_affinity) ) if ( !cpu_isset(v->processor, v->cpu_affinity) )
set_bit(_VPF_migrating, &v->pause_flags); set_bit(_VPF_migrating, &v->pause_flags);
Index: xen-4.1.2-testing/xen/include/xen/sched.h Index: xen-4.1.3-testing/xen/include/xen/sched.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/xen/sched.h --- xen-4.1.3-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.2-testing/xen/include/xen/sched.h +++ xen-4.1.3-testing/xen/include/xen/sched.h
@@ -623,7 +623,7 @@ void scheduler_free(struct scheduler *sc @@ -624,7 +624,7 @@ void scheduler_free(struct scheduler *sc
int schedule_cpu_switch(unsigned int cpu, struct cpupool *c); int schedule_cpu_switch(unsigned int cpu, struct cpupool *c);
void vcpu_force_reschedule(struct vcpu *v); void vcpu_force_reschedule(struct vcpu *v);
int cpu_disable_scheduler(unsigned int cpu); int cpu_disable_scheduler(unsigned int cpu);

View File

@ -35,10 +35,10 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/include/public/mem_event.h | 1 xen/include/public/mem_event.h | 1
4 files changed, 50 insertions(+), 24 deletions(-) 4 files changed, 50 insertions(+), 24 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c
@@ -734,10 +734,12 @@ int main(int argc, char *argv[]) @@ -734,10 +734,12 @@ int main(int argc, char *argv[])
} }
else else
@ -56,11 +56,11 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
/* Tell Xen to resume the vcpu */ /* Tell Xen to resume the vcpu */
/* XXX: Maybe just check if the vcpu was paused? */ /* XXX: Maybe just check if the vcpu was paused? */
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -3502,7 +3502,7 @@ int do_mmu_update( @@ -3504,7 +3504,7 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -69,7 +69,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3543,7 +3543,7 @@ int do_mmu_update( @@ -3545,7 +3545,7 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -78,7 +78,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3572,7 +3572,7 @@ int do_mmu_update( @@ -3574,7 +3574,7 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -87,7 +87,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3602,7 +3602,7 @@ int do_mmu_update( @@ -3604,7 +3604,7 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -96,11 +96,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2899,15 +2899,24 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2902,15 +2902,24 @@ int p2m_mem_paging_evict(struct p2m_doma
if ( unlikely(!mfn_valid(mfn)) ) if ( unlikely(!mfn_valid(mfn)) )
goto out; goto out;
@ -127,7 +127,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
/* Decrement guest domain's ref count of the page */ /* Decrement guest domain's ref count of the page */
if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
put_page(page); put_page(page);
@@ -2919,14 +2928,15 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2922,14 +2931,15 @@ int p2m_mem_paging_evict(struct p2m_doma
/* Clear content before returning the page to Xen */ /* Clear content before returning the page to Xen */
scrub_one_page(page); scrub_one_page(page);
@ -146,7 +146,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
out: out:
p2m_unlock(p2m); p2m_unlock(p2m);
return ret; return ret;
@@ -2957,6 +2967,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2960,6 +2970,7 @@ void p2m_mem_paging_populate(struct p2m_
mem_event_request_t req; mem_event_request_t req;
p2m_type_t p2mt; p2m_type_t p2mt;
p2m_access_t a; p2m_access_t a;
@ -154,7 +154,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@@ -2968,20 +2979,26 @@ void p2m_mem_paging_populate(struct p2m_ @@ -2971,20 +2982,26 @@ void p2m_mem_paging_populate(struct p2m_
/* Fix p2m mapping */ /* Fix p2m mapping */
p2m_lock(p2m); p2m_lock(p2m);
@ -186,7 +186,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{ {
/* gfn is already on its way back and vcpu is not paused */ /* gfn is already on its way back and vcpu is not paused */
@@ -3002,19 +3019,25 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3005,19 +3022,25 @@ int p2m_mem_paging_prep(struct p2m_domai
struct page_info *page; struct page_info *page;
p2m_type_t p2mt; p2m_type_t p2mt;
p2m_access_t a; p2m_access_t a;
@ -218,10 +218,10 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
audit_p2m(p2m, 1); audit_p2m(p2m, 1);
atomic_dec(&p2m->domain->paged_pages); atomic_dec(&p2m->domain->paged_pages);
Index: xen-4.1.2-testing/xen/include/public/mem_event.h Index: xen-4.1.3-testing/xen/include/public/mem_event.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/include/public/mem_event.h --- xen-4.1.3-testing.orig/xen/include/public/mem_event.h
+++ xen-4.1.2-testing/xen/include/public/mem_event.h +++ xen-4.1.3-testing/xen/include/public/mem_event.h
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
/* Memory event flags */ /* Memory event flags */
#define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0) #define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0)

View File

@ -1,45 +0,0 @@
# HG changeset patch
# User Shan Haitao <haitao.shan@intel.com>
# Date 1318517935 -3600
# Node ID bbde1453cbd95d6d36febe9c552f9cfa26b5c49e
# Parent c1bd53fac3d5e5868352894d62dbacd6de0b0e7a
x86: Further fixes for xsave leaf in pv_cpuid().
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -766,16 +766,18 @@ static void pv_cpuid(struct cpu_user_reg
if ( current->domain->domain_id != 0 )
{
+ unsigned int cpuid_leaf = a, sub_leaf = c;
+
if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
domain_cpuid(current->domain, a, c, &a, &b, &c, &d);
- switch ( a )
+ switch ( cpuid_leaf )
{
case 0xd:
{
- unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+ unsigned int _eax, _ebx, _ecx, _edx;
/* EBX value of main leaf 0 depends on enabled xsave features */
- if ( c == 0 && current->arch.xcr0 )
+ if ( sub_leaf == 0 && current->arch.xcr0 )
{
/* reset EBX to default value first */
b = XSAVE_AREA_MIN_SIZE;
@@ -783,8 +785,8 @@ static void pv_cpuid(struct cpu_user_reg
{
if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
continue;
- domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
- &_edx);
+ domain_cpuid(current->domain, cpuid_leaf, sub_leaf,
+ &_eax, &_ebx, &_ecx, &_edx);
if ( (_eax + _ebx) > b )
b = _eax + _ebx;
}

View File

@ -19,11 +19,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 20 ++++++++++++++++---- xen/arch/x86/mm/p2m.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-) 1 file changed, 16 insertions(+), 4 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -3020,16 +3020,22 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3023,16 +3023,22 @@ int p2m_mem_paging_prep(struct p2m_domai
p2m_type_t p2mt; p2m_type_t p2mt;
p2m_access_t a; p2m_access_t a;
mfn_t mfn; mfn_t mfn;
@ -47,7 +47,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
page = alloc_domheap_page(p2m->domain, 0); page = alloc_domheap_page(p2m->domain, 0);
if ( unlikely(page == NULL) ) if ( unlikely(page == NULL) )
goto out; goto out;
@@ -3064,9 +3070,15 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3067,9 +3073,15 @@ void p2m_mem_paging_resume(struct p2m_do
{ {
p2m_lock(p2m); p2m_lock(p2m);
mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query); mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query);

View File

@ -17,11 +17,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/p2m.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/mm/p2m.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+) 1 file changed, 93 insertions(+)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2838,6 +2838,24 @@ set_shared_p2m_entry(struct p2m_domain * @@ -2841,6 +2841,24 @@ set_shared_p2m_entry(struct p2m_domain *
} }
#ifdef __x86_64__ #ifdef __x86_64__
@ -46,7 +46,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
int p2m_mem_paging_nominate(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_nominate(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct page_info *page; struct page_info *page;
@@ -2883,6 +2901,25 @@ int p2m_mem_paging_nominate(struct p2m_d @@ -2886,6 +2904,25 @@ int p2m_mem_paging_nominate(struct p2m_d
return ret; return ret;
} }
@ -72,7 +72,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
int p2m_mem_paging_evict(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_evict(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct page_info *page; struct page_info *page;
@@ -2942,6 +2979,15 @@ int p2m_mem_paging_evict(struct p2m_doma @@ -2945,6 +2982,15 @@ int p2m_mem_paging_evict(struct p2m_doma
return ret; return ret;
} }
@ -88,7 +88,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn) void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct vcpu *v = current; struct vcpu *v = current;
@@ -2961,6 +3007,27 @@ void p2m_mem_paging_drop_page(struct p2m @@ -2964,6 +3010,27 @@ void p2m_mem_paging_drop_page(struct p2m
} }
} }
@ -116,7 +116,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn) void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct vcpu *v = current; struct vcpu *v = current;
@@ -3014,6 +3081,17 @@ void p2m_mem_paging_populate(struct p2m_ @@ -3017,6 +3084,17 @@ void p2m_mem_paging_populate(struct p2m_
mem_event_put_request(d, &d->mem_paging, &req); mem_event_put_request(d, &d->mem_paging, &req);
} }
@ -134,7 +134,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c
int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn) int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
{ {
struct page_info *page; struct page_info *page;
@@ -3054,6 +3132,21 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3057,6 +3135,21 @@ int p2m_mem_paging_prep(struct p2m_domai
return ret; return ret;
} }

View File

@ -24,11 +24,11 @@ there reverted).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Jan Beulich <jbeulich@novell.com>
Committed-by: Keir Fraser <keir@xen.org> Committed-by: Keir Fraser <keir@xen.org>
Index: xen-4.1.2-testing/xen/arch/x86/microcode_amd.c Index: xen-4.1.3-testing/xen/arch/x86/microcode_amd.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/microcode_amd.c --- xen-4.1.3-testing.orig/xen/arch/x86/microcode_amd.c
+++ xen-4.1.2-testing/xen/arch/x86/microcode_amd.c +++ xen-4.1.3-testing/xen/arch/x86/microcode_amd.c
@@ -76,14 +76,6 @@ static int microcode_fits(void *mc, int @@ -76,14 +76,6 @@ static int microcode_fits(const struct m
/* We should bind the task to the CPU */ /* We should bind the task to the CPU */
BUG_ON(cpu != raw_smp_processor_id()); BUG_ON(cpu != raw_smp_processor_id());
@ -43,31 +43,11 @@ Index: xen-4.1.2-testing/xen/arch/x86/microcode_amd.c
current_cpu_id = cpuid_eax(0x00000001); current_cpu_id = cpuid_eax(0x00000001);
for ( i = 0; equiv_cpu_table[i].installed_cpu != 0; i++ ) for ( i = 0; equiv_cpu_table[i].installed_cpu != 0; i++ )
@@ -96,7 +88,7 @@ static int microcode_fits(void *mc, int @@ -117,7 +109,6 @@ static int microcode_fits(const struct m
}
if ( !equiv_cpu_id )
- return 0;
+ return 0;
if ( (mc_header->processor_rev_id) != equiv_cpu_id )
{
@@ -113,8 +105,7 @@ static int microcode_fits(void *mc, int
"update with version 0x%x (current=0x%x)\n", "update with version 0x%x (current=0x%x)\n",
cpu, mc_header->patch_id, uci->cpu_sig.rev); cpu, mc_header->patch_id, uci->cpu_sig.rev);
-out: -out:
- return 0; return 1;
+ return 1;
} }
static int apply_microcode(int cpu)
@@ -289,7 +280,7 @@ static int cpu_request_microcode(int cpu
while ( (ret = get_next_ucode_from_buffer_amd(mc, buf, size, &offset)) == 0)
{
error = microcode_fits(mc, cpu);
- if (error != 0)
+ if (error <= 0)
continue;
error = apply_microcode(cpu);

View File

@ -1,53 +0,0 @@
# HG changeset patch
# User Michael Young <m.a.young@durham.ac.uk>
# Date 1319566554 -3600
# Node ID 85d7b207fabcd1cbda8f93e3937c5990f42a2cf9
# Parent f273bce1fc265b9f71879705639a0b14da03f6e1
pygrub: check all GPT partitions
On Fedora 16 the first GPT partition is a boot partition for grub2 with
the grub2 configuration in the second partition.
Check all GPT partitions for grub configuration, not just the first.
[ Also remove now-inaccurate comment. -iwj ]
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r f273bce1fc26 -r 85d7b207fabc tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Tue Oct 25 17:04:41 2011 +0100
+++ b/tools/pygrub/src/pygrub Tue Oct 25 19:15:54 2011 +0100
@@ -77,10 +77,17 @@
def get_fs_offset_gpt(file):
fd = os.open(file, os.O_RDONLY)
- # assume the first partition is an EFI system partition.
- os.lseek(fd, SECTOR_SIZE * 2, 0)
+ os.lseek(fd, SECTOR_SIZE, 0)
buf = os.read(fd, 512)
- return struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE
+ partcount = struct.unpack("<L", buf[80:84])[0]
+ partsize = struct.unpack("<L", buf[84:88])[0]
+ i = partcount
+ offsets = []
+ while i>0:
+ buf = os.read(fd, partsize)
+ offsets.append(struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE)
+ i -= 1
+ return offsets
FDISK_PART_SOLARIS=0xbf
FDISK_PART_SOLARIS_OLD=0x82
@@ -114,7 +121,9 @@
continue # no solaris magic at that offset, ignore partition
if type == FDISK_PART_GPT:
- offset = get_fs_offset_gpt(file)
+ for offset in get_fs_offset_gpt(file):
+ part_offs.append(offset)
+ break
# Active partition has 0x80 as the first byte.
# If active, prepend to front of list, otherwise append to back.

View File

@ -1,26 +0,0 @@
# HG changeset patch
# User Michael Young <m.a.young@durham.ac.uk>
# Date 1319566759 -3600
# Node ID 65679fee01778aec2dbe9988959da6b57c52d6c9
# Parent 138f707fa598340749a70a79748b01dff850b8f2
pygrub: Allow GPT partition references
The grub2 configuration file in Fedora 16 can have GPT partition
references like (hd0,gpt2) so remove the "gpt" string where necessary
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Index: xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
===================================================================
--- xen-4.1.2-testing.orig/tools/pygrub/src/GrubConf.py
+++ xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
@@ -79,6 +79,8 @@ class GrubDiskPart(object):
val = val.replace("(", "").replace(")", "")
if val[:5] == "msdos":
val = val[5:]
+ if val[:3] == "gpt":
+ val = val[3:]
self._part = int(val)
part = property(get_part, set_part)

View File

@ -1,55 +0,0 @@
# HG changeset patch
# User Michael Young <m.a.young@durham.ac.uk>
# Date 1319566806 -3600
# Node ID 152049468175f29a3792b3b60e09a841f9cd2c21
# Parent 65679fee01778aec2dbe9988959da6b57c52d6c9
pygrub: cope with configurations with submenus
The grub2 configuration file in Fedora 16 can have one or more
menuentrys in a submenu, with configuration of the form
submenu "Xen 4.1" {
menuentry ... {
...
}
}
(this example occurs when the xen hypervisor is installed on the
guest)
Ignore the submenu line and the corresponding }
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Index: xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
===================================================================
--- xen-4.1.2-testing.orig/tools/pygrub/src/GrubConf.py
+++ xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
@@ -370,6 +370,7 @@ class Grub2ConfigFile(_GrubConfigFile):
in_function = False
img = None
title = ""
+ menu_level=0
for l in lines:
l = l.strip()
# skip blank lines
@@ -396,10 +397,18 @@ class Grub2ConfigFile(_GrubConfigFile):
img = []
title = title_match.group(1)
continue
-
+
+ if l.startswith("submenu"):
+ menu_level += 1
+ continue
+
if l.startswith("}"):
if img is None:
- raise RuntimeError, "syntax error: closing brace without menuentry"
+ if menu_level > 0:
+ menu_level -= 1
+ continue
+ else:
+ raise RuntimeError, "syntax error: closing brace without menuentry"
self.add_image(Grub2Image(title, img))
img = None

View File

@ -1,28 +0,0 @@
# HG changeset patch
# User Michael Young <m.a.young@durham.ac.uk>
# Date 1319566865 -3600
# Node ID 979bc34d0ad0369e42c70f66a39952e4b6b9b613
# Parent 152049468175f29a3792b3b60e09a841f9cd2c21
pyrgrub: cope with configurations with set default="${saved_entry}" line
Fedora 16 grub2 configuration file can have lines like
set default="${saved_entry}"
and a string containing an integer is expected
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Index: xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
===================================================================
--- xen-4.1.2-testing.orig/tools/pygrub/src/GrubConf.py
+++ xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
@@ -425,6 +425,8 @@ class Grub2ConfigFile(_GrubConfigFile):
if self.commands.has_key(com):
if self.commands[com] is not None:
+ if arg.strip() == "${saved_entry}":
+ arg = "0"
setattr(self, self.commands[com], arg.strip())
else:
logging.info("Ignored directive %s" %(com,))

View File

@ -15,11 +15,11 @@ Committed-by: Keir Fraser <keir@xen.org>
xen/arch/x86/mm/p2m.c | 2 +- xen/arch/x86/mm/p2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm/p2m.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.2-testing/xen/arch/x86/mm/p2m.c +++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -3060,7 +3060,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -3063,7 +3063,7 @@ void p2m_mem_paging_populate(struct p2m_
p2m_unlock(p2m); p2m_unlock(p2m);
/* Pause domain if request came from guest and gfn has paging type */ /* Pause domain if request came from guest and gfn has paging type */

View File

@ -1,67 +0,0 @@
# HG changeset patch
# User Jean Guyader <jean.guyader@eu.citrix.com>
# Date 1321002862 -3600
# Node ID a095cf28f2b6eeb8f5873c18eb18d4d7e5544e2c
# Parent 6534da595d695a4f2af12a64e46fb06219a0e4bc
Hypercall continuation cancelation in compat mode for XENMEM_get/set_pod_target
If copy_to_guest failed in the compat code after a continuation as been
done in the native code we need to cancel it so we won't reexecute the
hypercall but return from the hypercall with the appropriate error.
Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1585,6 +1585,24 @@ void sync_vcpu_execstate(struct vcpu *v)
__arg; \
})
+void hypercall_cancel_continuation(void)
+{
+ struct cpu_user_regs *regs = guest_cpu_user_regs();
+ struct mc_state *mcs = &current->mc_state;
+
+ if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
+ {
+ __clear_bit(_MCSF_call_preempted, &mcs->flags);
+ }
+ else
+ {
+ if ( !is_hvm_vcpu(current) )
+ regs->eip += 2; /* skip re-execute 'syscall' / 'int $xx' */
+ else
+ current->arch.hvm_vcpu.hcall_preempted = 0;
+ }
+}
+
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...)
{
--- a/xen/arch/x86/x86_64/compat/mm.c
+++ b/xen/arch/x86/x86_64/compat/mm.c
@@ -133,7 +133,11 @@ int compat_arch_memory_op(int op, XEN_GU
XLAT_pod_target(&cmp, nat);
if ( copy_to_guest(arg, &cmp, 1) )
+ {
+ if ( rc == __HYPERVISOR_memory_op )
+ hypercall_cancel_continuation();
rc = -EFAULT;
+ }
break;
}
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -560,6 +560,7 @@ void startup_cpu_idle_loop(void);
*/
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...);
+void hypercall_cancel_continuation(void);
#define hypercall_preempt_check() (unlikely( \
softirq_pending(smp_processor_id()) | \

View File

@ -14,9 +14,11 @@ be revisited, but ideally without producing per-CPU messages again).
Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org> Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/acpi/cpu_idle.c Index: xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c ===================================================================
@@ -659,6 +659,8 @@ static int acpi_processor_ffh_cstate_pro --- xen-4.1.3-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.1.3-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -654,6 +654,8 @@ static int acpi_processor_ffh_cstate_pro
unsigned int edx_part; unsigned int edx_part;
unsigned int cstate_type; /* C-state type and not ACPI C-state type */ unsigned int cstate_type; /* C-state type and not ACPI C-state type */
unsigned int num_cstate_subtype; unsigned int num_cstate_subtype;
@ -25,7 +27,7 @@ Acked-by: Keir Fraser <keir@xen.org>
if ( c->cpuid_level < CPUID_MWAIT_LEAF ) if ( c->cpuid_level < CPUID_MWAIT_LEAF )
{ {
@@ -667,8 +669,9 @@ static int acpi_processor_ffh_cstate_pro @@ -662,8 +664,9 @@ static int acpi_processor_ffh_cstate_pro
} }
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
@ -37,7 +39,7 @@ Acked-by: Keir Fraser <keir@xen.org>
/* Check whether this particular cx_type (in CST) is supported or not */ /* Check whether this particular cx_type (in CST) is supported or not */
cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1; cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1;
@@ -676,15 +679,16 @@ static int acpi_processor_ffh_cstate_pro @@ -671,15 +674,16 @@ static int acpi_processor_ffh_cstate_pro
num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) ) if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) )

View File

@ -12,8 +12,10 @@ Turn up the log level on various (mostly debug-only) messages.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org> Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/microcode_amd.c Index: xen-4.1.3-testing/xen/arch/x86/microcode_amd.c
+++ b/xen/arch/x86/microcode_amd.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/microcode_amd.c
+++ xen-4.1.3-testing/xen/arch/x86/microcode_amd.c
@@ -59,7 +59,7 @@ static int collect_cpu_info(int cpu, str @@ -59,7 +59,7 @@ static int collect_cpu_info(int cpu, str
rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev); rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev);
@ -23,7 +25,7 @@ Acked-by: Keir Fraser <keir@xen.org>
csig->rev); csig->rev);
return 0; return 0;
@@ -92,7 +92,7 @@ static int microcode_fits(void *mc, int @@ -96,7 +96,7 @@ static int microcode_fits(const struct m
if ( (mc_header->processor_rev_id) != equiv_cpu_id ) if ( (mc_header->processor_rev_id) != equiv_cpu_id )
{ {
@ -32,31 +34,30 @@ Acked-by: Keir Fraser <keir@xen.org>
"(patch is %x, cpu base id is %x) \n", "(patch is %x, cpu base id is %x) \n",
cpu, mc_header->processor_rev_id, equiv_cpu_id); cpu, mc_header->processor_rev_id, equiv_cpu_id);
return -EINVAL; return -EINVAL;
@@ -101,7 +101,7 @@ static int microcode_fits(void *mc, int @@ -105,7 +105,7 @@ static int microcode_fits(const struct m
if ( mc_header->patch_id <= uci->cpu_sig.rev ) if ( mc_header->patch_id <= uci->cpu_sig.rev )
return -EINVAL; return 0;
- printk(KERN_INFO "microcode: CPU%d found a matching microcode " - printk(KERN_INFO "microcode: CPU%d found a matching microcode "
+ printk(KERN_DEBUG "microcode: CPU%d found a matching microcode " + printk(KERN_DEBUG "microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n", "update with version 0x%x (current=0x%x)\n",
cpu, mc_header->patch_id, uci->cpu_sig.rev); cpu, mc_header->patch_id, uci->cpu_sig.rev);
@@ -139,8 +139,7 @@ static int apply_microcode(int cpu) @@ -148,7 +148,7 @@ static int apply_microcode(int cpu)
return -EIO; return -EIO;
} }
- printk("microcode: CPU%d updated from revision " - printk("microcode: CPU%d updated from revision "
- "0x%x to 0x%x \n", + printk(KERN_INFO "microcode: CPU%d updated from revision "
+ printk(KERN_INFO "microcode: CPU%d updated from revision %#x to %#x\n", "0x%x to 0x%x \n",
cpu, uci->cpu_sig.rev, mc_amd->hdr.patch_id); cpu, uci->cpu_sig.rev, hdr->patch_id);
uci->cpu_sig.rev = rev; @@ -179,7 +179,7 @@ static int get_next_ucode_from_buffer_am
@@ -173,7 +172,7 @@ static int get_next_ucode_from_buffer_am return -EINVAL;
}
total_size = (unsigned long) (bufp[off+4] + (bufp[off+5] << 8)); - printk(KERN_INFO "microcode: size %lu, total_size %u, offset %ld\n",
+ printk(KERN_DEBUG "microcode: size %lu, total_size %u, offset %ld\n",
bufsize, mpbuf->len, off);
- printk(KERN_INFO "microcode: size %lu, total_size %lu, offset %ld\n", if ( (off + mpbuf->len) > bufsize )
+ printk(KERN_DEBUG "microcode: size %lu, total_size %lu, offset %ld\n",
(unsigned long)size, total_size, off);
if ( (off + total_size) > size )

View File

@ -1,77 +0,0 @@
# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1321035275 0
# Node ID 0844b17df7a9dd885e98e505f14fc99c1951b483
# Parent 3622d7fae14dfc2d00f378738ace3b65ee65b6cc
Revert c/s 23666:b96f8bdcaa15 KEXEC: disconnect all PCI devices from the PCI bus on crash
It turns out that this causes all mannor of problems on certain
motherboards (so far with no pattern I can discern)
Problems include:
* Hanging forever checking hlt instruction.
* Panics when trying to change switch root device
* Drivers hanging when trying to check for interrupts.
From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -28,7 +28,6 @@
#include <asm/apic.h>
#include <asm/io_apic.h>
#include <xen/iommu.h>
-#include <xen/pci.h>
#include <asm/hpet.h>
static atomic_t waiting_for_crash_ipi;
@@ -83,8 +82,6 @@ static void nmi_shootdown_cpus(void)
msecs--;
}
- disconnect_pci_devices();
-
/* Crash shutdown any IOMMU functionality as the crashdump kernel is not
* happy when booting if interrupt/dma remapping is still enabled */
iommu_crash_shutdown();
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -518,25 +518,6 @@ int __init scan_pci_devices(void)
return 0;
}
-/* Disconnect all PCI devices from the PCI buses. From the PCI spec:
- * "When a 0 is written to [the COMMAND] register, the device is
- * logically disconnected from the PCI bus for all accesses except
- * configuration accesses. All devices are required to support
- * this base level of functionality."
- */
-void disconnect_pci_devices(void)
-{
- struct pci_dev *pdev;
-
- spin_lock(&pcidevs_lock);
-
- list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
- pci_conf_write16(pdev->bus, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
-
- spin_unlock(&pcidevs_lock);
-}
-
#ifdef SUPPORT_MSI_REMAPPING
static void dump_pci_devices(unsigned char ch)
{
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -94,8 +94,6 @@ int pci_remove_device(u8 bus, u8 devfn);
struct pci_dev *pci_get_pdev(int bus, int devfn);
struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
-void disconnect_pci_devices(void);
-
uint8_t pci_conf_read8(
unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
uint16_t pci_conf_read16(

View File

@ -1,95 +0,0 @@
# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1321363478 -3600
# Node ID cd3ef25f207a3925f1f8650c227e24f839da13ad
# Parent 848049b14ec7fbd28bd4cd756e01609698b60c7a
xen: avoid crash enabling turbo mode
On a system which has not had P-state information pushed down into the
hypervisor running "xenpm enable-turbo-mode" will reliably crash the host.
(XEN) PM OP 38 on CPU0
(XEN) ----[ Xen-4.2-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN) RFLAGS: 0000000000010297 CONTEXT: hypervisor
(XEN) rax: 0000000000000000 rbx: ffff82c48029fe40 rcx: 0000000000000000
(XEN) rdx: 0000000000000000 rsi: 000000000000000a rdi: 0000000000000000
(XEN) rbp: ffff82c48029fd08 rsp: ffff82c48029fd08 r8: 0000000000000004
(XEN) r9: 0000000000000000 r10: 00000000fffffffd r11: ffff82c480218f20
(XEN) r12: ffff830106e720b0 r13: 0000000000000000 r14: ffff82c4802bff80
(XEN) r15: ffff82c48025c0e4 cr0: 000000008005003b cr4: 00000000000026f0
(XEN) cr3: 000000011f459000 cr2: 0000000000000051
(XEN) ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0000 cs: e008
(XEN) Xen stack trace from rsp=ffff82c48029fd08:
(XEN) ffff82c48029fdb8 ffff82c48014c427 ffff82c48029fd98 ffff82c48016b2d6
(XEN) ffff82c48029fdb8 ffff82c48029fd60 00000000001196c5 0000000116bbe025
(XEN) 0000000116bbe025 ffff8301196c5338 ffff82f6022d77c0 0000000000000000
(XEN) ffff82f60205edf0 0000000000000000 0000000000000000 ffff8300dffba000
(XEN) ffff82c48029fdb8 ffff82c48029ff18 0000000008050004 0000000000000000
(XEN) ffff82c4802bff80 ffff82c48025c0e4 ffff82c48029fef8 ffff82c480124fd8
(XEN) 0000000000000000 ffff83011f48c000 0000000116bbe025 0000000000000025
(XEN) ffff82c48029fe28 0000000080167722 ffff82c48029ff08 ffff83011f48c000
(XEN) ffff82f60232d8a0 ffff8300dffba000 ffff83011f48c000 ffff82f60232d8a0
(XEN) ffff82c48029fed8 ffff82c48017296a 000000080000000c 0000000000000026
(XEN) bfb338b000000000 bfb33874bfb33868 b78988f800000000 0000008800000000
(XEN) b787a6e0b78533a0 ffffffff00000001 080487aeb7897ff4 bfb3389000000001
(XEN) b7898ab0b7889626 0000000100000000 0000000000000001 0804867800000001
(XEN) 000000000804e998 00000000b78533a0 bfb33e70bfb33a7c 0000000000000000
(XEN) 0000000000000000 ffff8300dffba000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 00007d3b7fd600c7 ffff82c48021511e
(XEN) 00000000c1002467 0000000000000023 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 00000000dbf5bef8 0000000008050004
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000023 00000000bfb33874 00000000bfb33868 0000000000000000
(XEN) Xen call trace:
(XEN) [<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN) [<ffff82c48014c427>] do_pm_op+0x884/0x8e7
(XEN) [<ffff82c480124fd8>] do_sysctl+0x6d8/0x9f0
(XEN) [<ffff82c48021511e>] compat_hypercall+0xae/0x107
(XEN)
(XEN) Pagetable walk from 0000000000000051:
(XEN) L4[0x000] = 0000000116dbc027 000000000001bd22
(XEN) L3[0x000] = 0000000119ba8027 000000000001eb36
(XEN) L2[0x000] = 0000000000000000 ffffffffffffffff
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0000]
(XEN) Faulting linear address: 0000000000000051
(XEN) ****************************************
(XEN)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -400,7 +400,7 @@ void cpufreq_enable_turbo(int cpuid)
struct cpufreq_policy *policy;
policy = per_cpu(cpufreq_cpu_policy, cpuid);
- if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+ if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
policy->turbo = CPUFREQ_TURBO_ENABLED;
}
@@ -409,7 +409,7 @@ void cpufreq_disable_turbo(int cpuid)
struct cpufreq_policy *policy;
policy = per_cpu(cpufreq_cpu_policy, cpuid);
- if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+ if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
policy->turbo = CPUFREQ_TURBO_DISABLED;
}
@@ -418,7 +418,7 @@ int cpufreq_get_turbo_status(int cpuid)
struct cpufreq_policy *policy;
policy = per_cpu(cpufreq_cpu_policy, cpuid);
- return policy->turbo;
+ return policy && policy->turbo;
}
/*********************************************************************

View File

@ -1,29 +0,0 @@
References: bnc#726332
# HG changeset patch
# User Gianluca Guida <gianluca.guida@citrix.com>
# Date 1321456773 0
# Node ID 3ecc8fef428138e4304ef11b47498981e63626b3
# Parent a5f1d3b1612bb48e1cb09dc66b0909e3613dc855
[shadow] Disable higher level pagetables early unshadow only when the "process dying" hypercall is used.
This patch fixes a performance problem in fully virtualized guests.
Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com>
Tested-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2743,8 +2743,9 @@ static inline void check_for_early_unsha
|| ( !v->domain->arch.paging.shadow.pagetable_dying_op
&& v->arch.paging.shadow.last_emulated_mfn_for_unshadow == mfn_x(gmfn) ) )
&& sh_mfn_is_a_page_table(gmfn)
- && !(mfn_to_page(gmfn)->shadow_flags
- & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64)) )
+ && (!v->domain->arch.paging.shadow.pagetable_dying_op ||
+ !(mfn_to_page(gmfn)->shadow_flags
+ & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64))) )
{
perfc_incr(shadow_early_unshadow);
sh_remove_shadows(v, gmfn, 1, 0 /* Fast, can fail to unshadow */ );

View File

@ -14,8 +14,10 @@ movnti, and cmpxchg16b.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Keir Fraser <keir@xen.org> Signed-off-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c Index: xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c
+++ xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -955,6 +955,47 @@ in_protmode( @@ -955,6 +955,47 @@ in_protmode(
return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM)); return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM));
} }
@ -64,7 +66,7 @@ Signed-off-by: Keir Fraser <keir@xen.org>
static int static int
in_longmode( in_longmode(
struct x86_emulate_ctxt *ctxt, struct x86_emulate_ctxt *ctxt,
@@ -2738,6 +2779,7 @@ x86_emulate( @@ -2741,6 +2782,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fildl", src.val); emulate_fpu_insn_memsrc("fildl", src.val);
break; break;
case 1: /* fisttp m32i */ case 1: /* fisttp m32i */
@ -72,7 +74,7 @@ Signed-off-by: Keir Fraser <keir@xen.org>
ea.bytes = 4; ea.bytes = 4;
dst = ea; dst = ea;
dst.type = OP_MEM; dst.type = OP_MEM;
@@ -2846,6 +2888,7 @@ x86_emulate( @@ -2849,6 +2891,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fldl", src.val); emulate_fpu_insn_memsrc("fldl", src.val);
break; break;
case 1: /* fisttp m64i */ case 1: /* fisttp m64i */
@ -80,7 +82,7 @@ Signed-off-by: Keir Fraser <keir@xen.org>
ea.bytes = 8; ea.bytes = 8;
dst = ea; dst = ea;
dst.type = OP_MEM; dst.type = OP_MEM;
@@ -2953,6 +2996,7 @@ x86_emulate( @@ -2956,6 +2999,7 @@ x86_emulate(
emulate_fpu_insn_memsrc("fild", src.val); emulate_fpu_insn_memsrc("fild", src.val);
break; break;
case 1: /* fisttp m16i */ case 1: /* fisttp m16i */
@ -88,7 +90,7 @@ Signed-off-by: Keir Fraser <keir@xen.org>
ea.bytes = 2; ea.bytes = 2;
dst = ea; dst = ea;
dst.type = OP_MEM; dst.type = OP_MEM;
@@ -4141,6 +4185,7 @@ x86_emulate( @@ -4144,6 +4188,7 @@ x86_emulate(
case 0xc3: /* movnti */ case 0xc3: /* movnti */
/* Ignore the non-temporal hint for now. */ /* Ignore the non-temporal hint for now. */
@ -96,7 +98,7 @@ Signed-off-by: Keir Fraser <keir@xen.org>
generate_exception_if(dst.bytes <= 2, EXC_UD, -1); generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
dst.val = src.val; dst.val = src.val;
break; break;
@@ -4151,6 +4196,8 @@ x86_emulate( @@ -4154,6 +4199,8 @@ x86_emulate(
generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1); generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1);
generate_exception_if(ea.type != OP_MEM, EXC_UD, -1); generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);

View File

@ -1,130 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321604321 -3600
# Node ID 0d50e704834fb53c6c86b8b0badd19d88e73c4ed
# Parent dbdc840f8f62db58321b5009e5e0f7833066386f
x86/IO-APIC: refine EOI-ing of migrating level interrupts
Rather than going through all IO-APICs and calling io_apic_eoi_vector()
for the vector in question, just use eoi_IO_APIC_irq().
This in turn allows to eliminate quite a bit of other code.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -69,10 +69,6 @@ int __read_mostly nr_ioapics;
#define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
-#define io_apic_eoi_vector(apic, vector) io_apic_eoi((apic), (vector), -1)
-#define io_apic_eoi_pin(apic, pin) io_apic_eoi((apic), -1, (pin))
-
-
/*
* This is performance-critical, we want to do it O(1)
*
@@ -208,21 +204,18 @@ static void ioapic_write_entry(int apic,
spin_unlock_irqrestore(&ioapic_lock, flags);
}
-/* EOI an IO-APIC entry. One of vector or pin may be -1, indicating that
- * it should be worked out using the other. This function expect that the
- * ioapic_lock is taken, and interrupts are disabled (or there is a good reason
- * not to), and that if both pin and vector are passed, that they refer to the
+/* EOI an IO-APIC entry. Vector may be zero, indicating that it should be
+ * worked out using the pin. This function expects that the ioapic_lock is
+ * being held, and interrupts are disabled (or there is a good reason not
+ * to), and that if both pin and vector are passed, that they refer to the
* same redirection entry in the IO-APIC. */
static void __io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
{
- /* Ensure some useful information is passed in */
- BUG_ON( (vector == -1 && pin == -1) );
-
/* Prefer the use of the EOI register if available */
if ( ioapic_has_eoi_reg(apic) )
{
/* If vector is unknown, read it from the IO-APIC */
- if ( vector == -1 )
+ if ( !vector )
vector = __ioapic_read_entry(apic, pin, TRUE).vector;
*(IO_APIC_BASE(apic)+16) = vector;
@@ -234,42 +227,6 @@ static void __io_apic_eoi(unsigned int a
struct IO_APIC_route_entry entry;
bool_t need_to_unmask = 0;
- /* If pin is unknown, search for it */
- if ( pin == -1 )
- {
- unsigned int p;
- for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
- {
- entry = __ioapic_read_entry(apic, p, TRUE);
- if ( entry.vector == vector )
- {
- pin = p;
- /* break; */
-
- /* Here should be a break out of the loop, but at the
- * Xen code doesn't actually prevent multiple IO-APIC
- * entries being assigned the same vector, so EOI all
- * pins which have the correct vector.
- *
- * Remove the following code when the above assertion
- * is fulfilled. */
- __io_apic_eoi(apic, vector, p);
- }
- }
-
- /* If search fails, nothing to do */
-
- /* if ( pin == -1 ) */
-
- /* Because the loop wasn't broken out of (see comment above),
- * all relevant pins have been EOI, so we can always return.
- *
- * Re-instate the if statement above when the Xen logic has been
- * fixed.*/
-
- return;
- }
-
entry = __ioapic_read_entry(apic, pin, TRUE);
if ( ! entry.mask )
@@ -296,17 +253,6 @@ static void __io_apic_eoi(unsigned int a
}
}
-/* EOI an IO-APIC entry. One of vector or pin may be -1, indicating that
- * it should be worked out using the other. This function disables interrupts
- * and takes the ioapic_lock */
-static void io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
-{
- unsigned int flags;
- spin_lock_irqsave(&ioapic_lock, flags);
- __io_apic_eoi(apic, vector, pin);
- spin_unlock_irqrestore(&ioapic_lock, flags);
-}
-
/*
* Saves all the IO-APIC RTE's
*/
@@ -1830,11 +1776,7 @@ static void end_level_ioapic_irq (unsign
/* Manually EOI the old vector if we are moving to the new */
if ( vector && i != vector )
- {
- int ioapic;
- for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
- io_apic_eoi_vector(ioapic, i);
- }
+ eoi_IO_APIC_irq(irq);
v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));

View File

@ -1,159 +0,0 @@
References: bnc#713503
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321604484 -3600
# Node ID f29b5bd6e25fd78409baa5461914c67065f7579f
# Parent 0d50e704834fb53c6c86b8b0badd19d88e73c4ed
x86/IRQ: prevent vector sharing within IO-APICs
Following the prevention of vector sharing for MSIs, this change
enforces the same within IO-APICs: Pin based interrupts use the IO-APIC
as their identifying device under the AMD IOMMU (and just like for
MSIs, only the identifying device is used to remap interrupts here,
with no regard to an interrupt's destination).
Additionally, LAPIC initiated EOIs (for level triggered interrupts) too
use only the vector for identifying which interrupts to end. While this
generally causes no significant problem (at worst an interrupt would be
re-raised without a new interrupt event actually having occurred), it
still seems better to avoid the situation.
For this second aspect, a distinction is being made between the
traditional and the directed-EOI cases: In the former, vectors should
not be shared throughout all IO-APICs in the system, while in the
latter case only individual IO-APICs need to be contrained (or, if the
firmware indicates so, sub- groups of them having the same GSI appear
at multiple pins).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -69,6 +69,34 @@ int __read_mostly nr_ioapics;
#define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
+static int apic_pin_2_gsi_irq(int apic, int pin);
+
+static vmask_t *__read_mostly vector_map[MAX_IO_APICS];
+
+static void share_vector_maps(unsigned int src, unsigned int dst)
+{
+ unsigned int pin;
+
+ if (vector_map[src] == vector_map[dst])
+ return;
+
+ bitmap_or(vector_map[src]->_bits, vector_map[src]->_bits,
+ vector_map[dst]->_bits, NR_VECTORS);
+
+ for (pin = 0; pin < nr_ioapic_registers[dst]; ++pin) {
+ int irq = apic_pin_2_gsi_irq(dst, pin);
+ struct irq_cfg *cfg;
+
+ if (irq < 0)
+ continue;
+ cfg = irq_cfg(irq);
+ if (cfg->used_vectors == vector_map[dst])
+ cfg->used_vectors = vector_map[src];
+ }
+
+ vector_map[dst] = vector_map[src];
+}
+
/*
* This is performance-critical, we want to do it O(1)
*
@@ -109,6 +137,7 @@ static void add_pin_to_irq(unsigned int
}
entry->apic = apic;
entry->pin = pin;
+ share_vector_maps(irq_2_pin[irq].apic, apic);
}
/*
@@ -124,6 +153,7 @@ static void __init replace_pin_at_irq(un
if (entry->apic == oldapic && entry->pin == oldpin) {
entry->apic = newapic;
entry->pin = newpin;
+ share_vector_maps(oldapic, newapic);
}
if (!entry->next)
break;
@@ -131,6 +161,16 @@ static void __init replace_pin_at_irq(un
}
}
+vmask_t *io_apic_get_used_vector_map(unsigned int irq)
+{
+ struct irq_pin_list *entry = irq_2_pin + irq;
+
+ if (entry->pin == -1)
+ return NULL;
+
+ return vector_map[entry->apic];
+}
+
struct IO_APIC_route_entry **alloc_ioapic_entries(void)
{
int apic;
@@ -1314,6 +1354,18 @@ static void __init enable_IO_APIC(void)
for (i = irq_2_pin_free_entry = nr_irqs_gsi; i < PIN_MAP_SIZE; i++)
irq_2_pin[i].next = i + 1;
+ if (directed_eoi_enabled) {
+ for (apic = 0; apic < nr_ioapics; apic++) {
+ vector_map[apic] = xzalloc(vmask_t);
+ BUG_ON(!vector_map[apic]);
+ }
+ } else {
+ vector_map[0] = xzalloc(vmask_t);
+ BUG_ON(!vector_map[0]);
+ for (apic = 1; apic < nr_ioapics; apic++)
+ vector_map[apic] = vector_map[0];
+ }
+
for(apic = 0; apic < nr_ioapics; apic++) {
int pin;
/* See if any of the pins is in ExtINT mode */
@@ -2479,13 +2531,12 @@ int ioapic_guest_write(unsigned long phy
}
if ( cfg->vector <= 0 || cfg->vector > LAST_DYNAMIC_VECTOR ) {
+ add_pin_to_irq(irq, apic, pin);
vector = assign_irq_vector(irq);
if ( vector < 0 )
return vector;
printk(XENLOG_INFO "allocated vector %02x for irq %d\n", vector, irq);
-
- add_pin_to_irq(irq, apic, pin);
}
spin_lock(&pcidevs_lock);
spin_lock(&dom0->event_lock);
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -403,6 +403,11 @@ static vmask_t *irq_get_used_vector_mask
}
}
}
+ else if ( IO_APIC_IRQ(irq) &&
+ opt_irq_vector_map != OPT_IRQ_VECTOR_MAP_NONE )
+ {
+ ret = io_apic_get_used_vector_map(irq);
+ }
return ret;
}
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -113,6 +113,7 @@ void setup_IO_APIC(void);
void disable_IO_APIC(void);
void print_IO_APIC(void);
void setup_ioapic_dest(void);
+vmask_t *io_apic_get_used_vector_map(unsigned int irq);
extern unsigned long io_apic_irqs;

View File

@ -1,96 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321604565 -3600
# Node ID 7b5e1cb94bfa43a9268479b9a255fb88c07e4ce2
# Parent f29b5bd6e25fd78409baa5461914c67065f7579f
x86/xsave: provide guests with finit-like environment
Without the use of xsave, guests get their initial floating point
environment set up with finit. At least NetWare actually depends on
this (in particular on all exceptions being masked), so to be
consistent set the same environment also when using xsave. This is
also in line with all SSE exceptions getting masked initially.
To avoid further fragile casts in xstate_alloc_save_area() the patch
also changes xsave_struct's fpu_see member to have actually usable
fields.
The patch was tested in its technically identical, but modified-file-
wise different 4.1.2 version.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Charles Arnold <carnold@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -92,11 +92,14 @@ void setup_fpu(struct vcpu *v)
v->fpu_dirtied = 1;
}
+#define FCW_DEFAULT 0x037f
+#define MXCSR_DEFAULT 0x1f80
+
static void init_fpu(void)
{
asm volatile ( "fninit" );
if ( cpu_has_xmm )
- load_mxcsr(0x1f80);
+ load_mxcsr(MXCSR_DEFAULT);
}
void save_init_fpu(struct vcpu *v)
@@ -287,7 +290,7 @@ void xsave_init(void)
int xsave_alloc_save_area(struct vcpu *v)
{
- void *save_area;
+ struct xsave_struct *save_area;
if ( !cpu_has_xsave || is_idle_vcpu(v) )
return 0;
@@ -300,8 +303,9 @@ int xsave_alloc_save_area(struct vcpu *v
return -ENOMEM;
memset(save_area, 0, xsave_cntxt_size);
- ((u32 *)save_area)[6] = 0x1f80; /* MXCSR */
- *(uint64_t *)(save_area + 512) = XSTATE_FP_SSE; /* XSETBV */
+ save_area->fpu_sse.fcw = FCW_DEFAULT;
+ save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+ save_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
v->arch.xsave_area = save_area;
v->arch.xcr0 = XSTATE_FP_SSE;
--- a/xen/include/asm-x86/i387.h
+++ b/xen/include/asm-x86/i387.h
@@ -37,7 +37,29 @@ bool_t xsave_enabled(const struct vcpu *
struct xsave_struct
{
- struct { char x[512]; } fpu_sse; /* FPU/MMX, SSE */
+ union { /* FPU/MMX, SSE */
+ char x[512];
+ struct {
+ uint16_t fcw;
+ uint16_t fsw;
+ uint8_t ftw;
+ uint8_t rsvd1;
+ uint16_t fop;
+ union {
+#ifdef __x86_64__
+ uint64_t addr;
+#endif
+ struct {
+ uint32_t offs;
+ uint16_t sel;
+ uint16_t rsvd;
+ };
+ } fip, fdp;
+ uint32_t mxcsr;
+ uint32_t mxcsr_mask;
+ /* data registers follow here */
+ };
+ } fpu_sse;
struct {
u64 xstate_bv;

View File

@ -1,30 +0,0 @@
References: bnc#694863
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321864171 -3600
# Node ID 9c350ab8d3ea64866421de756ab2bf3daaf63187
# Parent 335e8273a3f34a5e2972643a028f83684609f1c1
x86/vioapic: clear remote IRR when switching RTE to edge triggered mode
Xen itself (as much as Linux) relies on this behavior, so it should
also emulate it properly. Not doing so reportedly gets in the way of
kexec inside a HVM guest.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Olaf Hering <olaf@aepfle.de>
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -154,8 +154,9 @@ static void vioapic_write_redirent(
{
vlapic_adjust_i8259_target(d);
}
- else if ( (ent.fields.trig_mode == VIOAPIC_LEVEL_TRIG) &&
- !ent.fields.mask &&
+ else if ( ent.fields.trig_mode == VIOAPIC_EDGE_TRIG )
+ pent->fields.remote_irr = 0;
+ else if ( !ent.fields.mask &&
!ent.fields.remote_irr &&
hvm_irq->gsi_assert_count[idx] )
{

View File

@ -1,50 +0,0 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322148057 0
# Node ID 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
# Parent b082fdc52ad7607d93b59148fb289aafe21f294b
x86/mm/p2m: fix pod locking
The path p2m-lookup -> p2m-pt->get_entry -> 1GB PoD superpage ->
pod_demand_populate ends in the pod code performing a p2m_set_entry with
no locks held (in order to split the 1GB superpage into 512 2MB ones)
Further, it calls p2m_unlock after that, which will break the spinlock.
This patch attempts to fix that.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai
set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9,
p2m_populate_on_demand, p2m->default_access);
audit_p2m(p2m, 1);
- p2m_unlock(p2m);
return 0;
}
@@ -1602,7 +1601,8 @@ pod_retry_l3:
{
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
}
else
@@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru
/* The read has succeeded, so we know that mapping exists */
if ( q != p2m_query )
{
- if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+ if ( !p2m_pod_check_and_populate(p2m, gfn,
+ (l1_pgentry_t *) &l3e, 18, q) )
goto pod_retry_l3;
p2mt = p2m_invalid;
printk("%s: Allocate 1GB failed!\n", __func__);

View File

@ -1,25 +0,0 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322148057 0
# Node ID 6b3d8250ee2c63d90680c142549123a4b1559f55
# Parent 7da681c490e0a8a2b3f1fb311d254dc7ce618a43
x86/mm: change return code for log-dirty disabling
Disabling log dirty mode in HAP always returns -EINVAL. Make it
return the correct rc on success.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -710,6 +710,8 @@ int hap_domctl(struct domain *d, xen_dom
return rc;
case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
sc->mb = hap_get_allocation(d);
+ /* Fall through... */
+ case XEN_DOMCTL_SHADOW_OP_OFF:
return 0;
default:
HAP_ERROR("Bad hap domctl op %u\n", sc->op);

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1322149491 0
# Node ID 67d2ac426defedad9c10eb339019f9dc9f02d2ae
# Parent 3c864e04c2ad060ca1cac6579994777993fef6e6
Trivial fix for rc val in hap track dirty vram
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -143,7 +143,7 @@ int hap_track_dirty_vram(struct domain *
}
else if ( !paging_mode_log_dirty(d) && !dirty_vram )
{
- rc -ENOMEM;
+ rc = -ENOMEM;
if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
goto param_fail;

View File

@ -1,64 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322153786 -3600
# Node ID 9c6bea25f71233787a36893deaf0e811f2dcb8d8
# Parent 480531cab3f4468b1ec9b549bc84d66e420ce685
x86: small fixes to pcpu platform op handling
XENPF_get_cpuinfo should init the flags output field rather than only
modify it.
XENPF_cpu_online must check for the input CPU number to be in range.
XENPF_cpu_offline must also do that, and should also reject attempts to
offline CPU 0 (this fails in cpu_down() too, but preventing this here
appears more correct given that the code here calls
continue_hypercall_on_cpu(0, ...), which would be flawed if cpu_down()
would ever allow bringing down CPU 0 (and a distinct error code is
easier to deal with when debugging issues).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -449,13 +449,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
if ( (g_info->xen_cpuid >= NR_CPUS) ||
!cpu_present(g_info->xen_cpuid) )
{
- g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+ g_info->flags = XEN_PCPU_FLAGS_INVALID;
}
else
{
g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
ASSERT(g_info->apic_id != BAD_APICID);
+ g_info->flags = 0;
if (cpu_online(g_info->xen_cpuid))
g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
}
@@ -472,7 +473,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;
@@ -493,7 +494,13 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu == 0 )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+ if ( cpu >= NR_CPUS || !cpu_present(cpu) )
{
ret = -EINVAL;
break;

View File

@ -19,10 +19,10 @@ Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/xenpaging/xenpaging.h | 2 - tools/xenpaging/xenpaging.h | 2 -
3 files changed, 61 insertions(+), 20 deletions(-) 3 files changed, 61 insertions(+), 20 deletions(-)
Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c Index: xen-4.1.3-testing/tools/xenpaging/policy_default.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/policy_default.c --- xen-4.1.3-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.1.2-testing/tools/xenpaging/policy_default.c +++ xen-4.1.3-testing/tools/xenpaging/policy_default.c
@@ -71,7 +71,6 @@ int policy_init(xenpaging_t *paging) @@ -71,7 +71,6 @@ int policy_init(xenpaging_t *paging)
/* Start in the middle to avoid paging during BIOS startup */ /* Start in the middle to avoid paging during BIOS startup */
@ -31,10 +31,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/policy_default.c
rc = 0; rc = 0;
out: out:
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.c --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.c +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.c
@@ -136,6 +136,21 @@ err: @@ -136,6 +136,21 @@ err:
return rc; return rc;
} }
@ -177,10 +177,10 @@ Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.c
} }
DPRINTF("xenpaging got signal %d\n", interrupted); DPRINTF("xenpaging got signal %d\n", interrupted);
Index: xen-4.1.2-testing/tools/xenpaging/xenpaging.h Index: xen-4.1.3-testing/tools/xenpaging/xenpaging.h
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/tools/xenpaging/xenpaging.h --- xen-4.1.3-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.1.2-testing/tools/xenpaging/xenpaging.h +++ xen-4.1.3-testing/tools/xenpaging/xenpaging.h
@@ -50,7 +50,7 @@ typedef struct xenpaging { @@ -50,7 +50,7 @@ typedef struct xenpaging {
/* number of pages for which data structures were allocated */ /* number of pages for which data structures were allocated */
int max_pages; int max_pages;

View File

@ -1,23 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1322645021 -3600
# Node ID 64088ba60263d3a623851b43a872c93c71cc3cbf
# Parent df7cec2c6c03f07932555954948ce7c8d09e88f4
x86/cpuidle: add Westmere-EX support to hw residencies reading logic
This is in accordance with
http://software.intel.com/en-us/articles/intel-processor-identification-with-cpuid-model-and-family-numbers/
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <maillists.shan@gmail.com>
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -113,6 +113,7 @@ static void do_get_hw_residencies(void *
/* Westmere */
case 0x25:
case 0x2C:
+ case 0x2F:
GET_PC3_RES(hw_res->pc3);
GET_PC6_RES(hw_res->pc6);
GET_PC7_RES(hw_res->pc7);

View File

@ -25,9 +25,11 @@ Committed-by: Keir Fraser <keir@xen.org>
xen/include/xen/sched.h | 18 ++++++++++++------ xen/include/xen/sched.h | 18 ++++++++++++------
6 files changed, 34 insertions(+), 23 deletions(-) 6 files changed, 34 insertions(+), 23 deletions(-)
--- a/xen/arch/x86/hvm/hvm.c Index: xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c ===================================================================
@@ -3909,7 +3909,7 @@ static int hvm_memory_event_traps(long p --- xen-4.1.3-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.1.3-testing/xen/arch/x86/hvm/hvm.c
@@ -3920,7 +3920,7 @@ static int hvm_memory_event_traps(long p
if ( (p & HVMPME_onchangeonly) && (value == old) ) if ( (p & HVMPME_onchangeonly) && (value == old) )
return 1; return 1;
@ -36,7 +38,7 @@ Committed-by: Keir Fraser <keir@xen.org>
if ( rc ) if ( rc )
return rc; return rc;
@@ -3932,7 +3932,7 @@ static int hvm_memory_event_traps(long p @@ -3943,7 +3943,7 @@ static int hvm_memory_event_traps(long p
req.gla_valid = 1; req.gla_valid = 1;
} }
@ -45,8 +47,10 @@ Committed-by: Keir Fraser <keir@xen.org>
return 1; return 1;
} }
--- a/xen/arch/x86/mm/mem_event.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
@@ -252,7 +252,7 @@ int mem_event_domctl(struct domain *d, x @@ -252,7 +252,7 @@ int mem_event_domctl(struct domain *d, x
{ {
case XEN_DOMCTL_MEM_EVENT_OP_PAGING: case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
@ -74,8 +78,10 @@ Committed-by: Keir Fraser <keir@xen.org>
} }
break; break;
--- a/xen/arch/x86/mm/mem_sharing.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_sharing.c
@@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all @@ -322,12 +322,12 @@ static struct page_info* mem_sharing_all
req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED; req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
} }
@ -100,9 +106,11 @@ Committed-by: Keir Fraser <keir@xen.org>
/* Unpause domain/vcpu */ /* Unpause domain/vcpu */
if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c ===================================================================
@@ -2996,7 +2996,7 @@ void p2m_mem_paging_drop_page(struct p2m --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -2998,7 +2998,7 @@ void p2m_mem_paging_drop_page(struct p2m
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -111,7 +119,7 @@ Committed-by: Keir Fraser <keir@xen.org>
{ {
/* Send release notification to pager */ /* Send release notification to pager */
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -3004,7 +3004,7 @@ void p2m_mem_paging_drop_page(struct p2m @@ -3006,7 +3006,7 @@ void p2m_mem_paging_drop_page(struct p2m
req.gfn = gfn; req.gfn = gfn;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -120,7 +128,7 @@ Committed-by: Keir Fraser <keir@xen.org>
} }
} }
@@ -3039,7 +3039,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -3041,7 +3041,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */ /* Check that there's space on the ring for this request */
@ -129,7 +137,7 @@ Committed-by: Keir Fraser <keir@xen.org>
return; return;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@@ -3070,7 +3070,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -3072,7 +3072,7 @@ void p2m_mem_paging_populate(struct p2m_
else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged ) else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
{ {
/* gfn is already on its way back and vcpu is not paused */ /* gfn is already on its way back and vcpu is not paused */
@ -138,7 +146,7 @@ Committed-by: Keir Fraser <keir@xen.org>
return; return;
} }
@@ -3079,7 +3079,7 @@ void p2m_mem_paging_populate(struct p2m_ @@ -3081,7 +3081,7 @@ void p2m_mem_paging_populate(struct p2m_
req.p2mt = p2mt; req.p2mt = p2mt;
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -147,7 +155,7 @@ Committed-by: Keir Fraser <keir@xen.org>
} }
/** /**
@@ -3157,7 +3157,7 @@ void p2m_mem_paging_resume(struct p2m_do @@ -3159,7 +3159,7 @@ void p2m_mem_paging_resume(struct p2m_do
mfn_t mfn; mfn_t mfn;
/* Pull the response off the ring */ /* Pull the response off the ring */
@ -156,7 +164,7 @@ Committed-by: Keir Fraser <keir@xen.org>
/* Fix p2m entry if the page was not dropped */ /* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) ) if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -3210,7 +3210,7 @@ void p2m_mem_access_check(unsigned long @@ -3212,7 +3212,7 @@ void p2m_mem_access_check(paddr_t gpa, b
p2m_unlock(p2m); p2m_unlock(p2m);
/* Otherwise, check if there is a memory event listener, and send the message along */ /* Otherwise, check if there is a memory event listener, and send the message along */
@ -165,7 +173,7 @@ Committed-by: Keir Fraser <keir@xen.org>
if ( res < 0 ) if ( res < 0 )
{ {
/* No listener */ /* No listener */
@@ -3254,7 +3254,7 @@ void p2m_mem_access_check(unsigned long @@ -3256,7 +3256,7 @@ void p2m_mem_access_check(paddr_t gpa, b
req.vcpu_id = v->vcpu_id; req.vcpu_id = v->vcpu_id;
@ -174,7 +182,7 @@ Committed-by: Keir Fraser <keir@xen.org>
/* VCPU paused, mem event request sent */ /* VCPU paused, mem event request sent */
} }
@@ -3264,7 +3264,7 @@ void p2m_mem_access_resume(struct p2m_do @@ -3266,7 +3266,7 @@ void p2m_mem_access_resume(struct p2m_do
struct domain *d = p2m->domain; struct domain *d = p2m->domain;
mem_event_response_t rsp; mem_event_response_t rsp;
@ -183,8 +191,10 @@ Committed-by: Keir Fraser <keir@xen.org>
/* Unpause domain */ /* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED ) if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- a/xen/common/domain.c Index: xen-4.1.3-testing/xen/common/domain.c
+++ b/xen/common/domain.c ===================================================================
--- xen-4.1.3-testing.orig/xen/common/domain.c
+++ xen-4.1.3-testing/xen/common/domain.c
@@ -298,6 +298,10 @@ struct domain *domain_create( @@ -298,6 +298,10 @@ struct domain *domain_create(
init_status |= INIT_gnttab; init_status |= INIT_gnttab;
@ -204,8 +214,10 @@ Committed-by: Keir Fraser <keir@xen.org>
if ( init_status & INIT_arch ) if ( init_status & INIT_arch )
arch_domain_destroy(d); arch_domain_destroy(d);
if ( init_status & INIT_gnttab ) if ( init_status & INIT_gnttab )
--- a/xen/include/xen/sched.h Index: xen-4.1.3-testing/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h ===================================================================
--- xen-4.1.3-testing.orig/xen/include/xen/sched.h
+++ xen-4.1.3-testing/xen/include/xen/sched.h
@@ -201,6 +201,16 @@ struct mem_event_domain @@ -201,6 +201,16 @@ struct mem_event_domain
int xen_port; int xen_port;
}; };

View File

@ -12,8 +12,10 @@ CPUs.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c Index: xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/x86_emulate/x86_emulate.c
+++ xen-4.1.3-testing/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -990,6 +990,9 @@ static bool_t vcpu_has( @@ -990,6 +990,9 @@ static bool_t vcpu_has(
return rc == X86EMUL_OKAY; return rc == X86EMUL_OKAY;
} }
@ -24,7 +26,7 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
#define vcpu_must_have(leaf, reg, bit) \ #define vcpu_must_have(leaf, reg, bit) \
generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1) generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26) #define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
@@ -4114,13 +4117,24 @@ x86_emulate( @@ -4117,13 +4120,24 @@ x86_emulate(
dst.val = (uint8_t)src.val; dst.val = (uint8_t)src.val;
break; break;
@ -53,7 +55,7 @@ Signed-off-by: Jan Beulich <jbeulich@suse.com>
{ {
_regs.eflags |= EFLG_ZF; _regs.eflags |= EFLG_ZF;
dst.type = OP_NONE; dst.type = OP_NONE;
@@ -4128,13 +4142,28 @@ x86_emulate( @@ -4131,13 +4145,28 @@ x86_emulate(
break; break;
} }

View File

@ -1,38 +0,0 @@
# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1322749036 0
# Node ID a06cda9fb25f2d7b7b5c7da170813e4a8bb0cd67
# Parent 75f4e4d9f039ea656051e6dfd73e40d4cb32896b
x86/mm: Don't lose track of the log dirty bitmap
hap_log_dirty_init unconditionally sets the top of the log dirty
bitmap to INVALID_MFN. If there had been a bitmap allocated, it is
then leaked, and the host crashes on an ASSERT when the domain is
cleaned up.
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -665,7 +665,6 @@ void paging_log_dirty_init(struct domain
d->arch.paging.log_dirty.enable_log_dirty = enable_log_dirty;
d->arch.paging.log_dirty.disable_log_dirty = disable_log_dirty;
d->arch.paging.log_dirty.clean_dirty_bitmap = clean_dirty_bitmap;
- d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
}
/* This function fress log dirty bitmap resources. */
@@ -686,6 +685,11 @@ int paging_domain_init(struct domain *d,
if ( (rc = p2m_init(d)) != 0 )
return rc;
+ /* This must be initialized separately from the rest of the
+ * log-dirty init code as that can be called more than once and we
+ * don't want to leak any active log-dirty bitmaps */
+ d->arch.paging.log_dirty.top = _mfn(INVALID_MFN);
+
/* The order of the *_init calls below is important, as the later
* ones may rewrite some common fields. Shadow pagetables are the
* default... */

View File

@ -17,11 +17,11 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm.c | 24 ++++++++++++++++-------- xen/arch/x86/mm.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-) 1 file changed, 16 insertions(+), 8 deletions(-)
Index: xen-4.1.2-testing/xen/arch/x86/mm.c Index: xen-4.1.3-testing/xen/arch/x86/mm.c
=================================================================== ===================================================================
--- xen-4.1.2-testing.orig/xen/arch/x86/mm.c --- xen-4.1.3-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.2-testing/xen/arch/x86/mm.c +++ xen-4.1.3-testing/xen/arch/x86/mm.c
@@ -3492,8 +3492,9 @@ int do_mmu_update( @@ -3494,8 +3494,9 @@ int do_mmu_update(
{ {
l1_pgentry_t l1e = l1e_from_intpte(req.val); l1_pgentry_t l1e = l1e_from_intpte(req.val);
p2m_type_t l1e_p2mt; p2m_type_t l1e_p2mt;
@ -32,7 +32,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( p2m_is_paged(l1e_p2mt) ) if ( p2m_is_paged(l1e_p2mt) )
{ {
@@ -3502,7 +3503,8 @@ int do_mmu_update( @@ -3504,7 +3505,8 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -42,7 +42,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3534,7 +3536,8 @@ int do_mmu_update( @@ -3536,7 +3538,8 @@ int do_mmu_update(
{ {
l2_pgentry_t l2e = l2e_from_intpte(req.val); l2_pgentry_t l2e = l2e_from_intpte(req.val);
p2m_type_t l2e_p2mt; p2m_type_t l2e_p2mt;
@ -52,7 +52,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( p2m_is_paged(l2e_p2mt) ) if ( p2m_is_paged(l2e_p2mt) )
{ {
@@ -3543,7 +3546,8 @@ int do_mmu_update( @@ -3545,7 +3548,8 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -62,7 +62,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3563,7 +3567,8 @@ int do_mmu_update( @@ -3565,7 +3569,8 @@ int do_mmu_update(
{ {
l3_pgentry_t l3e = l3e_from_intpte(req.val); l3_pgentry_t l3e = l3e_from_intpte(req.val);
p2m_type_t l3e_p2mt; p2m_type_t l3e_p2mt;
@ -72,7 +72,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( p2m_is_paged(l3e_p2mt) ) if ( p2m_is_paged(l3e_p2mt) )
{ {
@@ -3572,7 +3577,8 @@ int do_mmu_update( @@ -3574,7 +3579,8 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }
@ -82,7 +82,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
{ {
rc = -ENOENT; rc = -ENOENT;
break; break;
@@ -3592,8 +3598,9 @@ int do_mmu_update( @@ -3594,8 +3600,9 @@ int do_mmu_update(
{ {
l4_pgentry_t l4e = l4e_from_intpte(req.val); l4_pgentry_t l4e = l4e_from_intpte(req.val);
p2m_type_t l4e_p2mt; p2m_type_t l4e_p2mt;
@ -93,7 +93,7 @@ Index: xen-4.1.2-testing/xen/arch/x86/mm.c
if ( p2m_is_paged(l4e_p2mt) ) if ( p2m_is_paged(l4e_p2mt) )
{ {
@@ -3602,7 +3609,8 @@ int do_mmu_update( @@ -3604,7 +3611,8 @@ int do_mmu_update(
rc = -ENOENT; rc = -ENOENT;
break; break;
} }

View File

@ -33,8 +33,10 @@ Committed-by: Tim Deegan <tim@xen.org>
xen/include/public/domctl.h | 8 ++++++-- xen/include/public/domctl.h | 8 ++++++--
5 files changed, 39 insertions(+), 7 deletions(-) 5 files changed, 39 insertions(+), 7 deletions(-)
--- a/xen/arch/x86/mm/mem_event.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
+++ b/xen/arch/x86/mm/mem_event.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_event.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_event.c
@@ -45,7 +45,7 @@ static int mem_event_enable(struct domai @@ -45,7 +45,7 @@ static int mem_event_enable(struct domai
struct domain *dom_mem_event = current->domain; struct domain *dom_mem_event = current->domain;
struct vcpu *v = current; struct vcpu *v = current;
@ -44,8 +46,10 @@ Committed-by: Tim Deegan <tim@xen.org>
l1_pgentry_t l1e; l1_pgentry_t l1e;
unsigned long gfn; unsigned long gfn;
p2m_type_t p2mt; p2m_type_t p2mt;
--- a/xen/arch/x86/mm/mem_paging.c Index: xen-4.1.3-testing/xen/arch/x86/mm/mem_paging.c
+++ b/xen/arch/x86/mm/mem_paging.c ===================================================================
--- xen-4.1.3-testing.orig/xen/arch/x86/mm/mem_paging.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/mem_paging.c
@@ -50,7 +50,7 @@ int mem_paging_domctl(struct domain *d, @@ -50,7 +50,7 @@ int mem_paging_domctl(struct domain *d,
case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP: case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP:
{ {
@ -55,9 +59,11 @@ Committed-by: Tim Deegan <tim@xen.org>
} }
break; break;
--- a/xen/arch/x86/mm/p2m.c Index: xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c ===================================================================
@@ -3093,13 +3093,20 @@ void p2m_mem_paging_populate(struct p2m_ --- xen-4.1.3-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.3-testing/xen/arch/x86/mm/p2m.c
@@ -3095,13 +3095,20 @@ void p2m_mem_paging_populate(struct p2m_
* mfn if populate was called for gfn which was nominated but not evicted. In * mfn if populate was called for gfn which was nominated but not evicted. In
* this case only the p2mt needs to be forwarded. * this case only the p2mt needs to be forwarded.
*/ */
@ -80,7 +86,7 @@ Committed-by: Tim Deegan <tim@xen.org>
p2m_lock(p2m); p2m_lock(p2m);
@@ -3119,6 +3126,28 @@ int p2m_mem_paging_prep(struct p2m_domai @@ -3121,6 +3128,28 @@ int p2m_mem_paging_prep(struct p2m_domai
if ( unlikely(page == NULL) ) if ( unlikely(page == NULL) )
goto out; goto out;
mfn = page_to_mfn(page); mfn = page_to_mfn(page);
@ -109,9 +115,11 @@ Committed-by: Tim Deegan <tim@xen.org>
} }
/* Fix p2m mapping */ /* Fix p2m mapping */
--- a/xen/include/asm-x86/p2m.h Index: xen-4.1.3-testing/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h ===================================================================
@@ -524,7 +524,7 @@ void p2m_mem_paging_drop_page(struct p2m --- xen-4.1.3-testing.orig/xen/include/asm-x86/p2m.h
+++ xen-4.1.3-testing/xen/include/asm-x86/p2m.h
@@ -526,7 +526,7 @@ void p2m_mem_paging_drop_page(struct p2m
/* Start populating a paged out frame */ /* Start populating a paged out frame */
void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn); void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
/* Prepare the p2m for paging a frame in */ /* Prepare the p2m for paging a frame in */
@ -120,8 +128,10 @@ Committed-by: Tim Deegan <tim@xen.org>
/* Resume normal operation (in case a domain was paused) */ /* Resume normal operation (in case a domain was paused) */
void p2m_mem_paging_resume(struct p2m_domain *p2m); void p2m_mem_paging_resume(struct p2m_domain *p2m);
#else #else
--- a/xen/include/public/domctl.h Index: xen-4.1.3-testing/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h ===================================================================
--- xen-4.1.3-testing.orig/xen/include/public/domctl.h
+++ xen-4.1.3-testing/xen/include/public/domctl.h
@@ -741,8 +741,12 @@ struct xen_domctl_mem_event_op { @@ -741,8 +741,12 @@ struct xen_domctl_mem_event_op {
uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */ uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */ uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_OP_* */

View File

@ -1,89 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1322836274 28800
# Node ID 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
# Parent 109b99239b21275ee2249873dcdb9a413741142d
tools/x86_64: Fix cpuid() inline asm to not clobber stack's red zone
Pushing stuff onto the stack on x86-64 when we do not specify
-mno-red-zone is unsafe. Since the complicated asm is due to register
pressure on i386, we simply implement an all-new simpler alternative
for x86-64.
Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1322844002 28800
# Node ID 491c3ebf1d371d03fdd0aabe82b0f422037c67ba
# Parent 72f4e4cb7440c6ab64d4c08dfdc3158112cc95ac
tools/libxc: Fix x86_32 build breakage in previous changeset.
Signed-off-by: Keir Fraser <keir@xen.org>
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -42,23 +42,23 @@ static int hypervisor_is_64bit(xc_interf
static void cpuid(const unsigned int *input, unsigned int *regs)
{
unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1];
- asm (
#ifdef __i386__
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm (
"push %%ebx; push %%edx\n\t"
-#else
- "push %%rbx; push %%rdx\n\t"
-#endif
"cpuid\n\t"
"mov %%ebx,4(%4)\n\t"
"mov %%edx,12(%4)\n\t"
-#ifdef __i386__
"pop %%edx; pop %%ebx\n\t"
-#else
- "pop %%rdx; pop %%rbx\n\t"
-#endif
: "=a" (regs[0]), "=c" (regs[2])
: "0" (input[0]), "1" (count), "S" (regs)
: "memory" );
+#else
+ asm (
+ "cpuid"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (input[0]), "2" (count) );
+#endif
}
/* Get the manufacturer brand name of the host processor. */
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -35,18 +35,21 @@
static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
{
- asm volatile (
#ifdef __i386__
-#define R(x) "%%e"#x"x"
-#else
-#define R(x) "%%r"#x"x"
-#endif
- "push "R(a)"; push "R(b)"; push "R(c)"; push "R(d)"\n\t"
+ /* Use the stack to avoid reg constraint failures with some gcc flags */
+ asm volatile (
+ "push %%eax; push %%ebx; push %%ecx; push %%edx\n\t"
"test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
"mov %%eax,(%2); mov %%ebx,4(%2)\n\t"
"mov %%ecx,8(%2); mov %%edx,12(%2)\n\t"
- "pop "R(d)"; pop "R(c)"; pop "R(b)"; pop "R(a)"\n\t"
+ "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax\n\t"
: : "a" (idx), "c" (pv_context), "S" (regs) : "memory" );
+#else
+ asm volatile (
+ "test %5,%5 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+ : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
+ : "0" (idx), "1" (pv_context), "2" (0) );
+#endif
}
static int check_for_xen(int pv_context)

View File

@ -1,49 +0,0 @@
References: bnc#711219
# HG changeset patch
# User Xudong Hao <xudong.hao@intel.com>
# Date 1323113706 0
# Node ID 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
# Parent 60ea36c0512b779f291bb6c007e1f05c16054ec2
tools/firmware: remove "_PS0/3" Method
Do not expose the ACPI power management "_PS0/3" Method to guest
firmware. According to section 3.4 of the APCI specification 4.0, PCI
device control the device power through its own specification but not
through APCI.
Qemu pushes "_PS0/3" to guest will cause a mess between ACPI PM and
PCI PM as a result of incorrect ACPI table shipped with the guest
BIOS, it may cause a failure of PCI device PM state transition(from
PCI_UNKNOWN to PCI_D0).
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Haitao Shan <haitao.shan@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
@@ -251,8 +251,6 @@ int main(int argc, char **argv)
* the ACPI event:
* _EJ0: eject a device
* _STA: return a device's status, e.g. enabled or removed
- * Other methods are optional:
- * _PS0/3: put them here for debug purpose
*
* Eject button would generate a general-purpose event, then the
* control method for this event uses Notify() to inform OSPM which
@@ -271,14 +269,6 @@ int main(int argc, char **argv)
stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
/* _SUN == dev */
stmt("Name", "_SUN, 0x%08x", slot >> 3);
- push_block("Method", "_PS0, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x80, \\_GPE.DPT2");
- pop_block();
- push_block("Method", "_PS3, 0");
- stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
- stmt("Store", "0x83, \\_GPE.DPT2");
- pop_block();
push_block("Method", "_EJ0, 1");
stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
stmt("Store", "0x88, \\_GPE.DPT2");

View File

@ -1,29 +0,0 @@
# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1323114166 0
# Node ID 9961a6d5356a57685b06f65133c6ade5041e3356
# Parent 832fa3f3543298a7125cd5f996d1e28dd7ba47b1
KEXEC: fix kexec_get_range_compat to fail vocally.
Fail with -ERANGE rather than silently truncating 64bit values (a
physical address and size) into 32bit integers for dom0 to consume.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Simplify the bitwise arithmetic a bit.
Signed-off-by: Keir Fraser <keir@xen.org>
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -395,6 +395,10 @@ static int kexec_get_range_compat(XEN_GU
ret = kexec_get_range_internal(&range);
+ /* Dont silently truncate physical addresses or sizes. */
+ if ( (range.start | range.size) & ~(unsigned long)(~0u) )
+ return -ERANGE;
+
if ( ret == 0 ) {
XLAT_kexec_range(&compat_range, &range);
if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )

View File

@ -1,109 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1323765911 -3600
# Node ID 868d82faf6511de3b3edce18cc6a9e1c938f0b8f
# Parent 7ca56cca09ade16645fb4806be2c5b2b0bc3332b
x86, amd: Disable GartTlbWlkErr when BIOS forgets it
This patch disables GartTlbWlk errors on AMD Fam10h CPUs if the BIOS
forgets to do is (or is just too old). Letting these errors enabled
can cause a sync-flood on the CPU causing a reboot.
The AMD BKDG recommends disabling GART TLB Wlk Error completely.
Based on a Linux patch from Joerg Roedel <joerg.roedel@amd.com>; see e.g.
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=5bbc097d890409d8eff4e3f1d26f11a9d6b7c07e
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c
@@ -46,6 +46,7 @@
#include <asm/msr.h>
#include "mce.h"
+#include "mce_quirks.h"
#include "x86_mca.h"
@@ -91,9 +92,14 @@ amd_f10_handler(struct mc_info *mi, uint
/* AMD Family10 machine check */
enum mcheck_type amd_f10_mcheck_init(struct cpuinfo_x86 *c)
{
+ enum mcequirk_amd_flags quirkflag = mcequirk_lookup_amd_quirkdata(c);
+
if (amd_k8_mcheck_init(c) == mcheck_none)
return mcheck_none;
+ if (quirkflag == MCEQUIRK_F10_GART)
+ mcequirk_amd_apply(quirkflag);
+
x86_mce_callback_register(amd_f10_handler);
return mcheck_amd_famXX;
--- a/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd_quirks.c
@@ -29,6 +29,8 @@ static const struct mce_quirkdata mce_am
MCEQUIRK_K7_BANK0 },
{ 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */,
MCEQUIRK_K8_GART },
+ { 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */,
+ MCEQUIRK_F10_GART },
};
enum mcequirk_amd_flags
@@ -54,6 +56,8 @@ mcequirk_lookup_amd_quirkdata(struct cpu
int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
{
+ u64 val;
+
switch (flags) {
case MCEQUIRK_K7_BANK0:
return 1; /* first bank */
@@ -67,6 +71,10 @@ int mcequirk_amd_apply(enum mcequirk_amd
wrmsrl(MSR_IA32_MC4_CTL, ~(1ULL << 10));
wrmsrl(MSR_IA32_MC4_STATUS, 0ULL);
break;
+ case MCEQUIRK_F10_GART:
+ if (rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0)
+ wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
+ break;
}
return 0;
--- a/xen/arch/x86/cpu/mcheck/mce_quirks.h
+++ b/xen/arch/x86/cpu/mcheck/mce_quirks.h
@@ -33,8 +33,9 @@ struct mce_quirkdata {
*/
enum mcequirk_amd_flags {
- MCEQUIRK_K7_BANK0 = 0x1,
- MCEQUIRK_K8_GART = 0x2,
+ MCEQUIRK_K7_BANK0 = 1,
+ MCEQUIRK_K8_GART,
+ MCEQUIRK_F10_GART
};
enum mcequirk_intel_flags {
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -98,6 +98,8 @@
#define CMCI_EN (1UL<<30)
#define CMCI_THRESHOLD_MASK 0x7FFF
+#define MSR_AMD64_MC0_MASK 0xc0010044
+
#define MSR_IA32_MC1_CTL 0x00000404
#define MSR_IA32_MC1_CTL2 0x00000281
#define MSR_IA32_MC1_STATUS 0x00000405
@@ -151,6 +153,8 @@
#define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x))
#define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x))
+#define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x))
+
#define MSR_P6_PERFCTR0 0x000000c1
#define MSR_P6_PERFCTR1 0x000000c2
#define MSR_P6_EVNTSEL0 0x00000186

View File

@ -1,143 +0,0 @@
References: bnc#736824
# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1323943209 -3600
# Node ID ca5f588bd203c9207e0988fcc80f43d83eed5420
# Parent 25f8952313ae683f41b634163f62651185d7be38
x86/ucode: fix for AMD Fam15 CPUs
Remove hardcoded maximum size a microcode patch can have. This is
dynamic now.
The microcode patch for family15h can be larger than 2048 bytes and
gets silently truncated.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- 2011-12-14.orig/xen/arch/x86/microcode_amd.c 2011-12-15 14:55:15.000000000 +0100
+++ 2011-12-14/xen/arch/x86/microcode_amd.c 2011-12-15 14:59:47.000000000 +0100
@@ -27,18 +27,10 @@
#include <asm/processor.h>
#include <asm/microcode.h>
-#define pr_debug(x...) ((void)0)
-
#define UCODE_MAGIC 0x00414d44
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
#define UCODE_UCODE_TYPE 0x00000001
-#define UCODE_MAX_SIZE (2048)
-#define DEFAULT_UCODE_DATASIZE (896)
-#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd))
-#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE)
-#define DWSIZE (sizeof(uint32_t))
-
/* serialize access to the physical write */
static DEFINE_SPINLOCK(microcode_update_lock);
@@ -99,7 +91,7 @@ static int microcode_fits(void *mc, int
}
if ( mc_header->patch_id <= uci->cpu_sig.rev )
- return -EINVAL;
+ return 0;
printk(KERN_DEBUG "microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n",
@@ -147,8 +139,12 @@ static int apply_microcode(int cpu)
return 0;
}
-static int get_next_ucode_from_buffer_amd(void *mc, const void *buf,
- size_t size, unsigned long *offset)
+static int get_next_ucode_from_buffer_amd(
+ void **mc,
+ size_t *mc_size,
+ const void *buf,
+ size_t size,
+ unsigned long *offset)
{
struct microcode_header_amd *mc_header;
size_t total_size;
@@ -181,8 +177,17 @@ static int get_next_ucode_from_buffer_am
return -EINVAL;
}
- memset(mc, 0, UCODE_MAX_SIZE);
- memcpy(mc, (const void *)(&bufp[off + 8]), total_size);
+ if ( *mc_size < total_size )
+ {
+ xfree(*mc);
+ *mc = xmalloc_bytes(total_size);
+ if ( !*mc )
+ return -ENOMEM;
+ *mc_size = total_size;
+ }
+ else if ( *mc_size > total_size )
+ memset(*mc + total_size, 0, *mc_size - total_size);
+ memcpy(*mc, mc_header, total_size);
*offset = off + total_size + 8;
@@ -236,10 +241,10 @@ static int cpu_request_microcode(int cpu
{
const uint32_t *buf_pos;
unsigned long offset = 0;
- int error = 0;
- int ret;
+ int error;
struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
void *mc;
+ size_t mc_size;
/* We should bind the task to the CPU */
BUG_ON(cpu != raw_smp_processor_id());
@@ -260,7 +265,9 @@ static int cpu_request_microcode(int cpu
return -EINVAL;
}
- mc = xmalloc_bytes(UCODE_MAX_SIZE);
+ /* Size of 1st microcode patch in bytes */
+ mc_size = buf_pos[offset / sizeof(*buf_pos) + 1];
+ mc = xmalloc_bytes(mc_size);
if ( mc == NULL )
{
printk(KERN_ERR "microcode: error! "
@@ -276,24 +284,33 @@ static int cpu_request_microcode(int cpu
* It's possible the data file has multiple matching ucode,
* lets keep searching till the latest version
*/
- while ( (ret = get_next_ucode_from_buffer_amd(mc, buf, size, &offset)) == 0)
+ while ( (error = get_next_ucode_from_buffer_amd(&mc, &mc_size, buf, size,
+ &offset)) == 0 )
{
+ uci->mc.mc_amd = mc;
+
error = microcode_fits(mc, cpu);
if (error <= 0)
continue;
error = apply_microcode(cpu);
if (error == 0)
+ {
+ error = 1;
break;
+ }
}
/* On success keep the microcode patch for
* re-apply on resume.
*/
- if (error) {
+ if ( error <= 0 )
+ {
xfree(mc);
mc = NULL;
}
+ else
+ error = 0;
uci->mc.mc_amd = mc;
out:

View File

@ -1,23 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1323955725 -3600
# Node ID 99caac2e35df41cbece606f663cb5570a62613c3
# Parent ca5f588bd203c9207e0988fcc80f43d83eed5420
x86/AMD: use correct shift count when merging model and stepping
... for legacy errata matching.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -216,7 +216,7 @@ int cpu_has_amd_erratum(const struct cpu
}
/* OSVW unavailable or ID unknown, match family-model-stepping range */
- ms = (cpu->x86_model << 8) | cpu->x86_mask;
+ ms = (cpu->x86_model << 4) | cpu->x86_mask;
while ((range = va_arg(ap, int))) {
if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
(ms >= AMD_MODEL_RANGE_START(range)) &&

View File

@ -1,85 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1324046740 -3600
# Node ID 1452fb248cd513832cfbbd1100b9b72a0dde7ea6
# Parent 01c8b27e3d7d4ad2b469be9922bb04b5eb0195e8
x86/emulator: workaround for AMD erratum 573
The only cases where we might end up emulating fsincos (as any other
x87 operations without memory operands) are
- when a HVM guest is in real mode (not applicable on AMD)
- between two half page table updates in PAE mode (unlikely, and not
doing the emulation here does affect only performance, not
correctness)
- when a guest maliciously (or erroneously) modifies an (MMIO or page
table update) instruction under emulation (unspecified behavior)
Hence, in order to avoid the erratum to cause harm to the entire host,
don't emulate fsincos on the affected AMD CPU families.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -3,5 +3,7 @@
#include <string.h>
#include <public/xen.h>
+#define cpu_has_amd_erratum(nr) 0
+
#include "x86_emulate/x86_emulate.h"
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -10,8 +10,15 @@
*/
#include <asm/x86_emulate.h>
+#include <asm/processor.h> /* current_cpu_info */
+#include <asm/amd.h> /* cpu_has_amd_erratum() */
/* Avoid namespace pollution. */
#undef cmpxchg
+#undef cpuid
+#undef wbinvd
+
+#define cpu_has_amd_erratum(nr) \
+ cpu_has_amd_erratum(&current_cpu_data, AMD_ERRATUM_##nr)
#include "x86_emulate/x86_emulate.c"
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2621,6 +2621,9 @@ x86_emulate(
case 0xd9: /* FPU 0xd9 */
switch ( modrm )
{
+ case 0xfb: /* fsincos */
+ fail_if(cpu_has_amd_erratum(573));
+ /* fall through */
case 0xc0 ... 0xc7: /* fld %stN */
case 0xc8 ... 0xcf: /* fxch %stN */
case 0xd0: /* fnop */
@@ -2646,7 +2649,6 @@ x86_emulate(
case 0xf8: /* fprem */
case 0xf9: /* fyl2xp1 */
case 0xfa: /* fsqrt */
- case 0xfb: /* fsincos */
case 0xfc: /* frndint */
case 0xfd: /* fscale */
case 0xfe: /* fsin */
--- a/xen/include/asm-x86/amd.h
+++ b/xen/include/asm-x86/amd.h
@@ -138,6 +138,12 @@
AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), \
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf))
+#define AMD_ERRATUM_573 \
+ AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x10, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x11, 0x0, 0x0, 0xff, 0xf), \
+ AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0xff, 0xf))
+
struct cpuinfo_x86;
int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...);

View File

@ -1,28 +0,0 @@
# HG changeset patch
# User Liu, Jinsong <jinsong.liu@intel.com>
# Date 1324219200 0
# Node ID 9587ccc2ae3192fd5625a87fa58e840377471867
# Parent 5b4b7e565ab82b06940889f2be7e30042b2881fc
X86-MCE: fix a bug of xen-mceinj tool
Fix a bug of xen-mceinj tool which used to test mce by software way.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -134,8 +134,12 @@ static int mca_cpuinfo(xc_interface *xc_
{
struct xen_mc mc;
+ memset(&mc, 0, sizeof(struct xen_mc));
+
mc.cmd = XEN_MC_physcpuinfo;
- if (xc_mca_op(xc_handle, &mc))
+ mc.interface_version = XEN_MCA_INTERFACE_VERSION;
+
+ if (!xc_mca_op(xc_handle, &mc))
return mc.u.mc_physcpuinfo.ncpus;
else
return 0;

View File

@ -1,46 +0,0 @@
# HG changeset patch
# User Gang Wei <gang.wei@intel.com>
# Date 1325153274 0
# Node ID a7b2610b8e5c9a15b1f5de9a3eabf7f19d0b4199
# Parent 2863b2f43a3bc9268885379d6fd55ed325b8c0a2
X86: Add a delay between INIT & SIPIs for tboot AP bring-up in X2APIC case
Without this delay, Xen could not bring APs up while working with
TXT/tboot, because tboot needs some time in APs to handle INIT before
becoming ready for receiving SIPIs (this delay was removed as part of
c/s 23724 by Tim Deegan).
Signed-off-by: Gang Wei <gang.wei@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -42,6 +42,7 @@
#include <asm/msr.h>
#include <asm/mtrr.h>
#include <asm/time.h>
+#include <asm/tboot.h>
#include <mach_apic.h>
#include <mach_wakecpu.h>
#include <smpboot_hooks.h>
@@ -473,6 +474,18 @@ static int wakeup_secondary_cpu(int phys
send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
} while ( send_status && (timeout++ < 1000) );
}
+ else if ( tboot_in_measured_env() )
+ {
+ /*
+ * With tboot AP is actually spinning in a mini-guest before
+ * receiving INIT. Upon receiving INIT ipi, AP need time to VMExit,
+ * update VMCS to tracking SIPIs and VMResume.
+ *
+ * While AP is in root mode handling the INIT the CPU will drop
+ * any SIPIs
+ */
+ udelay(10);
+ }
/*
* Should we send STARTUP IPIs ?

Some files were not shown because too many files have changed in this diff Show More