--- /dev/null
+From b98ae2729dea161edc96c9d177459b6c28bcbba5 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Fri, 4 Jan 2013 17:02:18 +0100
+Subject: ALSA: usb - fix race in creation of M-Audio Fast track pro driver
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit b98ae2729dea161edc96c9d177459b6c28bcbba5 upstream.
+
+A patch in the 3.2 kernel caused regression with hotplugging the
+M-Audio Fast track pro, or sound after suspend. I don't have the
+device so I haven't done a full analysis, but it seems userspace
+(both udev and pulseaudio) got confused when a card was created,
+immediately destroyed, and then created again.
+
+However, at least one person in the bug report (martin djfun)
+reports that this patch resolves the issue for him. It also leaves
+a message in the log:
+"snd-usb-audio: probe of 1-1.1:1.1 failed with error -5" which is
+a bit misleading. It is better than non-working audio, but maybe
+there's a more elegant solution?
+
+BugLink: https://bugs.launchpad.net/bugs/1095315
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Cc: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/quirks.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_qui
+ * rules
+ */
+ err = usb_driver_set_configuration(dev, 2);
+- if (err < 0) {
++ if (err < 0)
+ snd_printdd("error usb_driver_set_configuration: %d\n",
+ err);
+- return -ENODEV;
+- }
++ /* Always return an error, so that we stop creating a device
++ that will just be destroyed and recreated with a new
++ configuration */
++ return -ENODEV;
+ } else
+ snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
+
--- /dev/null
+From 72585d2428fa3a0daab02ebad1f41e5ef517dbaa Mon Sep 17 00:00:00 2001
+From: Philipp Reisner <philipp.reisner@linbit.com>
+Date: Thu, 23 Feb 2012 12:56:26 +0100
+Subject: drbd: add missing part_round_stats to _drbd_start_io_acct
+
+From: Philipp Reisner <philipp.reisner@linbit.com>
+
+commit 72585d2428fa3a0daab02ebad1f41e5ef517dbaa upstream.
+
+Without this, iostat frequently sees bogus svctime and >= 100% "utilization".
+
+Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
+Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
+Cc: Raoul Bhatia <raoul@bhatia.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/block/drbd/drbd_req.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/block/drbd/drbd_req.c
++++ b/drivers/block/drbd/drbd_req.c
+@@ -37,6 +37,7 @@ static void _drbd_start_io_acct(struct d
+ const int rw = bio_data_dir(bio);
+ int cpu;
+ cpu = part_stat_lock();
++ part_round_stats(cpu, &mdev->vdisk->part0);
+ part_stat_inc(cpu, &mdev->vdisk->part0, ios[rw]);
+ part_stat_add(cpu, &mdev->vdisk->part0, sectors[rw], bio_sectors(bio));
+ part_inc_in_flight(&mdev->vdisk->part0, rw);
--- /dev/null
+From 66bea92c69477a75a5d37b9bfed5773c92a3c4b4 Mon Sep 17 00:00:00 2001
+From: Eric Sandeen <sandeen@redhat.com>
+Date: Wed, 14 Nov 2012 22:22:05 -0500
+Subject: ext4: init pagevec in ext4_da_block_invalidatepages
+
+From: Eric Sandeen <sandeen@redhat.com>
+
+commit 66bea92c69477a75a5d37b9bfed5773c92a3c4b4 upstream.
+
+ext4_da_block_invalidatepages is missing a pagevec_init(),
+which means that pvec->cold contains random garbage.
+
+This affects whether the page goes to the front or
+back of the LRU when ->cold makes it to
+free_hot_cold_page()
+
+Reviewed-by: Lukas Czerner <lczerner@redhat.com>
+Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -1424,6 +1424,8 @@ static void ext4_da_block_invalidatepage
+
+ index = mpd->first_page;
+ end = mpd->next_page - 1;
++
++ pagevec_init(&pvec, 0);
+ while (index <= end) {
+ nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE);
+ if (nr_pages == 0)
--- /dev/null
+From 52285b762b3681669215bf1d17ca6143448ab7d3 Mon Sep 17 00:00:00 2001
+From: Stefan Assmann <sassmann@kpanic.de>
+Date: Tue, 4 Dec 2012 06:00:17 +0000
+Subject: igb: release already assigned MSI-X interrupts if setup fails
+
+From: Stefan Assmann <sassmann@kpanic.de>
+
+commit 52285b762b3681669215bf1d17ca6143448ab7d3 upstream.
+
+During MSI-X setup the system might run out of vectors. If this happens the
+already assigned vectors for this NIC should be freed before trying the
+disable MSI-X. Failing to do so results in the following oops.
+
+kernel BUG at drivers/pci/msi.c:341!
+[...]
+Call Trace:
+ [<ffffffff8128f39d>] pci_disable_msix+0x3d/0x60
+ [<ffffffffa037d1ce>] igb_reset_interrupt_capability+0x27/0x5c [igb]
+ [<ffffffffa037d229>] igb_clear_interrupt_scheme+0x26/0x2d [igb]
+ [<ffffffffa0384268>] igb_request_irq+0x73/0x297 [igb]
+ [<ffffffffa0384554>] __igb_open+0xc8/0x223 [igb]
+ [<ffffffffa0384815>] igb_open+0x13/0x15 [igb]
+ [<ffffffff8144592f>] __dev_open+0xbf/0x120
+ [<ffffffff81443e51>] __dev_change_flags+0xa1/0x180
+ [<ffffffff81445828>] dev_change_flags+0x28/0x70
+ [<ffffffff814af537>] devinet_ioctl+0x5b7/0x620
+ [<ffffffff814b01c8>] inet_ioctl+0x88/0xa0
+ [<ffffffff8142e8a0>] sock_do_ioctl+0x30/0x70
+ [<ffffffff8142ecf2>] sock_ioctl+0x72/0x270
+ [<ffffffff8118062c>] do_vfs_ioctl+0x8c/0x340
+ [<ffffffff81180981>] sys_ioctl+0xa1/0xb0
+ [<ffffffff815161a9>] system_call_fastpath+0x16/0x1b
+Code: 48 89 df e8 1f 40 ed ff 4d 39 e6 49 8b 45 10 75 b6 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 5f c9 c3 48 8b 7b 20 e8 3e 91 db ff eb ae <0f> 0b eb fe 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
+RIP [<ffffffff8128e144>] free_msi_irqs+0x124/0x130
+ RSP <ffff880037503bd8>
+
+Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
+Tested-by: Aaron Brown <aaron.f.brown@intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Signed-off-by: Abdallah Chatila <abdallah.chatila@ericsson.com>
+
+---
+ drivers/net/ethernet/intel/igb/igb_main.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -951,17 +951,18 @@ static int igb_request_msix(struct igb_a
+ {
+ struct net_device *netdev = adapter->netdev;
+ struct e1000_hw *hw = &adapter->hw;
+- int i, err = 0, vector = 0;
++ int i, err = 0, vector = 0, free_vector = 0;
+
+ err = request_irq(adapter->msix_entries[vector].vector,
+ igb_msix_other, 0, netdev->name, adapter);
+ if (err)
+- goto out;
+- vector++;
++ goto err_out;
+
+ for (i = 0; i < adapter->num_q_vectors; i++) {
+ struct igb_q_vector *q_vector = adapter->q_vector[i];
+
++ vector++;
++
+ q_vector->itr_register = hw->hw_addr + E1000_EITR(vector);
+
+ if (q_vector->rx.ring && q_vector->tx.ring)
+@@ -980,13 +981,22 @@ static int igb_request_msix(struct igb_a
+ igb_msix_ring, 0, q_vector->name,
+ q_vector);
+ if (err)
+- goto out;
+- vector++;
++ goto err_free;
+ }
+
+ igb_configure_msix(adapter);
+ return 0;
+-out:
++
++err_free:
++ /* free already assigned IRQs */
++ free_irq(adapter->msix_entries[free_vector++].vector, adapter);
++
++ vector--;
++ for (i = 0; i < vector; i++) {
++ free_irq(adapter->msix_entries[free_vector++].vector,
++ adapter->q_vector[i]);
++ }
++err_out:
+ return err;
+ }
+
--- /dev/null
+From ea2447f700cab264019b52e2b417d689e052dcfd Mon Sep 17 00:00:00 2001
+From: Tom Mingarelli <thomas.mingarelli@hp.com>
+Date: Tue, 20 Nov 2012 19:43:17 +0000
+Subject: intel-iommu: Prevent devices with RMRRs from being placed
+ into SI Domain
+
+From: Tom Mingarelli <thomas.mingarelli@hp.com>
+
+commit ea2447f700cab264019b52e2b417d689e052dcfd upstream.
+
+This patch is to prevent non-USB devices that have RMRRs associated with them from
+being placed into the SI Domain during init. This fixes the issue where the RMRR info
+for devices being placed in and out of the SI Domain gets lost.
+
+Signed-off-by: Thomas Mingarelli <thomas.mingarelli@hp.com>
+Tested-by: Shuah Khan <shuah.khan@hp.com>
+Reviewed-by: Donald Dutile <ddutile@redhat.com>
+Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Joerg Roedel <joro@8bytes.org>
+Cc: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iommu/intel-iommu.c | 31 +++++++++++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+--- a/drivers/iommu/intel-iommu.c
++++ b/drivers/iommu/intel-iommu.c
+@@ -2321,8 +2321,39 @@ static int domain_add_dev_info(struct dm
+ return 0;
+ }
+
++static bool device_has_rmrr(struct pci_dev *dev)
++{
++ struct dmar_rmrr_unit *rmrr;
++ int i;
++
++ for_each_rmrr_units(rmrr) {
++ for (i = 0; i < rmrr->devices_cnt; i++) {
++ /*
++ * Return TRUE if this RMRR contains the device that
++ * is passed in.
++ */
++ if (rmrr->devices[i] == dev)
++ return true;
++ }
++ }
++ return false;
++}
++
+ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
+ {
++
++ /*
++ * We want to prevent any device associated with an RMRR from
++ * getting placed into the SI Domain. This is done because
++ * problems exist when devices are moved in and out of domains
++ * and their respective RMRR info is lost. We exempt USB devices
++ * from this process due to their usage of RMRRs that are known
++ * to not be needed after BIOS hand-off to OS.
++ */
++ if (device_has_rmrr(pdev) &&
++ (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
++ return 0;
++
+ if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
+ return 1;
+
--- /dev/null
+From 7dbb491878a2c51d372a8890fa45a8ff80358af1 Mon Sep 17 00:00:00 2001
+From: Francois Romieu <romieu@fr.zoreil.com>
+Date: Sat, 9 Jun 2012 10:53:16 +0000
+Subject: r8169: avoid NAPI scheduling delay.
+
+From: Francois Romieu <romieu@fr.zoreil.com>
+
+commit 7dbb491878a2c51d372a8890fa45a8ff80358af1 upstream.
+
+While reworking the r8169 driver a few months ago to perform the
+smallest amount of work in the irq handler, I took care of avoiding
+any irq mask register operation in the slow work dedicated user
+context thread. The slow work thread scheduled an extra round of NAPI
+work which would ultimately set the irq mask register as required,
+thus keeping such irq mask operations in the NAPI handler.
+It would eventually race with the irq handler and delay NAPI execution
+for - assuming no further irq - a whole ksoftirqd period. Mildly a
+problem for rare link changes or corner case PCI events.
+
+The race was always lost after the last bh disabling lock had been
+removed from the work thread and people started wondering where those
+pesky "NOHZ: local_softirq_pending 08" messages came from.
+
+Actually the irq mask register _can_ be set up directly in the slow
+work thread.
+
+Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
+Reported-by: Dave Jones <davej@redhat.com>
+Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Hayes Wang <hayeswang@realtek.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+
+---
+ drivers/net/ethernet/realtek/r8169.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/realtek/r8169.c
++++ b/drivers/net/ethernet/realtek/r8169.c
+@@ -5516,11 +5516,7 @@ static void rtl_slow_event_work(struct r
+ if (status & LinkChg)
+ __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
+
+- napi_disable(&tp->napi);
+- rtl_irq_disable(tp);
+-
+- napi_enable(&tp->napi);
+- napi_schedule(&tp->napi);
++ rtl_irq_enable_all(tp);
+ }
+
+ static void rtl_task(struct work_struct *work)
--- /dev/null
+From ed4f20943cd4c7b55105c04daedf8d63ab6d499c Mon Sep 17 00:00:00 2001
+From: Heiko Carstens <heiko.carstens@de.ibm.com>
+Date: Mon, 14 Jan 2013 16:55:55 +0100
+Subject: s390/time: fix sched_clock() overflow
+
+From: Heiko Carstens <heiko.carstens@de.ibm.com>
+
+commit ed4f20943cd4c7b55105c04daedf8d63ab6d499c upstream.
+
+Converting a 64 Bit TOD format value to nanoseconds means that the value
+must be divided by 4.096. In order to achieve that we multiply with 125
+and divide by 512.
+When used within sched_clock() this triggers an overflow after appr.
+417 days. Resulting in a sched_clock() return value that is much smaller
+than previously and therefore may cause all sort of weird things in
+subsystems that rely on a monotonic sched_clock() behaviour.
+
+To fix this implement a tod_to_ns() helper function which converts TOD
+values without overflow and call this function from both places that
+open coded the conversion: sched_clock() and kvm_s390_handle_wait().
+
+Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/s390/include/asm/timex.h | 28 ++++++++++++++++++++++++++++
+ arch/s390/kernel/time.c | 2 +-
+ arch/s390/kvm/interrupt.c | 2 +-
+ 3 files changed, 30 insertions(+), 2 deletions(-)
+
+--- a/arch/s390/include/asm/timex.h
++++ b/arch/s390/include/asm/timex.h
+@@ -137,4 +137,32 @@ static inline unsigned long long get_clo
+ return get_clock_xt() - sched_clock_base_cc;
+ }
+
++/**
++ * tod_to_ns - convert a TOD format value to nanoseconds
++ * @todval: to be converted TOD format value
++ * Returns: number of nanoseconds that correspond to the TOD format value
++ *
++ * Converting a 64 Bit TOD format value to nanoseconds means that the value
++ * must be divided by 4.096. In order to achieve that we multiply with 125
++ * and divide by 512:
++ *
++ * ns = (todval * 125) >> 9;
++ *
++ * In order to avoid an overflow with the multiplication we can rewrite this.
++ * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
++ * we end up with
++ *
++ * ns = ((2^32 * th + tl) * 125 ) >> 9;
++ * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
++ *
++ */
++static inline unsigned long long tod_to_ns(unsigned long long todval)
++{
++ unsigned long long ns;
++
++ ns = ((todval >> 32) << 23) * 125;
++ ns += ((todval & 0xffffffff) * 125) >> 9;
++ return ns;
++}
++
+ #endif
+--- a/arch/s390/kernel/time.c
++++ b/arch/s390/kernel/time.c
+@@ -64,7 +64,7 @@ static DEFINE_PER_CPU(struct clock_event
+ */
+ unsigned long long notrace __kprobes sched_clock(void)
+ {
+- return (get_clock_monotonic() * 125) >> 9;
++ return tod_to_ns(get_clock_monotonic());
+ }
+
+ /*
+--- a/arch/s390/kvm/interrupt.c
++++ b/arch/s390/kvm/interrupt.c
+@@ -390,7 +390,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu
+ return 0;
+ }
+
+- sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9;
++ sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
+
+ hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
+ VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
tcm_fc-do-not-indicate-retry-capability-to-initiators.patch
tcm_fc-do-not-report-target-role-when-target-is-not-defined.patch
target-release-se_cmd-when-lun-lookup-fails-for-tmr.patch
+s390-time-fix-sched_clock-overflow.patch
+x86-sandy-bridge-reserve-pages-when-integrated-graphics-is-present.patch
+alsa-usb-fix-race-in-creation-of-m-audio-fast-track-pro-driver.patch
+ext4-init-pagevec-in-ext4_da_block_invalidatepages.patch
+r8169-avoid-napi-scheduling-delay.patch
+target-add-link_magic-for-fabric-allow_link-destination.patch
+intel-iommu-prevent-devices-with-rmrrs-from-being-placed.patch
+igb-release-already-assigned-msi-x-interrupts-if-setup-fails.patch
+drbd-add-missing-part_round_stats-to-_drbd_start_io_acct.patch
--- /dev/null
+From 0ff8754981261a80f4b77db2536dfea92c2d4539 Mon Sep 17 00:00:00 2001
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+Date: Tue, 4 Dec 2012 23:43:57 -0800
+Subject: target: Add link_magic for fabric allow_link destination
+ target_items
+
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+
+commit 0ff8754981261a80f4b77db2536dfea92c2d4539 upstream.
+
+This patch adds [dev,lun]_link_magic value assignment + checks within generic
+target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure
+destination config_item *target_item sent from configfs_symlink() ->
+config_item_operations->allow_link() is the underlying se_device->dev_group
+and se_lun->lun_group that we expect to symlink.
+
+Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_device.c | 1 +
+ drivers/target/target_core_fabric_configfs.c | 12 ++++++++++++
+ drivers/target/target_core_tpg.c | 1 +
+ drivers/target/target_core_transport.c | 1 +
+ include/target/target_core_base.h | 4 ++++
+ 5 files changed, 19 insertions(+)
+
+--- a/drivers/target/target_core_device.c
++++ b/drivers/target/target_core_device.c
+@@ -1665,6 +1665,7 @@ int core_dev_setup_virtual_lun0(void)
+ ret = PTR_ERR(dev);
+ goto out;
+ }
++ dev->dev_link_magic = SE_DEV_LINK_MAGIC;
+ se_dev->se_dev_ptr = dev;
+ g_lun0_dev = dev;
+
+--- a/drivers/target/target_core_fabric_configfs.c
++++ b/drivers/target/target_core_fabric_configfs.c
+@@ -72,6 +72,12 @@ static int target_fabric_mappedlun_link(
+ struct se_portal_group *se_tpg;
+ struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s;
+ int ret = 0, lun_access;
++
++ if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) {
++ pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:"
++ " %p to struct lun: %p\n", lun_ci, lun);
++ return -EFAULT;
++ }
+ /*
+ * Ensure that the source port exists
+ */
+@@ -746,6 +752,12 @@ static int target_fabric_port_link(
+ struct target_fabric_configfs *tf;
+ int ret;
+
++ if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
++ pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
++ " %p to struct se_device: %p\n", se_dev_ci, dev);
++ return -EFAULT;
++ }
++
+ tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;
+ se_tpg = container_of(to_config_group(tpg_ci),
+ struct se_portal_group, tpg_group);
+--- a/drivers/target/target_core_tpg.c
++++ b/drivers/target/target_core_tpg.c
+@@ -677,6 +677,7 @@ int core_tpg_register(
+ for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
+ lun = se_tpg->tpg_lun_list[i];
+ lun->unpacked_lun = i;
++ lun->lun_link_magic = SE_LUN_LINK_MAGIC;
+ lun->lun_status = TRANSPORT_LUN_STATUS_FREE;
+ atomic_set(&lun->lun_acl_count, 0);
+ init_completion(&lun->lun_shutdown_comp);
+--- a/drivers/target/target_core_transport.c
++++ b/drivers/target/target_core_transport.c
+@@ -1341,6 +1341,7 @@ struct se_device *transport_add_device_t
+ dev->se_hba = hba;
+ dev->se_sub_dev = se_dev;
+ dev->transport = transport;
++ dev->dev_link_magic = SE_DEV_LINK_MAGIC;
+ INIT_LIST_HEAD(&dev->dev_list);
+ INIT_LIST_HEAD(&dev->dev_sep_list);
+ INIT_LIST_HEAD(&dev->dev_tmr_list);
+--- a/include/target/target_core_base.h
++++ b/include/target/target_core_base.h
+@@ -779,6 +779,8 @@ struct se_subsystem_dev {
+ };
+
+ struct se_device {
++#define SE_DEV_LINK_MAGIC 0xfeeddeef
++ u32 dev_link_magic;
+ /* RELATIVE TARGET PORT IDENTIFER Counter */
+ u16 dev_rpti_counter;
+ /* Used for SAM Task Attribute ordering */
+@@ -869,6 +871,8 @@ struct se_port_stat_grps {
+ };
+
+ struct se_lun {
++#define SE_LUN_LINK_MAGIC 0xffff7771
++ u32 lun_link_magic;
+ /* See transport_lun_status_table */
+ enum transport_lun_status_table lun_status;
+ u32 lun_access;
--- /dev/null
+From a9acc5365dbda29f7be2884efb63771dc24bd815 Mon Sep 17 00:00:00 2001
+From: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Wed, 14 Nov 2012 20:43:31 +0000
+Subject: x86/Sandy Bridge: reserve pages when integrated graphics is present
+
+From: Jesse Barnes <jbarnes@virtuousgeek.org>
+
+commit a9acc5365dbda29f7be2884efb63771dc24bd815 upstream.
+
+SNB graphics devices have a bug that prevent them from accessing certain
+memory ranges, namely anything below 1M and in the pages listed in the
+table. So reserve those at boot if set detect a SNB gfx device on the
+CPU to avoid GPU hangs.
+
+Stephane Marchesin had a similar patch to the page allocator awhile
+back, but rather than reserving pages up front, it leaked them at
+allocation time.
+
+[ hpa: made a number of stylistic changes, marked arrays as static
+ const, and made less verbose; use "memblock=debug" for full
+ verbosity. ]
+
+Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
+Cc: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/setup.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 78 insertions(+)
+
+--- a/arch/x86/kernel/setup.c
++++ b/arch/x86/kernel/setup.c
+@@ -620,6 +620,81 @@ static __init void reserve_ibft_region(v
+
+ static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
+
++static bool __init snb_gfx_workaround_needed(void)
++{
++ int i;
++ u16 vendor, devid;
++ static const u16 snb_ids[] = {
++ 0x0102,
++ 0x0112,
++ 0x0122,
++ 0x0106,
++ 0x0116,
++ 0x0126,
++ 0x010a,
++ };
++
++ /* Assume no if something weird is going on with PCI */
++ if (!early_pci_allowed())
++ return false;
++
++ vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
++ if (vendor != 0x8086)
++ return false;
++
++ devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
++ for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
++ if (devid == snb_ids[i])
++ return true;
++
++ return false;
++}
++
++/*
++ * Sandy Bridge graphics has trouble with certain ranges, exclude
++ * them from allocation.
++ */
++static void __init trim_snb_memory(void)
++{
++ static const unsigned long bad_pages[] = {
++ 0x20050000,
++ 0x20110000,
++ 0x20130000,
++ 0x20138000,
++ 0x40004000,
++ };
++ int i;
++
++ if (!snb_gfx_workaround_needed())
++ return;
++
++ printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
++
++ /*
++ * Reserve all memory below the 1 MB mark that has not
++ * already been reserved.
++ */
++ memblock_reserve(0, 1<<20);
++
++ for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
++ if (memblock_reserve(bad_pages[i], PAGE_SIZE))
++ printk(KERN_WARNING "failed to reserve 0x%08lx\n",
++ bad_pages[i]);
++ }
++}
++
++/*
++ * Here we put platform-specific memory range workarounds, i.e.
++ * memory known to be corrupt or otherwise in need to be reserved on
++ * specific platforms.
++ *
++ * If this gets used more widely it could use a real dispatch mechanism.
++ */
++static void __init trim_platform_memory_ranges(void)
++{
++ trim_snb_memory();
++}
++
+ static void __init trim_bios_range(void)
+ {
+ /*
+@@ -640,6 +715,7 @@ static void __init trim_bios_range(void)
+ * take them out.
+ */
+ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
++
+ sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+ }
+
+@@ -919,6 +995,8 @@ void __init setup_arch(char **cmdline_p)
+
+ setup_trampolines();
+
++ trim_platform_memory_ranges();
++
+ init_gbpages();
+
+ /* max_pfn_mapped is updated here */