--- /dev/null
+From b866d1334ba2d544bc575d75357dea6bdcdc7f46 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Thu, 14 Jun 2012 22:06:36 +0200
+Subject: drm/radeon: add some additional 6xx/7xx/EG register init
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit b866d1334ba2d544bc575d75357dea6bdcdc7f46 upstream.
+
+- SMX_SAR_CTL0 needs to be programmed correctly to prevent
+problems with memory exports in certain cases.
+- VC_ENHANCE needs to be initialized on 6xx/7xx.
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/evergreen.c | 3 +++
+ drivers/gpu/drm/radeon/evergreend.h | 1 +
+ drivers/gpu/drm/radeon/r600.c | 1 +
+ drivers/gpu/drm/radeon/r600d.h | 1 +
+ drivers/gpu/drm/radeon/rv770.c | 5 ++++-
+ drivers/gpu/drm/radeon/rv770d.h | 3 +++
+ 6 files changed, 13 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/radeon/evergreen.c
++++ b/drivers/gpu/drm/radeon/evergreen.c
+@@ -2210,6 +2210,9 @@ static void evergreen_gpu_init(struct ra
+ smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets);
+ WREG32(SMX_DC_CTL0, smx_dc_ctl0);
+
++ if (rdev->family <= CHIP_SUMO2)
++ WREG32(SMX_SAR_CTL0, 0x00010000);
++
+ WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) |
+ POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) |
+ SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1)));
+--- a/drivers/gpu/drm/radeon/evergreend.h
++++ b/drivers/gpu/drm/radeon/evergreend.h
+@@ -273,6 +273,7 @@
+ #define SCRATCH_UMSK 0x8540
+ #define SCRATCH_ADDR 0x8544
+
++#define SMX_SAR_CTL0 0xA008
+ #define SMX_DC_CTL0 0xA020
+ #define USE_HASH_FUNCTION (1 << 0)
+ #define NUMBER_OF_SETS(x) ((x) << 1)
+--- a/drivers/gpu/drm/radeon/r600.c
++++ b/drivers/gpu/drm/radeon/r600.c
+@@ -1906,6 +1906,7 @@ void r600_gpu_init(struct radeon_device
+ WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
+ NUM_CLIP_SEQ(3)));
+ WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095));
++ WREG32(VC_ENHANCE, 0);
+ }
+
+
+--- a/drivers/gpu/drm/radeon/r600d.h
++++ b/drivers/gpu/drm/radeon/r600d.h
+@@ -483,6 +483,7 @@
+ #define TC_L2_SIZE(x) ((x)<<5)
+ #define L2_DISABLE_LATE_HIT (1<<9)
+
++#define VC_ENHANCE 0x9714
+
+ #define VGT_CACHE_INVALIDATION 0x88C4
+ #define CACHE_INVALIDATION(x) ((x)<<0)
+--- a/drivers/gpu/drm/radeon/rv770.c
++++ b/drivers/gpu/drm/radeon/rv770.c
+@@ -782,6 +782,9 @@ static void rv770_gpu_init(struct radeon
+ ACK_FLUSH_CTL(3) |
+ SYNC_FLUSH_CTL));
+
++ if (rdev->family != CHIP_RV770)
++ WREG32(SMX_SAR_CTL0, 0x00003f3f);
++
+ db_debug3 = RREG32(DB_DEBUG3);
+ db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f);
+ switch (rdev->family) {
+@@ -960,7 +963,7 @@ static void rv770_gpu_init(struct radeon
+
+ WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
+ NUM_CLIP_SEQ(3)));
+-
++ WREG32(VC_ENHANCE, 0);
+ }
+
+ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
+--- a/drivers/gpu/drm/radeon/rv770d.h
++++ b/drivers/gpu/drm/radeon/rv770d.h
+@@ -208,6 +208,7 @@
+ #define SCRATCH_UMSK 0x8540
+ #define SCRATCH_ADDR 0x8544
+
++#define SMX_SAR_CTL0 0xA008
+ #define SMX_DC_CTL0 0xA020
+ #define USE_HASH_FUNCTION (1 << 0)
+ #define CACHE_DEPTH(x) ((x) << 1)
+@@ -307,6 +308,8 @@
+ #define TCP_CNTL 0x9610
+ #define TCP_CHAN_STEER 0x9614
+
++#define VC_ENHANCE 0x9714
++
+ #define VGT_CACHE_INVALIDATION 0x88C4
+ #define CACHE_INVALIDATION(x) ((x)<<0)
+ #define VC_ONLY 0
--- /dev/null
+From 648ccc7d35e3416fdc739d2e520e85de3125361b Mon Sep 17 00:00:00 2001
+From: Márton Németh <nm127@freemail.hu>
+Date: Mon, 11 Jun 2012 19:09:25 +0200
+Subject: drm sis: initialize object_idr
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Márton Németh <nm127@freemail.hu>
+
+commit 648ccc7d35e3416fdc739d2e520e85de3125361b upstream.
+
+The filed object_idr of struct drm_sis_private was introduced with
+commit http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=6de8a748881f1cd9d795454da2b6db616d5ca3d7 .
+
+The idr_init(&dev->object_name_idr) is called instead of
+idr_init(&dev_priv->object_idr) by mistake, leaving object_idr
+uninitialized. Correct this.
+
+This patch was not tested because of lack of hardware.
+
+Signed-off-by: Márton Németh <nm127@freemail.hu>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/sis/sis_drv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/sis/sis_drv.c
++++ b/drivers/gpu/drm/sis/sis_drv.c
+@@ -47,9 +47,9 @@ static int sis_driver_load(struct drm_de
+ if (dev_priv == NULL)
+ return -ENOMEM;
+
++ idr_init(&dev_priv->object_idr);
+ dev->dev_private = (void *)dev_priv;
+ dev_priv->chipset = chipset;
+- idr_init(&dev->object_name_idr);
+
+ return 0;
+ }
--- /dev/null
+From e5a867a51d9b009f90d5dca6a320608e4e8a37ec Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Sat, 16 Jun 2012 07:41:28 +0100
+Subject: drm/udl: only bind to the video devices on the hub.
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit e5a867a51d9b009f90d5dca6a320608e4e8a37ec upstream.
+
+This is ported from udlfb.
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=832188
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/udl/udl_drv.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/udl/udl_drv.c
++++ b/drivers/gpu/drm/udl/udl_drv.c
+@@ -13,8 +13,21 @@
+
+ static struct drm_driver driver;
+
++/*
++ * There are many DisplayLink-based graphics products, all with unique PIDs.
++ * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff)
++ * We also require a match on SubClass (0x00) and Protocol (0x00),
++ * which is compatible with all known USB 2.0 era graphics chips and firmware,
++ * but allows DisplayLink to increment those for any future incompatible chips
++ */
+ static struct usb_device_id id_table[] = {
+- {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,},
++ {.idVendor = 0x17e9, .bInterfaceClass = 0xff,
++ .bInterfaceSubClass = 0x00,
++ .bInterfaceProtocol = 0x00,
++ .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
++ USB_DEVICE_ID_MATCH_INT_CLASS |
++ USB_DEVICE_ID_MATCH_INT_SUBCLASS |
++ USB_DEVICE_ID_MATCH_INT_PROTOCOL,},
+ {},
+ };
+ MODULE_DEVICE_TABLE(usb, id_table);
--- /dev/null
+From ce020ea53264f1460ae619cfc12f968dbd0b8974 Mon Sep 17 00:00:00 2001
+From: Márton Németh <nm127@freemail.hu>
+Date: Sun, 10 Jun 2012 23:39:55 +0200
+Subject: drm via: initialize object_idr
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Márton Németh <nm127@freemail.hu>
+
+commit ce020ea53264f1460ae619cfc12f968dbd0b8974 upstream.
+
+The field obejct_idr of struct drm_via_private was introduced with the
+commit http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=77ee8f3825054f23b17e9c8f728f061defd86cdc .
+In that patch idr_init(&dev->object_name_idr) was called instead of
+idr_init(&dev_priv->object_idr) by mistake, leaving the dev_priv->object_idr
+uninitialized. To be more exact, the object_idr buffer is filled with zeros
+because of kzalloc(), but the dev_priv->object_idr.lock spinlock can cause
+system freeze at lib/idr.c:move_to_free_list() when spin_lock_irqsave()
+is called on this spinlock.
+
+The patch was tested on Clevo D4J, model D410J laptop, on the following
+hardware, without AGP kernel module loaded:
+
+ # lspci -s 01:00.0 -n
+ 01:00.0 0300: 1106:3108 (rev 01)
+ # lspci -s 01:00.0 -v
+ 01:00.0 VGA compatible controller: VIA Technologies, Inc. K8M800/K8N800/K8N800A [S3 UniChrome Pro] (rev 01) (prog-if 00 [VGA controller])
+ Subsystem: CLEVO/KAPOK Computer Device 4702
+ Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 16
+ Memory at f0000000 (32-bit, prefetchable) [size=64M]
+ Memory at d1000000 (32-bit, non-prefetchable) [size=16M]
+ Expansion ROM at <unassigned> [disabled]
+ Capabilities: [60] Power Management version 2
+ Capabilities: [70] AGP version 3.0
+
+Signed-off-by: Márton Németh <nm127@freemail.hu>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/via/via_map.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/via/via_map.c
++++ b/drivers/gpu/drm/via/via_map.c
+@@ -100,12 +100,11 @@ int via_driver_load(struct drm_device *d
+ if (dev_priv == NULL)
+ return -ENOMEM;
+
++ idr_init(&dev_priv->object_idr);
+ dev->dev_private = (void *)dev_priv;
+
+ dev_priv->chipset = chipset;
+
+- idr_init(&dev->object_name_idr);
+-
+ pci_set_master(dev->pdev);
+
+ ret = drm_vblank_init(dev, 1);
--- /dev/null
+From bc2df47a408f2d64cf81bcfd0f6e3e14c84cb0ab Mon Sep 17 00:00:00 2001
+From: "J. Bruce Fields" <bfields@redhat.com>
+Date: Tue, 12 Jun 2012 08:28:48 -0400
+Subject: nfsd4: BUG_ON(!is_spin_locked()) no good on UP kernels
+
+From: "J. Bruce Fields" <bfields@redhat.com>
+
+commit bc2df47a408f2d64cf81bcfd0f6e3e14c84cb0ab upstream.
+
+Most frequent symptom was a BUG triggering in expire_client, with the
+server locking up shortly thereafter.
+
+Introduced by 508dc6e110c6dbdc0bbe84298ccfe22de7538486 "nfsd41:
+free_session/free_client must be called under the client_lock".
+
+Cc: Benny Halevy <bhalevy@tonian.com>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfsd/nfs4state.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -862,7 +862,7 @@ static void free_session(struct kref *kr
+ struct nfsd4_session *ses;
+ int mem;
+
+- BUG_ON(!spin_is_locked(&client_lock));
++ lockdep_assert_held(&client_lock);
+ ses = container_of(kref, struct nfsd4_session, se_ref);
+ nfsd4_del_conns(ses);
+ spin_lock(&nfsd_drc_lock);
+@@ -1041,7 +1041,7 @@ static struct nfs4_client *alloc_client(
+ static inline void
+ free_client(struct nfs4_client *clp)
+ {
+- BUG_ON(!spin_is_locked(&client_lock));
++ lockdep_assert_held(&client_lock);
+ while (!list_empty(&clp->cl_sessions)) {
+ struct nfsd4_session *ses;
+ ses = list_entry(clp->cl_sessions.next, struct nfsd4_session,
--- /dev/null
+From 2d0dbc6ae8a5194aaecb9cfffb9053f38fce8b86 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Fri, 8 Jun 2012 10:58:09 -0400
+Subject: NFSv4: Fix unnecessary delegation returns in nfs4_do_open
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit 2d0dbc6ae8a5194aaecb9cfffb9053f38fce8b86 upstream.
+
+While nfs4_do_open() expects the fmode argument to be restricted to
+combinations of FMODE_READ and FMODE_WRITE, both nfs4_atomic_open()
+and nfs4_proc_create will pass the nfs_open_context->mode,
+which contains the full fmode_t.
+
+This patch ensures that nfs4_do_open strips the other fmode_t bits,
+fixing a problem in which the nfs4_do_open call would result in an
+unnecessary delegation return.
+
+Reported-by: Fred Isaman <iisaman@netapp.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/nfs4proc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -1861,6 +1861,7 @@ static struct nfs4_state *nfs4_do_open(s
+ struct nfs4_state *res;
+ int status;
+
++ fmode &= FMODE_READ|FMODE_WRITE;
+ do {
+ status = _nfs4_do_open(dir, dentry, fmode, flags, sattr, cred, &res);
+ if (status == 0)
--- /dev/null
+From b3b02ae5865c2dcd506322e0fc6def59a042e72f Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Thu, 31 May 2012 15:26:38 -0400
+Subject: NFSv4.1: Fix a request leak on the back channel
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit b3b02ae5865c2dcd506322e0fc6def59a042e72f upstream.
+
+If the call to svc_process_common() fails, then the request
+needs to be freed before we can exit bc_svc_process.
+
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/svc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/sunrpc/svc.c
++++ b/net/sunrpc/svc.c
+@@ -1379,7 +1379,8 @@ bc_svc_process(struct svc_serv *serv, st
+ sizeof(req->rq_snd_buf));
+ return bc_send(req);
+ } else {
+- /* Nothing to do to drop request */
++ /* drop request */
++ xprt_free_bc_request(req);
+ return 0;
+ }
+ }
--- /dev/null
+From 6b4e0a93ff6e45714c72bdce193f719ed94810e3 Mon Sep 17 00:00:00 2001
+From: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date: Thu, 14 Jun 2012 22:15:00 +0200
+Subject: Revert "drm/i915/dp: Use auxch precharge value of 5 everywhere"
+
+From: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 6b4e0a93ff6e45714c72bdce193f719ed94810e3 upstream.
+
+This reverts commit 092945e11c5b84f66dd08f0b87fb729715d377bc.
+
+This commit prevents a DP screen from properly training the link.
+Oddly enough it works, once the machine has been warm-booted with an
+older kernel.
+
+According to DP docs this _should_ have been the right precharge time.
+Also, the commit that originally introduces this was just general snb
+DP enabling and didn't mention any specific reason for this special
+value. Whatever, trust the reporter that this makes things worse and
+let's just revert it.
+
+v2: Less spelling fail.
+
+Cc: Adam Jackson <ajax@redhat.com>
+Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
+Reported-by: "Wouter M. Koolen" <W.M.Koolen-Wijkstra@cwi.nl>
+Buglink: https://lkml.org/lkml/2012/6/14/301
+Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_dp.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_dp.c
++++ b/drivers/gpu/drm/i915/intel_dp.c
+@@ -368,7 +368,7 @@ intel_dp_aux_ch(struct intel_dp *intel_d
+ int recv_bytes;
+ uint32_t status;
+ uint32_t aux_clock_divider;
+- int try, precharge = 5;
++ int try, precharge;
+
+ intel_dp_check_edp(intel_dp);
+ /* The clock divider is based off the hrawclk,
+@@ -388,6 +388,11 @@ intel_dp_aux_ch(struct intel_dp *intel_d
+ else
+ aux_clock_divider = intel_hrawclk(dev) / 2;
+
++ if (IS_GEN6(dev))
++ precharge = 3;
++ else
++ precharge = 5;
++
+ /* Try to wait for any previous AUX channel activity */
+ for (try = 0; try < 3; try++) {
+ status = I915_READ(ch_ctl);
arm-i.mx53-fix-pll4-base-address.patch
arm-imx6-exit-coherency-when-shutting-down-a-cpu.patch
arm-i.mx-imx21ads-fix-overlapping-static-i-o-mappings.patch
+revert-drm-i915-dp-use-auxch-precharge-value-of-5-everywhere.patch
+drm-radeon-add-some-additional-6xx-7xx-eg-register-init.patch
+drm-via-initialize-object_idr.patch
+drm-udl-only-bind-to-the-video-devices-on-the-hub.patch
+drm-sis-initialize-object_idr.patch
+xen-hvc-collapse-error-logic.patch
+xen-hvc-fix-error-cases-around-hvm_param_console_pfn.patch
+xen-hvc-check-hvm_param_console_-for-correctness.patch
+xen-setup-filter-aperfmperf-cpuid-feature-out.patch
+nfsv4.1-fix-a-request-leak-on-the-back-channel.patch
+nfsv4-fix-unnecessary-delegation-returns-in-nfs4_do_open.patch
+nfsd4-bug_on-is_spin_locked-no-good-on-up-kernels.patch
--- /dev/null
+From 5842f5768599094758931b74190cdf93641a8e35 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Date: Wed, 23 May 2012 12:56:59 -0400
+Subject: xen/hvc: Check HVM_PARAM_CONSOLE_[EVTCHN|PFN] for correctness.
+
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+
+commit 5842f5768599094758931b74190cdf93641a8e35 upstream.
+
+We need to make sure that those parameters are setup to be correct.
+As such the value of 0 is deemed invalid and we find that we
+bail out. The hypervisor sets by default all of them to be zero
+and when the hypercall is done does a simple:
+
+ a.value = d->arch.hvm_domain.params[a.index];
+
+Which means that if the Xen toolstack forgot to setup the proper
+HVM_PARAM_CONSOLE_EVTCHN (or the PFN one), we would get the
+default value of 0 and use that.
+
+Fixes-Oracle-Bug: 14091238
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/hvc/hvc_xen.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/drivers/tty/hvc/hvc_xen.c
++++ b/drivers/tty/hvc/hvc_xen.c
+@@ -214,14 +214,19 @@ static int xen_hvm_console_init(void)
+ /* already configured */
+ if (info->intf != NULL)
+ return 0;
+-
++ /*
++ * If the toolstack (or the hypervisor) hasn't set these values, the
++ * default value is 0. Even though mfn = 0 and evtchn = 0 are
++ * theoretically correct values, in practice they never are and they
++ * mean that a legacy toolstack hasn't initialized the pv console correctly.
++ */
+ r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
+- if (r < 0)
++ if (r < 0 || v == 0)
+ goto err;
+ info->evtchn = v;
+ v = 0;
+ r = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
+- if (r < 0)
++ if (r < 0 || v == 0)
+ goto err;
+ mfn = v;
+ info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE);
--- /dev/null
+From 2e5ad6b9c45d43cc4e7b8ac5ded1c55a7c4a3893 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Date: Wed, 23 May 2012 12:53:11 -0400
+Subject: xen/hvc: Collapse error logic.
+
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+
+commit 2e5ad6b9c45d43cc4e7b8ac5ded1c55a7c4a3893 upstream.
+
+All of the error paths are doing the same logic. In which
+case we might as well collapse them in one path.
+
+Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/hvc/hvc_xen.c | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+--- a/drivers/tty/hvc/hvc_xen.c
++++ b/drivers/tty/hvc/hvc_xen.c
+@@ -216,22 +216,16 @@ static int xen_hvm_console_init(void)
+ return 0;
+
+ r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
+- if (r < 0) {
+- kfree(info);
+- return -ENODEV;
+- }
++ if (r < 0)
++ goto err;
+ info->evtchn = v;
+ hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
+- if (r < 0) {
+- kfree(info);
+- return -ENODEV;
+- }
++ if (r < 0)
++ goto err;
+ mfn = v;
+ info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE);
+- if (info->intf == NULL) {
+- kfree(info);
+- return -ENODEV;
+- }
++ if (info->intf == NULL)
++ goto err;
+ info->vtermno = HVC_COOKIE;
+
+ spin_lock(&xencons_lock);
+@@ -239,6 +233,9 @@ static int xen_hvm_console_init(void)
+ spin_unlock(&xencons_lock);
+
+ return 0;
++err:
++ kfree(info);
++ return -ENODEV;
+ }
+
+ static int xen_pv_console_init(void)
--- /dev/null
+From a32c88b9386ce3df87f28dd46bdc3776cd6edf75 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Date: Wed, 23 May 2012 12:55:38 -0400
+Subject: xen/hvc: Fix error cases around HVM_PARAM_CONSOLE_PFN
+
+From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+
+commit a32c88b9386ce3df87f28dd46bdc3776cd6edf75 upstream.
+
+We weren't resetting the parameter to be passed in to a
+known default. Nor were we checking the return value of
+hvm_get_parameter.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/hvc/hvc_xen.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/hvc/hvc_xen.c
++++ b/drivers/tty/hvc/hvc_xen.c
+@@ -219,7 +219,8 @@ static int xen_hvm_console_init(void)
+ if (r < 0)
+ goto err;
+ info->evtchn = v;
+- hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
++ v = 0;
++ r = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
+ if (r < 0)
+ goto err;
+ mfn = v;
--- /dev/null
+From 5e626254206a709c6e937f3dda69bf26c7344f6f Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@amd.com>
+Date: Tue, 29 May 2012 13:07:31 +0200
+Subject: xen/setup: filter APERFMPERF cpuid feature out
+
+From: Andre Przywara <andre.przywara@amd.com>
+
+commit 5e626254206a709c6e937f3dda69bf26c7344f6f upstream.
+
+Xen PV kernels allow access to the APERF/MPERF registers to read the
+effective frequency. Access to the MSRs is however redirected to the
+currently scheduled physical CPU, making consecutive read and
+compares unreliable. In addition each rdmsr traps into the hypervisor.
+So to avoid bogus readouts and expensive traps, disable the kernel
+internal feature flag for APERF/MPERF if running under Xen.
+This will
+a) remove the aperfmperf flag from /proc/cpuinfo
+b) not mislead the power scheduler (arch/x86/kernel/cpu/sched.c) to
+ use the feature to improve scheduling (by default disabled)
+c) not mislead the cpufreq driver to use the MSRs
+
+This does not cover userland programs which access the MSRs via the
+device file interface, but this will be addressed separately.
+
+Signed-off-by: Andre Przywara <andre.przywara@amd.com>
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/xen/enlighten.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/arch/x86/xen/enlighten.c
++++ b/arch/x86/xen/enlighten.c
+@@ -207,6 +207,9 @@ static void __init xen_banner(void)
+ xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
+ }
+
++#define CPUID_THERM_POWER_LEAF 6
++#define APERFMPERF_PRESENT 0
++
+ static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0;
+ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
+
+@@ -240,6 +243,11 @@ static void xen_cpuid(unsigned int *ax,
+ *dx = cpuid_leaf5_edx_val;
+ return;
+
++ case CPUID_THERM_POWER_LEAF:
++ /* Disabling APERFMPERF for kernel usage */
++ maskecx = ~(1 << APERFMPERF_PRESENT);
++ break;
++
+ case 0xb:
+ /* Suppress extended topology stuff */
+ maskebx = 0;