+22
-53
arch/x86/xen/enlighten.c
+22
-53
arch/x86/xen/enlighten.c
···
1517
1517
#endif
1518
1518
}
1519
1519
1520
-
#ifdef CONFIG_XEN_PVHVM
1521
-
#define HVM_SHARED_INFO_ADDR 0xFE700000UL
1522
-
static struct shared_info *xen_hvm_shared_info;
1523
-
static unsigned long xen_hvm_sip_phys;
1524
-
static int xen_major, xen_minor;
1525
-
1526
-
static void xen_hvm_connect_shared_info(unsigned long pfn)
1520
+
void __ref xen_hvm_init_shared_info(void)
1527
1521
{
1522
+
int cpu;
1528
1523
struct xen_add_to_physmap xatp;
1524
+
static struct shared_info *shared_info_page = 0;
1529
1525
1526
+
if (!shared_info_page)
1527
+
shared_info_page = (struct shared_info *)
1528
+
extend_brk(PAGE_SIZE, PAGE_SIZE);
1530
1529
xatp.domid = DOMID_SELF;
1531
1530
xatp.idx = 0;
1532
1531
xatp.space = XENMAPSPACE_shared_info;
1533
-
xatp.gpfn = pfn;
1532
+
xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
1534
1533
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
1535
1534
BUG();
1536
1535
1537
-
}
1538
-
static void __init xen_hvm_set_shared_info(struct shared_info *sip)
1539
-
{
1540
-
int cpu;
1541
-
1542
-
HYPERVISOR_shared_info = sip;
1536
+
HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;
1543
1537
1544
1538
/* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
1545
1539
* page, we use it in the event channel upcall and in some pvclock
1546
1540
* related functions. We don't need the vcpu_info placement
1547
1541
* optimizations because we don't use any pv_mmu or pv_irq op on
1548
-
* HVM. */
1549
-
for_each_online_cpu(cpu)
1542
+
* HVM.
1543
+
* When xen_hvm_init_shared_info is run at boot time only vcpu 0 is
1544
+
* online but xen_hvm_init_shared_info is run at resume time too and
1545
+
* in that case multiple vcpus might be online. */
1546
+
for_each_online_cpu(cpu) {
1550
1547
per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
1551
-
}
1552
-
1553
-
/* Reconnect the shared_info pfn to a (new) mfn */
1554
-
void xen_hvm_resume_shared_info(void)
1555
-
{
1556
-
xen_hvm_connect_shared_info(xen_hvm_sip_phys >> PAGE_SHIFT);
1557
-
}
1558
-
1559
-
/* Xen tools prior to Xen 4 do not provide a E820_Reserved area for guest usage.
1560
-
* On these old tools the shared info page will be placed in E820_Ram.
1561
-
* Xen 4 provides a E820_Reserved area at 0xFC000000, and this code expects
1562
-
* that nothing is mapped up to HVM_SHARED_INFO_ADDR.
1563
-
* Xen 4.3+ provides an explicit 1MB area at HVM_SHARED_INFO_ADDR which is used
1564
-
* here for the shared info page. */
1565
-
static void __init xen_hvm_init_shared_info(void)
1566
-
{
1567
-
if (xen_major < 4) {
1568
-
xen_hvm_shared_info = extend_brk(PAGE_SIZE, PAGE_SIZE);
1569
-
xen_hvm_sip_phys = __pa(xen_hvm_shared_info);
1570
-
} else {
1571
-
xen_hvm_sip_phys = HVM_SHARED_INFO_ADDR;
1572
-
set_fixmap(FIX_PARAVIRT_BOOTMAP, xen_hvm_sip_phys);
1573
-
xen_hvm_shared_info =
1574
-
(struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
1575
1548
}
1576
-
xen_hvm_connect_shared_info(xen_hvm_sip_phys >> PAGE_SHIFT);
1577
-
xen_hvm_set_shared_info(xen_hvm_shared_info);
1578
1549
}
1579
1550
1551
+
#ifdef CONFIG_XEN_PVHVM
1580
1552
static void __init init_hvm_pv_info(void)
1581
1553
{
1554
+
int major, minor;
1582
1555
uint32_t eax, ebx, ecx, edx, pages, msr, base;
1583
1556
u64 pfn;
1584
1557
1585
1558
base = xen_cpuid_base();
1559
+
cpuid(base + 1, &eax, &ebx, &ecx, &edx);
1560
+
1561
+
major = eax >> 16;
1562
+
minor = eax & 0xffff;
1563
+
printk(KERN_INFO "Xen version %d.%d.\n", major, minor);
1564
+
1586
1565
cpuid(base + 2, &pages, &msr, &ecx, &edx);
1587
1566
1588
1567
pfn = __pa(hypercall_page);
···
1612
1633
1613
1634
static bool __init xen_hvm_platform(void)
1614
1635
{
1615
-
uint32_t eax, ebx, ecx, edx, base;
1616
-
1617
1636
if (xen_pv_domain())
1618
1637
return false;
1619
1638
1620
-
base = xen_cpuid_base();
1621
-
if (!base)
1639
+
if (!xen_cpuid_base())
1622
1640
return false;
1623
-
1624
-
cpuid(base + 1, &eax, &ebx, &ecx, &edx);
1625
-
1626
-
xen_major = eax >> 16;
1627
-
xen_minor = eax & 0xffff;
1628
-
1629
-
printk(KERN_INFO "Xen version %d.%d.\n", xen_major, xen_minor);
1630
1641
1631
1642
return true;
1632
1643
}
+1
-1
arch/x86/xen/suspend.c
+1
-1
arch/x86/xen/suspend.c
+1
-1
arch/x86/xen/xen-ops.h
+1
-1
arch/x86/xen/xen-ops.h