Merge tag 'stable/for-linus-3.4-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 May 2012 18:07:29 +0000 (11:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 May 2012 18:07:29 +0000 (11:07 -0700)
Pull xen fixes from Konrad Rzeszutek Wilk:
 - fix to Kconfig to make it fit within 80 line characters,
 - two bootup fixes (AMD 8-core and with PCI BIOS),
 - cleanup code in a Xen PV fb driver,
 - and a crash fix when trying to see non-existent PTE's

* tag 'stable/for-linus-3.4-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen/Kconfig: fix Kconfig layout
  xen/pci: don't use PCI BIOS service for configuration space accesses
  xen/pte: Fix crashes when trying to see non-existent PGD/PMD/PUD/PTEs
  xen/apic: Return the APIC ID (and version) for CPU 0.
  drivers/video/xen-fbfront.c: add missing cleanup code

arch/x86/xen/enlighten.c
arch/x86/xen/mmu.c
drivers/video/xen-fbfront.c
drivers/xen/Kconfig

index a8f8844..95dccce 100644 (file)
@@ -63,6 +63,7 @@
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 #include <asm/mwait.h>
+#include <asm/pci_x86.h>
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -809,9 +810,40 @@ static void xen_io_delay(void)
 }
 
 #ifdef CONFIG_X86_LOCAL_APIC
+static unsigned long xen_set_apic_id(unsigned int x)
+{
+       WARN_ON(1);
+       return x;
+}
+static unsigned int xen_get_apic_id(unsigned long x)
+{
+       return ((x)>>24) & 0xFFu;
+}
 static u32 xen_apic_read(u32 reg)
 {
-       return 0;
+       struct xen_platform_op op = {
+               .cmd = XENPF_get_cpuinfo,
+               .interface_version = XENPF_INTERFACE_VERSION,
+               .u.pcpu_info.xen_cpuid = 0,
+       };
+       int ret = 0;
+
+       /* Shouldn't need this as APIC is turned off for PV, and we only
+        * get called on the bootup processor. But just in case. */
+       if (!xen_initial_domain() || smp_processor_id())
+               return 0;
+
+       if (reg == APIC_LVR)
+               return 0x10;
+
+       if (reg != APIC_ID)
+               return 0;
+
+       ret = HYPERVISOR_dom0_op(&op);
+       if (ret)
+               return 0;
+
+       return op.u.pcpu_info.apic_id << 24;
 }
 
 static void xen_apic_write(u32 reg, u32 val)
@@ -849,6 +881,8 @@ static void set_xen_basic_apic_ops(void)
        apic->icr_write = xen_apic_icr_write;
        apic->wait_icr_idle = xen_apic_wait_icr_idle;
        apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle;
+       apic->set_apic_id = xen_set_apic_id;
+       apic->get_apic_id = xen_get_apic_id;
 }
 
 #endif
@@ -1365,8 +1399,10 @@ asmlinkage void __init xen_start_kernel(void)
                /* Make sure ACS will be enabled */
                pci_request_acs();
        }
-               
-
+#ifdef CONFIG_PCI
+       /* PCI BIOS service won't work from a PV guest. */
+       pci_probe &= ~PCI_PROBE_BIOS;
+#endif
        xen_raw_console_write("about to get started...\n");
 
        xen_setup_runstate_info(0);
index b8e2794..69f5857 100644 (file)
@@ -353,8 +353,13 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
 {
        if (val & _PAGE_PRESENT) {
                unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
+               unsigned long pfn = mfn_to_pfn(mfn);
+
                pteval_t flags = val & PTE_FLAGS_MASK;
-               val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
+               if (unlikely(pfn == ~0))
+                       val = flags & ~_PAGE_PRESENT;
+               else
+                       val = ((pteval_t)pfn << PAGE_SHIFT) | flags;
        }
 
        return val;
index cb4529c..b7f5173 100644 (file)
@@ -365,7 +365,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
        struct fb_info *fb_info;
        int fb_size;
        int val;
-       int ret;
+       int ret = 0;
 
        info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (info == NULL) {
@@ -458,26 +458,31 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
        xenfb_init_shared_page(info, fb_info);
 
        ret = xenfb_connect_backend(dev, info);
-       if (ret < 0)
-               goto error;
+       if (ret < 0) {
+               xenbus_dev_fatal(dev, ret, "xenfb_connect_backend");
+               goto error_fb;
+       }
 
        ret = register_framebuffer(fb_info);
        if (ret) {
-               fb_deferred_io_cleanup(fb_info);
-               fb_dealloc_cmap(&fb_info->cmap);
-               framebuffer_release(fb_info);
                xenbus_dev_fatal(dev, ret, "register_framebuffer");
-               goto error;
+               goto error_fb;
        }
        info->fb_info = fb_info;
 
        xenfb_make_preferred_console();
        return 0;
 
- error_nomem:
-       ret = -ENOMEM;
-       xenbus_dev_fatal(dev, ret, "allocating device memory");
- error:
+error_fb:
+       fb_deferred_io_cleanup(fb_info);
+       fb_dealloc_cmap(&fb_info->cmap);
+       framebuffer_release(fb_info);
+error_nomem:
+       if (!ret) {
+               ret = -ENOMEM;
+               xenbus_dev_fatal(dev, ret, "allocating device memory");
+       }
+error:
        xenfb_remove(dev);
        return ret;
 }
index 9424313..ea20c51 100644 (file)
@@ -183,15 +183,17 @@ config XEN_ACPI_PROCESSOR
        depends on XEN && X86 && ACPI_PROCESSOR && CPU_FREQ
        default m
        help
-          This ACPI processor uploads Power Management information to the Xen hypervisor.
-
-         To do that the driver parses the Power Management data and uploads said
-         information to the Xen hypervisor. Then the Xen hypervisor can select the
-          proper Cx and Pxx states. It also registers itslef as the SMM so that
-          other drivers (such as ACPI cpufreq scaling driver) will not load.
-
-          To compile this driver as a module, choose M here: the
-          module will be called xen_acpi_processor  If you do not know what to choose,
-          select M here. If the CPUFREQ drivers are built in, select Y here.
+          This ACPI processor uploads Power Management information to the Xen
+         hypervisor.
+
+         To do that the driver parses the Power Management data and uploads
+         said information to the Xen hypervisor. Then the Xen hypervisor can
+         select the proper Cx and Pxx states. It also registers itslef as the
+         SMM so that other drivers (such as ACPI cpufreq scaling driver) will
+         not load.
+
+          To compile this driver as a module, choose M here: the module will be
+         called xen_acpi_processor  If you do not know what to choose, select
+         M here. If the CPUFREQ drivers are built in, select Y here.
 
 endmenu