[kernel] r22145 - in dists/wheezy-backports/linux: . debian debian/bin debian/config debian/config/armhf debian/config/kernelarch-x86 debian/config/mips64 debian/config/mips64el debian/installer/armhf/modules/armhf-armmp debian/lib/python/debian_linux debian/patches debian/patches/bugfix/all debian/patches/bugfix/arm64 debian/patches/bugfix/mips debian/patches/bugfix/x86 debian/patches/debian debian/patches/features/all debian/patches/features/arm debian/patches/features/arm64 debian/patches/features/x86/apple-tb
Ben Hutchings
benh at moszumanska.debian.org
Mon Dec 8 23:02:20 UTC 2014
Author: benh
Date: Mon Dec 8 23:02:20 2014
New Revision: 22145
Log:
Merge changes from sid up to 3.16.7-ckt2-1
Drop ABI reference for 3.16.0-4
Added:
dists/wheezy-backports/linux/debian/bin/ckt-stable-update.sh
- copied unchanged from r22142, dists/sid/linux/debian/bin/ckt-stable-update.sh
dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules
- copied unchanged from r22142, dists/sid/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules
dists/wheezy-backports/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch
dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch
dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch
dists/wheezy-backports/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch
dists/wheezy-backports/linux/debian/patches/debian/of-fix-abi-changes.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/debian/of-fix-abi-changes.patch
dists/wheezy-backports/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch
dists/wheezy-backports/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch
dists/wheezy-backports/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch
dists/wheezy-backports/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch
dists/wheezy-backports/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch
dists/wheezy-backports/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch
dists/wheezy-backports/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch
dists/wheezy-backports/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch
dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch
dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch
dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch
- copied unchanged from r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch
Deleted:
dists/wheezy-backports/linux/debian/patches/bugfix/all/SUNRPC-Don-t-wake-tasks-during-connection-abort.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/builddeb-put-the-dbg-files-into-the-correct-director.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/fuse-honour-max_read-and-max_write-in-direct_io-mode.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/lockd-Try-to-reconnect-if-statd-has-moved.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/mnt-Prevent-pivot_root-from-creating-a-loop-in-the-m.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/mtd-m25p80-get-rid-of-spi_get_device_id.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/mtd-m25p80-spi-nor-Fix-module-aliases-for-m25p80.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/mtd-move-support-for-struct-flash_platform_data-into.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/mtd-spi-nor-make-spi_nor_scan-take-a-chip-type-name-.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/net-mv643xx-disable-tso-by-default.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/net-sctp-fix-panic-on-duplicate-ASCONF-chunks.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/net-sctp-fix-remote-memory-pressure-from-excessive-q.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/net-sctp-fix-skb_over_panic-when-receiving-malformed.patch
dists/wheezy-backports/linux/debian/patches/bugfix/all/switch-iov_iter_get_pages-to-passing-maximal-number-.patch
dists/wheezy-backports/linux/debian/patches/bugfix/mips/MIPS-cp1emu-Fix-ISA-restrictions-for-cop1x_op-instru.patch
dists/wheezy-backports/linux/debian/patches/bugfix/mips/MIPS-tlbex-Properly-fix-HUGE-TLB-Refill-exception-ha.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Check-non-canonical-addresses-upon-WRMSR.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Emulator-fixes-for-eip-canonical-checks-on-n.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Fix-wrong-masking-on-relative-jump-call.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Handle-errors-when-RIP-is-set-during-far-jum.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Improve-thread-safety-in-pit.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/KVM-x86-Prevent-host-from-panicking-on-shared-MSR-wr.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/kvm-vmx-handle-invvpid-vm-exit-gracefully.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/kvm-x86-fix-far-jump-to-non-canonical-check.patch
dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86-reject-x32-executables-if-x32-abi-not-supported.patch
dists/wheezy-backports/linux/debian/patches/features/all/wireless-rt2x00-add-new-rt2800usb-device.patch
Modified:
dists/wheezy-backports/linux/ (props changed)
dists/wheezy-backports/linux/debian/changelog
dists/wheezy-backports/linux/debian/config/armhf/config.armmp
dists/wheezy-backports/linux/debian/config/defines
dists/wheezy-backports/linux/debian/config/kernelarch-x86/config
dists/wheezy-backports/linux/debian/config/mips64/defines (props changed)
dists/wheezy-backports/linux/debian/config/mips64el/defines (props changed)
dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/usb-modules
dists/wheezy-backports/linux/debian/lib/python/debian_linux/debian.py
dists/wheezy-backports/linux/debian/patches/series
Copied: dists/wheezy-backports/linux/debian/bin/ckt-stable-update.sh (from r22142, dists/sid/linux/debian/bin/ckt-stable-update.sh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/bin/ckt-stable-update.sh Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/bin/ckt-stable-update.sh)
@@ -0,0 +1,76 @@
+#!/bin/bash -eu
+
+if [ $# -ne 2 ]; then
+ echo >&2 "Usage: $0 REPO VERSION"
+ echo >&2 "REPO is the git repository to generate a changelog from"
+ echo >&2 "VERSION is the stable version (without leading v)"
+ exit 2
+fi
+
+# Get base version, i.e. the stable release that a branch started from
+base_version() {
+ local ver
+ ver="${1%-rc*}"
+ case "$ver" in
+ *-ckt*)
+ ver="${ver%-*}"
+ ;;
+ esac
+ echo "$ver"
+}
+
+add_update() {
+ local base update
+ base="$(base_version "$1")"
+ update="${1#$base-ckt}"
+ if [ "$update" = "$1" ]; then
+ update=0
+ fi
+ update="$((update + $2))"
+ if [ $update = 0 ]; then
+ echo "$base"
+ else
+ echo "$base-ckt$update"
+ fi
+}
+
+# Get next stable update version
+next_update() {
+ add_update "$1" 1
+}
+
+export GIT_DIR="$1/.git"
+
+new_ver="$2"
+cur_pkg_ver="$(dpkg-parsechangelog | sed -n 's/^Version: //p')"
+cur_ver="${cur_pkg_ver%-*}"
+
+if [ "$(base_version "$new_ver")" != "$(base_version "$cur_ver")" ]; then
+ echo >&2 "$new_ver is not on the same stable series as $cur_ver"
+ exit 2
+fi
+
+case "$cur_pkg_ver" in
+ *~exp*)
+ new_pkg_ver="$new_ver-1~exp1"
+ ;;
+ *)
+ new_pkg_ver="$new_ver-1"
+ ;;
+esac
+
+# dch insists on word-wrapping everything, so just add the first line initially
+dch -v "$new_pkg_ver" --preserve --multimaint-merge -D UNRELEASED \
+ --release-heuristic=changelog 'New upstream stable update:'
+
+# Then append the shortlogs with sed
+sed -i '1,/^ --/ { /New upstream stable update:/ { a\
+'"$(
+while [ "v$cur_ver" != "v$new_ver" ]; do
+ next_ver="$(next_update "$cur_ver")"
+ echo " http://kernel.ubuntu.com/stable/ChangeLog-$next_ver\\"
+ git log --reverse --pretty=' - %s\' "v$cur_ver..v$next_ver^"
+ cur_ver="$next_ver"
+done)"'
+
+} }' debian/changelog
Modified: dists/wheezy-backports/linux/debian/changelog
==============================================================================
--- dists/wheezy-backports/linux/debian/changelog Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/changelog Mon Dec 8 23:02:20 2014 (r22145)
@@ -1,4 +1,4 @@
-linux (3.16.7-2~bpo70+1) wheezy-backports; urgency=low
+linux (3.16.7-ckt2-1~bpo70+1) wheezy-backports; urgency=low
* Rebuild for wheezy:
- Disable architectures that weren't part of wheezy
@@ -8,7 +8,281 @@
- linux-image: Add versioned Breaks for dracut so that aptitude will
not switch from initramfs-tools to dracut (Closes: #771379)
- -- Ben Hutchings <ben at decadent.org.uk> Mon, 01 Dec 2014 22:28:28 +0000
+ -- Ben Hutchings <ben at decadent.org.uk> Mon, 08 Dec 2014 23:00:13 +0000
+
+linux (3.16.7-ckt2-1) unstable; urgency=high
+
+ * New upstream stable update:
+ http://kernel.ubuntu.com/stable/ChangeLog-3.16.7-ckt1
+ - drm/tilcdc: Fix the error path in tilcdc_load()
+ - usb: phy: return -ENODEV on failure of try_module_get
+ - PM / clk: Fix crash in clocks management code if !CONFIG_PM_RUNTIME
+ - rt2x00: support Ralink 5362.
+ - wireless: rt2x00: add new rt2800usb devices
+ - NFS: Fix /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes
+ - nfs: fix duplicate proc entries
+ - mm: page_alloc: fix zone allocation fairness on UP
+ - ext4: check EA value offset when loading
+ - jbd2: free bh when descriptor block checksum fails
+ - ext4: don't check quota format when there are no quota files
+ - target: Fix queue full status NULL pointer for SCF_TRANSPORT_TASK_SENSE
+ - vfs: fix data corruption when blocksize < pagesize for mmaped data
+ - ext4: fix mmap data corruption when blocksize < pagesize
+ - ext4: grab missed write_count for EXT4_IOC_SWAP_BOOT
+ - qla_target: don't delete changed nacls
+ - target: Fix APTPL metadata handling for dynamic MappedLUNs
+ - iser-target: Disable TX completion interrupt coalescing
+ - ext4: don't orphan or truncate the boot loader inode
+ - ext4: add ext4_iget_normal() which is to be used for dir tree lookups
+ - ext4: fix reservation overflow in ext4_da_write_begin
+ - ext4: Replace open coded mdata csum feature to helper function
+ - ext4: move error report out of atomic context in ext4_init_block_bitmap()
+ - ext4: check s_chksum_driver when looking for bg csum presence
+ - drm/radeon: fix speaker allocation setup
+ - drm/radeon: use gart memory for DMA ring tests
+ - random: add and use memzero_explicit() for clearing data
+ - freezer: Do not freeze tasks killed by OOM killer
+ - OOM, PM: OOM killed task shouldn't escape PM suspend
+ - [mips*/loongson-2f] loongson2_cpufreq: Fix CPU clock rate setting mismerge
+ - drm/cirrus: bind also to qemu-xen-traditional
+ - cpufreq: intel_pstate: Fix setting max_perf_pct in performance policy
+ - cpufreq: expose scaling_cur_freq sysfs file for set_policy() drivers
+ - cpufreq: intel_pstate: Reflect current no_turbo state correctly
+ - [x86] intel_pstate: Don't lose sysfs settings during cpu offline
+ - [x86] intel_pstate: Fix BYT frequency reporting
+ - [x86] intel_pstate: Correct BYT VID values.
+ - [x86] kvm: don't kill guest on unknown exit reason
+ - kvm: fix excessive pages un-pinning in kvm_iommu_map error path.
+ (CVE-2014-8369)
+ - vfs: be careful with nd->inode in path_init() and follow_dotdot_rcu()
+ - pstore: Fix duplicate {console,ftrace}-efi entries
+ - [x86] bpf_jit: fix two bugs in eBPF JIT compiler (regression in 3.16)
+ - vxlan: fix a use after free in vxlan_encap_bypass
+ - vxlan: using pskb_may_pull as early as possible
+ - vxlan: fix a free after use
+ - ipv4: dst_entry leak in ip_send_unicast_reply()
+ - ipv4: fix a potential use after free in ip_tunnel_core.c
+ (regression in 3.11)
+ - net: tso: fix unaligned access to crafted TCP header in helper API
+ - [x86] hyperv: Fix the total_data_buflen in send path
+ - tcp: md5: do not use alloc_percpu()
+ - macvlan: fix a race on port dismantle and possible skb leaks
+ (regression in 3.16)
+ - net/mlx4_en: Don't attempt to TX offload the outer UDP checksum for VXLAN
+ (regression in 3.14)
+ - gre: Use inner mac length when computing tunnel length
+ (regression in 3.14)
+ - [armhf] spi: pl022: Fix incorrect dma_unmap_sg
+ - mac80211: fix typo in starting baserate for rts_cts_rate_idx
+ - staging: comedi: (regression) channel list must be set for COMEDI_CMD
+ ioctl (regression in 3.15)
+ - nfsd4: fix response size estimation for OP_SEQUENCE (regression in 3.16)
+ - quota: Properly return errors from dquot_writeback_dquots()
+ - i3200_edac: Report CE events properly
+ - i82860_edac: Report CE events properly
+ - cpc925_edac: Report UE events properly
+ - e7xxx_edac: Report CE events properly
+ - scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND
+ - usb: serial: ftdi_sio: add "bricked" FTDI device PID
+ - [armhf] Revert "usb: dwc3: dwc3-omap: Disable/Enable only wrapper
+ interrupts in prepare/complete" (regression in 3.16)
+ - usb: gadget: f_fs: remove redundant ffs_data_get() (regression in 3.14)
+ - [armhf] usb: ffs: fix regression when quirk_ep_out_aligned_size flag is
+ set (regression in 3.15)
+ - [armhf] usb: musb: dsps: start OTG timer on resume again
+ (regression in 3.16.6)
+ - usb: gadget: udc: core: fix kernel oops with soft-connect
+ - nfsd4: fix crash on unknown operation number
+ - Revert "iwlwifi: mvm: treat EAPOLs like mgmt frames wrt rate"
+ (regression in 3.16.4)
+ - [armhf] usb: dwc3: gadget: Properly initialize LINK TRB
+ - posix-timers: Fix stack info leak in timer_create()
+ - futex: Fix a race condition between REQUEUE_PI and task death
+ - ALSA: bebob: Uninitialized id returned by saffirepro_both_clk_src_get
+ - PM / Sleep: fix async suspend_late/freeze_late error handling
+ (regression in 3.15)
+ - Revert "block: all blk-mq requests are tagged" (regression in 3.16)
+ - ALSA: pcm: Zero-clear reserved fields of PCM status ioctl in compat mode
+ - zap_pte_range: update addr when forcing flush after TLB batching faiure
+ - staging: comedi: fix memory leak / bad pointer freeing for chanlist
+ (regression in 3.15)
+ - [x86] drm/i915: Ignore VBT backlight check on Macbook 2, 1
+ (regression in 3.15)
+ - [i386/686-pae] pageattr: Prevent overflow in slow_virt_to_phys() for
+ X86_PAE
+ - [x86] ACPI / EC: Fix regression due to conflicting firmware behavior
+ between Samsung and Acer. (regression in 3.16.3)
+ - mm: free compound page with correct order
+ - lib/bitmap.c: fix undefined shift in __bitmap_shift_{left|right}()
+ - ext4: fix overflow when updating superblock backups after resize
+ - ext4: fix oops when loading block bitmap failed
+ - ext4: enable journal checksum when metadata checksum feature enabled
+ - ext4: prevent bugon on race between write/fcntl
+ - ext4: bail out from make_indexed_dir() on first error
+ - PCI: Rename sysfs 'enabled' file back to 'enable' (regression in 3.13)
+ - fs: allow open(dir, O_TMPFILE|..., 0) with mode 0
+ - [arm*] tracing/syscalls: Ignore numbers outside NR_syscalls' range
+ - nfs: fix kernel warning when removing proc entry
+ http://kernel.ubuntu.com/stable/ChangeLog-3.16.7-ckt2
+ - rbd: Fix error recovery in rbd_obj_read_sync()
+ - regulator: max77693: Fix use of uninitialized regulator config
+ - xhci: no switching back on non-ULT Haswell (regression in 3.12)
+ - Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error cleanup
+ - ocfs2: fix breakage in o2net_send_tcp_msg() (regression in 3.15)
+ - [armhf] phy: omap-usb2: Enable runtime PM of omap-usb2 phy properly
+ (regression in 3.16)
+ - USB: cdc-acm: add quirk for control-line state requests
+ (regression in 3.16)
+ - sysfs: driver core: Fix glue dir race condition by gdp_mutex
+ - drm/nouveau: make sure display hardware is reinitialised on runtime
+ resume (regression in 3.15)
+ - drm/nv50/disp: fix dpms regression on certain boards
+ - drm/nouveau/bios: memset dcb struct to zero before parsing
+ - GFS2: Make rename not save dirent location (regression in 3.14)
+ - netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
+ - netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats
+ allocation (regression in 3.16)
+ - netfilter: nfnetlink_log: fix maximum packet length logged to userspace
+ - netfilter: nft_compat: fix wrong target lookup in nft_target_select_ops()
+ - mmc: core: sdio: Fix unconditional wake_up_process() on sdio thread
+ (regression in 3.16)
+ - mmc: don't request CD IRQ until mmc_start_host()
+ - fs: make cont_expand_zero interruptible
+ - UBIFS: fix a race condition
+ - [x86] fpu: __restore_xstate_sig()->math_state_restore() needs
+ preempt_disable()
+ - [x86] fpu: shift drop_init_fpu() from save_xstate_sig() to
+ handle_signal()
+ - perf: Fix unclone_ctx() vs. locking
+ - evm: properly handle INTEGRITY_NOXATTRS EVM status
+ - [alpha] vfs: missing data dependency barrier in prepend_name()
+ - jffs2: kill wbuf_queued/wbuf_dwork_lock
+ - fix misuses of f_count() in ppp and netlink
+ - sched: Use dl_bw_of() under RCU read lock
+ - [s390*] topology: call set_sched_topology early
+ - [armhf] mfd: ti_am335x_tscadc: Fix TSC operation after ADC continouous
+ mode (regression in 3.14)
+ - [armhf] mfd: ti_am335x_tscadc: Fix TSC resume (regression in 3.14)
+ - selinux: fix inode security list corruption
+ - blk-mq: fix potential hang if rolling wakeup depth is too high
+ (regression in 3.16)
+ - block: fix alignment_offset math that assumes io_min is a power-of-2
+ - drm/nouveau/gpio: rename g92 class to g94 (regression in 3.16)
+ - [x86] drm/i915: Do not leak pages when freeing userptr objects
+ - media: v4l2-common: fix overflow in v4l_bound_align_image()
+ - sched: Use rq->rd in sched_setaffinity() under RCU read lock
+ - [powerpc*] use device_online/offline() instead of cpu_up/down()
+ (regression in 3.11)
+ - xen-blkback: fix leak on grant map error path
+ - net: skb_fclone_busy() needs to detect orphaned skb (regression in 3.16)
+ - rbd: avoid format-security warning inside alloc_workqueue()
+ - rbd: fix error return code in rbd_dev_device_setup()
+ - media: ttusb-dec: buffer overflow in ioctl (CVE-2014-8884)
+ - dm raid: ensure superblock's size matches device's logical block size
+ - ahci: disable MSI instead of NCQ on Samsung pci-e SSDs on macbooks
+ (Closes: #772435)
+ - mac80211: properly flush delayed scan work on interface removal
+ - [i386] microcode, AMD: Fix early ucode loading on 32-bit
+ (regression in 3.14)
+ - [armhf] mvebu: armada xp: Generalize use of i2c quirk
+ (regression in 3.12)
+ - mac80211: fix use-after-free in defragmentation
+ - iwlwifi: fix RFkill while calibrating (regression in 3.16)
+ - tun: Fix csum_start with VLAN acceleration (regression in 3.12)
+ - macvtap: Fix csum_start when VLAN tags are present
+ - dm thin: grab a virtual cell before looking up the mapping
+ - [x86] KVM: Fix uninitialized op->type for some immediate values
+ - [powerpc*] hwrng: pseries - port to new read API and fix stack corruption
+ - drm/radeon: set correct CE ram size for CIK
+ - drm/radeon: make sure mode init is complete in bandwidth_update
+ - cpufreq: Avoid crash in resume on SMP without OPP (regresion in 3.12)
+ - [i386] microcode, AMD: Fix ucode patch stashing on 32-bit
+ (regression in 3.14)
+ - [armhf] mfd: twl4030-power: Fix poweroff with PM configuration enabled
+ (regression in 3.16)
+ - [hppa] Use compat layer for msgctl, shmat, shmctl and semtimedop syscalls
+ - tracing: Do not busy wait in buffer splice (regresion in 3.16)
+ - param: fix crash on bad kernel arguments (regression in 3.16)
+ - audit: keep inode pinned
+ - drm/radeon: add locking around atombios scratch space usage
+ - nfs: fix pnfs direct write memory leak
+ - nfs: Fix use of uninitialized variable in nfs_getattr()
+ - NFSv4: Ensure that we remove NFSv4.0 delegations when state has expired
+ - NFSv4.1: nfs41_clear_delegation_stateid shouldn't trust
+ NFS_DELEGATED_STATE
+ - NFSv4: Fix races between nfs_remove_bad_delegation() and delegation
+ return
+ - NFSv4: Ensure that we call FREE_STATEID when NFSv4.x stateids are revoked
+ - NFS: Don't try to reclaim delegation open state if recovery failed
+ - [arm64] efi: Fix stub cache maintenance
+ - [arm64] __clear_user: handle exceptions on strb (CVE-2014-7843)
+ - [arm64] Correct the race condition in aarch64_insn_patch_text_sync()
+ - Fix thinko in iov_iter_single_seg_count
+ - libceph: do not crash on large auth tickets
+ - [armel,armhf] 8191/1: decompressor: ensure I-side picks up relocated code
+ - zram: avoid kunmap_atomic() of a NULL pointer
+ - firewire: cdev: prevent kernel stack leaking into ioctl arguments
+ - md: Always set RECOVERY_NEEDED when clearing RECOVERY_FROZEN
+ (regression in 3.13)
+ - vxlan: Do not reuse sockets for a different address family
+ - net: sctp: fix NULL pointer dereference in af->from_addr_param on
+ malformed packet (CVE-2014-7841)
+ - net: sctp: fix memory leak in auth key management
+ - [armel,m68k] ipv6: fix IPV6_PKTINFO with v4 mapped (regression in 3.15)
+ - netlink: Properly unbind in error conditions. (regression in 3.16)
+ - smsc911x: power-up phydev before doing a software reset.
+ (regression in 3.14)
+ - [sparc*] sunvdc: limit each sg segment to a page
+ - [sparc*] vio: fix reuse of vio_dring slot
+ - drm/radeon: initialize sadb to NULL in the audio code
+ - [x86] KVM: Don't report guest userspace emulation error to userspace
+ - crypto: caam - remove duplicated sg copy functions
+ - audit: correct AUDIT_GET_FEATURE return message type
+ - memory-hotplug: Remove "weak" from memory_block_size_bytes() declaration
+ (regression in 3.14)
+ - [s390*] vmcore: Remove "weak" from function declarations
+ - [s390*] clocksource: Remove "weak" from clocksource_default_clock()
+ declaration
+ - IB/core: Clear AH attr variable to prevent garbage data
+ - [amd64] x32, audit: Fix x32's AUDIT_ARCH wrt audit
+ - [armhf] dts: am335x-evm: Fix 5th NAND partition's name
+ (regression in 3.15)
+ - dell-wmi: Fix access out of memory
+
+ [ Ben Hutchings ]
+ * [x86] Complete Thunderbolt support on Apple computers (Closes: #768653)
+ - PCI: Add pci_fixup_suspend_late quirk pass
+ - PCI: Suspend/resume quirks for Apple thunderbolt
+ - Enable THUNDERBOLT as module
+ * [amd64] traps: Stop using IST for #SS (CVE-2014-9090)
+ * [amd64] traps: Fix the espfix64 #DF fixup and rewrite it in C
+ * [amd64] traps: Rework bad_iret
+ * [amd64] asm/traps: Disable tracing and kprobes in fixup_bad_iret and
+ sync_regs
+ * Fix ABI changes in iovec, of, perf and truncate
+ * Ignore ABI changes in iwlwifi, KVM and spi-nor
+ * Revert "drivers/net: Disable UFO through virtio" in macvtap and tun.
+ This removes the need to shut down VMs if migrating to a patched
+ host.
+
+ [ Ian Campbell ]
+ * [xen] Backport various netback fixes (Closes: #767261).
+ * Backport fix for TSO with mv643xx_eth driver, replacing previous workaround
+ (#764162)
+ * [armhf] Increase Ethernet phy startup delay on Banana-Pi. Patch from
+ Karsten Merker (Closes: #767042)
+ * [armhf] Enable FB_SIMPLE, used on some Exynos platforms and elsewhere.
+ * [arm64] Backport various upstream fixes and improvements to the APM X-gene
+ Ethernet driver.
+ * Honour stdout-path from Device Tree, along with supporting any supplied
+ options. (Closes: #770212)
+ * [armhf] Add udeb modules to support video and keyboard for imx6. Patch from
+ Vagrant Cascadian (Closes: #770635)
+ * [device-tree] Reserve memreserve regions even if they partially overlap
+ with an existing reservation. Fixes boot on Midway.
+ * [arm64] Enable reboot on the Xgene platform.
+
+ -- Ben Hutchings <ben at decadent.org.uk> Mon, 08 Dec 2014 20:03:18 +0000
linux (3.16.7-2) unstable; urgency=medium
Modified: dists/wheezy-backports/linux/debian/config/armhf/config.armmp
==============================================================================
--- dists/wheezy-backports/linux/debian/config/armhf/config.armmp Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/config/armhf/config.armmp Mon Dec 8 23:02:20 2014 (r22145)
@@ -822,6 +822,7 @@
CONFIG_FB_ARMCLCD=y
CONFIG_FB_VT8500=y
CONFIG_FB_WM8505=y
+CONFIG_FB_SIMPLE=y
##
## file: drivers/video/fbdev/omap2/dss/Kconfig
Modified: dists/wheezy-backports/linux/debian/config/defines
==============================================================================
--- dists/wheezy-backports/linux/debian/config/defines Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/config/defines Mon Dec 8 23:02:20 2014 (r22145)
@@ -1,5 +1,9 @@
[abi]
abiname: 0.bpo.4
+ignore-changes:
+ module:arch/x86/kvm/kvm
+ module:drivers/mtd/spi-nor/spi-nor
+ module:drivers/net/wireless/iwlwifi/iwlwifi
[base]
arches:
Modified: dists/wheezy-backports/linux/debian/config/kernelarch-x86/config
==============================================================================
--- dists/wheezy-backports/linux/debian/config/kernelarch-x86/config Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/config/kernelarch-x86/config Mon Dec 8 23:02:20 2014 (r22145)
@@ -1558,6 +1558,11 @@
CONFIG_ACPI_INT3403_THERMAL=m
##
+## file: drivers/thunderbolt/Kconfig
+##
+CONFIG_THUNDERBOLT=m
+
+##
## file: drivers/tty/Kconfig
##
CONFIG_VT=y
Copied: dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules (from r22142, dists/sid/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/installer/armhf/modules/armhf-armmp/fb-modules)
@@ -0,0 +1,2 @@
+imx-ipuv3-crtc
+imx-hdmi
Modified: dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/usb-modules
==============================================================================
--- dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/usb-modules Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/installer/armhf/modules/armhf-armmp/usb-modules Mon Dec 8 23:02:20 2014 (r22145)
@@ -5,3 +5,4 @@
ehci-exynos
phy-exynos-usb2
ci_hdrc_imx
+phy-mxs-usb
Modified: dists/wheezy-backports/linux/debian/lib/python/debian_linux/debian.py
==============================================================================
--- dists/wheezy-backports/linux/debian/lib/python/debian_linux/debian.py Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/lib/python/debian_linux/debian.py Mon Dec 8 23:02:20 2014 (r22145)
@@ -116,8 +116,9 @@
\d+\.\d+
)
(?P<update>
- \.\d+
-)?
+ (?:\.\d+)?
+ (?:-[a-z]+\d+)?
+)
(?:
~
(?P<modifier>
@@ -163,7 +164,7 @@
self.linux_upstream = u'-'.join((d['version'], d['modifier']))
else:
self.linux_upstream = d['version']
- self.linux_upstream_full = self.linux_upstream + (d['update'] or u'')
+ self.linux_upstream_full = self.linux_upstream + d['update']
self.linux_dfsg = d['dfsg']
self.linux_revision_experimental = match.group('revision_experimental') and True
self.linux_revision_backports = match.group('revision_backports') and True
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch)
@@ -0,0 +1,53 @@
+From a636289fb6037392c3551aeed1033576c3aef426 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ian.campbell at citrix.com>
+Date: Tue, 25 Nov 2014 15:05:13 +0000
+Subject: [PATCH] of/fdt: memblock_reserve /memreserve/ regions in the case of
+ partial overlap
+Origin: https://git.kernel.org/cgit/linux/kernel/git/glikely/linux.git/commit/?h=devicetree/merge&id=094cb98179f19b75acf9ff471daabf3948ce98e6
+
+memblock_is_region_reserved() returns true in the case of a partial
+overlap, meaning that the current code fails to reserve the
+non-overlapping portion.
+
+This call was introduced as part of d1552ce449eb "of/fdt: move
+memreserve and dtb memory reservations into core" which went into
+v3.16.
+
+I observed this causing a Midway system with a buggy fdt (the header
+declares itself to be larger than it really is) failing to boot
+because the over-inflated size of the fdt was causing it to seem to
+run into the swapper_pg_dir region, meaning the DT wasn't reserved.
+The symptoms were failing to find an disks or network and failing to
+boot.
+
+However given the ambiguity of whether things like the initrd are
+covered by /memreserve/ and similar I think it is best to also
+register the region rather than just ignoring it.
+
+Since memblock_reserve() handles overlaps just fine lets just warn and
+carry on.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: Grant Likely <grant.likely at linaro.org>
+Cc: Rob Herring <robh+dt at kernel.org>
+Cc: stable at vger.kernel.org # v3.16+
+---
+ drivers/of/fdt.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
+index 379ad4f..94a8511 100644
+--- a/drivers/of/fdt.c
++++ b/drivers/of/fdt.c
+@@ -960,8 +960,6 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
+ phys_addr_t size, bool nomap)
+ {
+- if (memblock_is_region_reserved(base, size))
+- return -EBUSY;
+ if (nomap)
+ return memblock_remove(base, size);
+ return memblock_reserve(base, size);
+--
+2.1.3
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch)
@@ -0,0 +1,129 @@
+Subject: Revert "drivers/net: Disable UFO through virtio" in macvtap and tun
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Tue, 11 Nov 2014 17:12:58 +0000
+
+This reverts commit 88e0e0e5aa722b193c8758c8b45d041de5316924 for
+the tap drivers, but leaves UFO disabled in virtio_net.
+
+libvirt at least assumes that tap features will never be dropped
+in new kernel versions, and doing so prevents migration of VMs to
+the never kernel version while they are running with virtio net
+devices.
+
+Fixes: 88e0e0e5aa7a ("drivers/net: Disable UFO through virtio")
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+ drivers/net/macvtap.c | 13 ++++++++-----
+ drivers/net/tun.c | 19 ++++++++-----------
+ 2 files changed, 16 insertions(+), 16 deletions(-)
+
+--- a/drivers/net/macvtap.c
++++ b/drivers/net/macvtap.c
+@@ -66,7 +66,7 @@ static struct cdev macvtap_cdev;
+ static const struct proto_ops macvtap_socket_ops;
+
+ #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \
+- NETIF_F_TSO6)
++ NETIF_F_TSO6 | NETIF_F_UFO)
+ #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO)
+ #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG)
+
+@@ -570,8 +570,6 @@ static int macvtap_skb_from_vnet_hdr(str
+ gso_type = SKB_GSO_TCPV6;
+ break;
+ case VIRTIO_NET_HDR_GSO_UDP:
+- pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n",
+- current->comm);
+ gso_type = SKB_GSO_UDP;
+ if (skb->protocol == htons(ETH_P_IPV6))
+ ipv6_proxy_select_ident(skb);
+@@ -619,6 +617,8 @@ static void macvtap_skb_to_vnet_hdr(cons
+ vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
+ else if (sinfo->gso_type & SKB_GSO_TCPV6)
+ vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
++ else if (sinfo->gso_type & SKB_GSO_UDP)
++ vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
+ else
+ BUG();
+ if (sinfo->gso_type & SKB_GSO_TCP_ECN)
+@@ -955,6 +955,9 @@ static int set_offload(struct macvtap_qu
+ if (arg & TUN_F_TSO6)
+ feature_mask |= NETIF_F_TSO6;
+ }
++
++ if (arg & TUN_F_UFO)
++ feature_mask |= NETIF_F_UFO;
+ }
+
+ /* tun/tap driver inverts the usage for TSO offloads, where
+@@ -965,7 +968,7 @@ static int set_offload(struct macvtap_qu
+ * When user space turns off TSO, we turn off GSO/LRO so that
+ * user-space will not receive TSO frames.
+ */
+- if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6))
++ if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO))
+ features |= RX_OFFLOADS;
+ else
+ features &= ~RX_OFFLOADS;
+@@ -1066,7 +1069,7 @@ static long macvtap_ioctl(struct file *f
+ case TUNSETOFFLOAD:
+ /* let the user check for future flags */
+ if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 |
+- TUN_F_TSO_ECN))
++ TUN_F_TSO_ECN | TUN_F_UFO))
+ return -EINVAL;
+
+ rtnl_lock();
+--- a/drivers/net/tun.c
++++ b/drivers/net/tun.c
+@@ -175,7 +175,7 @@ struct tun_struct {
+ struct net_device *dev;
+ netdev_features_t set_features;
+ #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \
+- NETIF_F_TSO6)
++ NETIF_F_TSO6|NETIF_F_UFO)
+
+ int vnet_hdr_sz;
+ int sndbuf;
+@@ -1152,20 +1152,10 @@ static ssize_t tun_get_user(struct tun_s
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+ break;
+ case VIRTIO_NET_HDR_GSO_UDP:
+- {
+- static bool warned;
+-
+- if (!warned) {
+- warned = true;
+- netdev_warn(tun->dev,
+- "%s: using disabled UFO feature; please fix this program\n",
+- current->comm);
+- }
+ skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
+ if (skb->protocol == htons(ETH_P_IPV6))
+ ipv6_proxy_select_ident(skb);
+ break;
+- }
+ default:
+ tun->dev->stats.rx_frame_errors++;
+ kfree_skb(skb);
+@@ -1269,6 +1259,8 @@ static ssize_t tun_put_user(struct tun_s
+ gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
+ else if (sinfo->gso_type & SKB_GSO_TCPV6)
+ gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
++ else if (sinfo->gso_type & SKB_GSO_UDP)
++ gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
+ else {
+ pr_err("unexpected GSO type: "
+ "0x%x, gso_size %d, hdr_len %d\n",
+@@ -1775,6 +1767,11 @@ static int set_offload(struct tun_struct
+ features |= NETIF_F_TSO6;
+ arg &= ~(TUN_F_TSO4|TUN_F_TSO6);
+ }
++
++ if (arg & TUN_F_UFO) {
++ features |= NETIF_F_UFO;
++ arg &= ~TUN_F_UFO;
++ }
+ }
+
+ /* This gives the user a way to test for new features in future by
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch)
@@ -0,0 +1,316 @@
+From 5fe1b16f4eedda3a3bdceb2a0f65a0e7816555ab Mon Sep 17 00:00:00 2001
+From: Zoltan Kiss <zoltan.kiss at citrix.com>
+Date: Tue, 8 Jul 2014 19:49:14 +0100
+Subject: [PATCH 01/14] xen-netback: Adding debugfs "io_ring_qX" files
+Origin: https://git.kernel.org/linus/f51de24356e49e4dcb5095e87717065580912120
+
+This patch adds debugfs capabilities to netback. There used to be a similar
+patch floating around for classic kernel, but it used procfs. It is based on a
+very similar blkback patch.
+It creates xen-netback/[vifname]/io_ring_q[queueno] files, reading them output
+various ring variables etc. Writing "kick" into it imitates an interrupt
+happened, it can be useful to check whether the ring is just stalled due to a
+missed interrupt.
+
+Signed-off-by: Zoltan Kiss <zoltan.kiss at citrix.com>
+Cc: netdev at vger.kernel.org
+Cc: linux-kernel at vger.kernel.org
+Cc: xen-devel at lists.xenproject.org
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit f51de24356e49e4dcb5095e87717065580912120)
+---
+ drivers/net/xen-netback/common.h | 11 +++
+ drivers/net/xen-netback/interface.c | 2 +-
+ drivers/net/xen-netback/netback.c | 11 +++
+ drivers/net/xen-netback/xenbus.c | 178 ++++++++++++++++++++++++++++++++++-
+ 4 files changed, 200 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index 2532ce8..28c9822 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -44,6 +44,7 @@
+ #include <xen/interface/grant_table.h>
+ #include <xen/grant_table.h>
+ #include <xen/xenbus.h>
++#include <linux/debugfs.h>
+
+ typedef unsigned int pending_ring_idx_t;
+ #define INVALID_PENDING_RING_IDX (~0U)
+@@ -224,6 +225,10 @@ struct xenvif {
+ struct xenvif_queue *queues;
+ unsigned int num_queues; /* active queues, resource allocated */
+
++#ifdef CONFIG_DEBUG_FS
++ struct dentry *xenvif_dbg_root;
++#endif
++
+ /* Miscellaneous private stuff. */
+ struct net_device *dev;
+ };
+@@ -297,10 +302,16 @@ static inline pending_ring_idx_t nr_pending_reqs(struct xenvif_queue *queue)
+ /* Callback from stack when TX packet can be released */
+ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success);
+
++irqreturn_t xenvif_interrupt(int irq, void *dev_id);
++
+ extern bool separate_tx_rx_irq;
+
+ extern unsigned int rx_drain_timeout_msecs;
+ extern unsigned int rx_drain_timeout_jiffies;
+ extern unsigned int xenvif_max_queues;
+
++#ifdef CONFIG_DEBUG_FS
++extern struct dentry *xen_netback_dbg_root;
++#endif
++
+ #endif /* __XEN_NETBACK__COMMON_H__ */
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 9e97c7c..ef75b45 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -102,7 +102,7 @@ static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id)
+ return IRQ_HANDLED;
+ }
+
+-static irqreturn_t xenvif_interrupt(int irq, void *dev_id)
++irqreturn_t xenvif_interrupt(int irq, void *dev_id)
+ {
+ xenvif_tx_interrupt(irq, dev_id);
+ xenvif_rx_interrupt(irq, dev_id);
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index c65b636..769e553 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -2027,6 +2027,13 @@ static int __init netback_init(void)
+
+ rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs);
+
++#ifdef CONFIG_DEBUG_FS
++ xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL);
++ if (IS_ERR_OR_NULL(xen_netback_dbg_root))
++ pr_warn("Init of debugfs returned %ld!\n",
++ PTR_ERR(xen_netback_dbg_root));
++#endif /* CONFIG_DEBUG_FS */
++
+ return 0;
+
+ failed_init:
+@@ -2037,6 +2044,10 @@ module_init(netback_init);
+
+ static void __exit netback_fini(void)
+ {
++#ifdef CONFIG_DEBUG_FS
++ if (!IS_ERR_OR_NULL(xen_netback_dbg_root))
++ debugfs_remove_recursive(xen_netback_dbg_root);
++#endif /* CONFIG_DEBUG_FS */
+ xenvif_xenbus_fini();
+ }
+ module_exit(netback_fini);
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 3d85acd..580517d 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -44,6 +44,175 @@ static void unregister_hotplug_status_watch(struct backend_info *be);
+ static void set_backend_state(struct backend_info *be,
+ enum xenbus_state state);
+
++#ifdef CONFIG_DEBUG_FS
++struct dentry *xen_netback_dbg_root = NULL;
++
++static int xenvif_read_io_ring(struct seq_file *m, void *v)
++{
++ struct xenvif_queue *queue = m->private;
++ struct xen_netif_tx_back_ring *tx_ring = &queue->tx;
++ struct xen_netif_rx_back_ring *rx_ring = &queue->rx;
++
++ if (tx_ring->sring) {
++ struct xen_netif_tx_sring *sring = tx_ring->sring;
++
++ seq_printf(m, "Queue %d\nTX: nr_ents %u\n", queue->id,
++ tx_ring->nr_ents);
++ seq_printf(m, "req prod %u (%d) cons %u (%d) event %u (%d)\n",
++ sring->req_prod,
++ sring->req_prod - sring->rsp_prod,
++ tx_ring->req_cons,
++ tx_ring->req_cons - sring->rsp_prod,
++ sring->req_event,
++ sring->req_event - sring->rsp_prod);
++ seq_printf(m, "rsp prod %u (base) pvt %u (%d) event %u (%d)\n",
++ sring->rsp_prod,
++ tx_ring->rsp_prod_pvt,
++ tx_ring->rsp_prod_pvt - sring->rsp_prod,
++ sring->rsp_event,
++ sring->rsp_event - sring->rsp_prod);
++ seq_printf(m, "pending prod %u pending cons %u nr_pending_reqs %u\n",
++ queue->pending_prod,
++ queue->pending_cons,
++ nr_pending_reqs(queue));
++ seq_printf(m, "dealloc prod %u dealloc cons %u dealloc_queue %u\n\n",
++ queue->dealloc_prod,
++ queue->dealloc_cons,
++ queue->dealloc_prod - queue->dealloc_cons);
++ }
++
++ if (rx_ring->sring) {
++ struct xen_netif_rx_sring *sring = rx_ring->sring;
++
++ seq_printf(m, "RX: nr_ents %u\n", rx_ring->nr_ents);
++ seq_printf(m, "req prod %u (%d) cons %u (%d) event %u (%d)\n",
++ sring->req_prod,
++ sring->req_prod - sring->rsp_prod,
++ rx_ring->req_cons,
++ rx_ring->req_cons - sring->rsp_prod,
++ sring->req_event,
++ sring->req_event - sring->rsp_prod);
++ seq_printf(m, "rsp prod %u (base) pvt %u (%d) event %u (%d)\n\n",
++ sring->rsp_prod,
++ rx_ring->rsp_prod_pvt,
++ rx_ring->rsp_prod_pvt - sring->rsp_prod,
++ sring->rsp_event,
++ sring->rsp_event - sring->rsp_prod);
++ }
++
++ seq_printf(m, "NAPI state: %lx NAPI weight: %d TX queue len %u\n"
++ "Credit timer_pending: %d, credit: %lu, usec: %lu\n"
++ "remaining: %lu, expires: %lu, now: %lu\n",
++ queue->napi.state, queue->napi.weight,
++ skb_queue_len(&queue->tx_queue),
++ timer_pending(&queue->credit_timeout),
++ queue->credit_bytes,
++ queue->credit_usec,
++ queue->remaining_credit,
++ queue->credit_timeout.expires,
++ jiffies);
++
++ return 0;
++}
++
++#define XENVIF_KICK_STR "kick"
++
++static ssize_t
++xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
++ loff_t *ppos)
++{
++ struct xenvif_queue *queue =
++ ((struct seq_file *)filp->private_data)->private;
++ int len;
++ char write[sizeof(XENVIF_KICK_STR)];
++
++ /* don't allow partial writes and check the length */
++ if (*ppos != 0)
++ return 0;
++ if (count < sizeof(XENVIF_KICK_STR) - 1)
++ return -ENOSPC;
++
++ len = simple_write_to_buffer(write,
++ sizeof(write),
++ ppos,
++ buf,
++ count);
++ if (len < 0)
++ return len;
++
++ if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1))
++ xenvif_interrupt(0, (void *)queue);
++ else {
++ pr_warn("Unknown command to io_ring_q%d. Available: kick\n",
++ queue->id);
++ count = -EINVAL;
++ }
++ return count;
++}
++
++static int xenvif_dump_open(struct inode *inode, struct file *filp)
++{
++ int ret;
++ void *queue = NULL;
++
++ if (inode->i_private)
++ queue = inode->i_private;
++ ret = single_open(filp, xenvif_read_io_ring, queue);
++ filp->f_mode |= FMODE_PWRITE;
++ return ret;
++}
++
++static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
++ .owner = THIS_MODULE,
++ .open = xenvif_dump_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = xenvif_write_io_ring,
++};
++
++static void xenvif_debugfs_addif(struct xenvif_queue *queue)
++{
++ struct dentry *pfile;
++ struct xenvif *vif = queue->vif;
++ int i;
++
++ if (IS_ERR_OR_NULL(xen_netback_dbg_root))
++ return;
++
++ vif->xenvif_dbg_root = debugfs_create_dir(vif->dev->name,
++ xen_netback_dbg_root);
++ if (!IS_ERR_OR_NULL(vif->xenvif_dbg_root)) {
++ for (i = 0; i < vif->num_queues; ++i) {
++ char filename[sizeof("io_ring_q") + 4];
++
++ snprintf(filename, sizeof(filename), "io_ring_q%d", i);
++ pfile = debugfs_create_file(filename,
++ S_IRUSR | S_IWUSR,
++ vif->xenvif_dbg_root,
++ &vif->queues[i],
++ &xenvif_dbg_io_ring_ops_fops);
++ if (IS_ERR_OR_NULL(pfile))
++ pr_warn("Creation of io_ring file returned %ld!\n",
++ PTR_ERR(pfile));
++ }
++ } else
++ netdev_warn(vif->dev,
++ "Creation of vif debugfs dir returned %ld!\n",
++ PTR_ERR(vif->xenvif_dbg_root));
++}
++
++static void xenvif_debugfs_delif(struct xenvif *vif)
++{
++ if (IS_ERR_OR_NULL(xen_netback_dbg_root))
++ return;
++
++ if (!IS_ERR_OR_NULL(vif->xenvif_dbg_root))
++ debugfs_remove_recursive(vif->xenvif_dbg_root);
++ vif->xenvif_dbg_root = NULL;
++}
++#endif /* CONFIG_DEBUG_FS */
++
+ static int netback_remove(struct xenbus_device *dev)
+ {
+ struct backend_info *be = dev_get_drvdata(&dev->dev);
+@@ -246,8 +415,12 @@ static void backend_create_xenvif(struct backend_info *be)
+
+ static void backend_disconnect(struct backend_info *be)
+ {
+- if (be->vif)
++ if (be->vif) {
++#ifdef CONFIG_DEBUG_FS
++ xenvif_debugfs_delif(be->vif);
++#endif /* CONFIG_DEBUG_FS */
+ xenvif_disconnect(be->vif);
++ }
+ }
+
+ static void backend_connect(struct backend_info *be)
+@@ -560,6 +733,9 @@ static void connect(struct backend_info *be)
+ be->vif->num_queues = queue_index;
+ goto err;
+ }
++#ifdef CONFIG_DEBUG_FS
++ xenvif_debugfs_addif(queue);
++#endif /* CONFIG_DEBUG_FS */
+ }
+
+ /* Initialisation completed, tell core driver the number of
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch)
@@ -0,0 +1,43 @@
+From 4b3437eeaea2f8d27974aa8615b425b232076e15 Mon Sep 17 00:00:00 2001
+From: Zoltan Kiss <zoltan.kiss at citrix.com>
+Date: Mon, 11 Aug 2014 13:01:44 +0100
+Subject: [PATCH 05/14] xen-netback: Don't deschedule NAPI when carrier off
+Origin: https://git.kernel.org/linus/2561cc15e3816e4323f9e79a6890bff94c0bbec2
+
+In the patch called "xen-netback: Turn off the carrier if the guest is not able
+to receive" NAPI was descheduled when the carrier was set off. That's
+not what most of the drivers do, and we don't have any specific reason to do so
+as well, so revert that change.
+
+Signed-off-by: Zoltan Kiss <zoltan.kiss at citrix.com>
+Cc: netdev at vger.kernel.org
+Cc: linux-kernel at vger.kernel.org
+Cc: xen-devel at lists.xenproject.org
+Acked-by: Wei Liu <wei.liu2 at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit 2561cc15e3816e4323f9e79a6890bff94c0bbec2)
+---
+ drivers/net/xen-netback/interface.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index b41ddbf..04696fc 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -78,12 +78,8 @@ int xenvif_poll(struct napi_struct *napi, int budget)
+ /* This vif is rogue, we pretend we've there is nothing to do
+ * for this vif to deschedule it from NAPI. But this interface
+ * will be turned off in thread context later.
+- * Also, if a guest doesn't post enough slots to receive data on one of
+- * its queues, the carrier goes down and NAPI is descheduled here so
+- * the guest can't send more packets until it's ready to receive.
+ */
+- if (unlikely(queue->vif->disabled ||
+- !netif_carrier_ok(queue->vif->dev))) {
++ if (unlikely(queue->vif->disabled)) {
+ napi_complete(napi);
+ return 0;
+ }
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Fix-vif-disable-handling.patch)
@@ -0,0 +1,46 @@
+From f1bbbc1036f3dd10252aecc4088ac50ad1f57399 Mon Sep 17 00:00:00 2001
+From: Zoltan Kiss <zoltan.kiss at citrix.com>
+Date: Thu, 7 Aug 2014 13:38:38 +0100
+Subject: [PATCH 04/14] xen-netback: Fix vif->disable handling
+Origin: https://git.kernel.org/linus/743b0a92b92a0e1b6a68497ccd18a0d60a4b6082
+
+In the patch called "xen-netback: Turn off the carrier if the guest is not able
+to receive" new branches were introduced to this if statement, risking that a
+queue with non-zero id can reenable the disabled interface.
+
+Signed-off-by: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Cc: netdev at vger.kernel.org
+Cc: linux-kernel at vger.kernel.org
+Cc: xen-devel at lists.xenproject.org
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit 743b0a92b92a0e1b6a68497ccd18a0d60a4b6082)
+---
+ drivers/net/xen-netback/netback.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index aa20933..4734472 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -2025,9 +2025,15 @@ int xenvif_kthread_guest_rx(void *data)
+ * context so we defer it here, if this thread is
+ * associated with queue 0.
+ */
+- if (unlikely(queue->vif->disabled && queue->id == 0))
++ if (unlikely(queue->vif->disabled && queue->id == 0)) {
+ xenvif_carrier_off(queue->vif);
+- else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT,
++ } else if (unlikely(queue->vif->disabled)) {
++ /* kthread_stop() would be called upon this thread soon,
++ * be a bit proactive
++ */
++ skb_queue_purge(&queue->rx_queue);
++ queue->rx_last_skb_slots = 0;
++ } else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT,
+ &queue->status))) {
+ xenvif_rx_purge_event(queue);
+ } else if (!netif_carrier_ok(queue->vif->dev)) {
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch)
@@ -0,0 +1,318 @@
+From f1c53c504eec39ad31bcfdeeb307c85075037a40 Mon Sep 17 00:00:00 2001
+From: Zoltan Kiss <zoltan.kiss at citrix.com>
+Date: Mon, 4 Aug 2014 16:20:58 +0100
+Subject: [PATCH 03/14] xen-netback: Turn off the carrier if the guest is not
+ able to receive
+Origin: https://git.kernel.org/linus/f34a4cf9c9b4fd35ba7f9a596cedb011879a1a4d
+
+Currently when the guest is not able to receive more packets, qdisc layer starts
+a timer, and when it goes off, qdisc is started again to deliver a packet again.
+This is a very slow way to drain the queues, consumes unnecessary resources and
+slows down other guests shutdown.
+This patch change the behaviour by turning the carrier off when that timer
+fires, so all the packets are freed up which were stucked waiting for that vif.
+Instead of the rx_queue_purge bool it uses the VIF_STATUS_RX_PURGE_EVENT bit to
+signal the thread that either the timeout happened or an RX interrupt arrived,
+so the thread can check what it should do. It also disables NAPI, so the guest
+can't transmit, but leaves the interrupts on, so it can resurrect.
+Only the queues which brought down the interface can enable it again, the bit
+QUEUE_STATUS_RX_STALLED makes sure of that.
+
+Signed-off-by: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Cc: netdev at vger.kernel.org
+Cc: linux-kernel at vger.kernel.org
+Cc: xen-devel at lists.xenproject.org
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit f34a4cf9c9b4fd35ba7f9a596cedb011879a1a4d)
+---
+ drivers/net/xen-netback/common.h | 15 ++++--
+ drivers/net/xen-netback/interface.c | 49 ++++++++++--------
+ drivers/net/xen-netback/netback.c | 97 ++++++++++++++++++++++++++++++-----
+ 3 files changed, 123 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index 4a92fc1..ef3026f 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -176,9 +176,9 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+ struct xen_netif_rx_back_ring rx;
+ struct sk_buff_head rx_queue;
+ RING_IDX rx_last_skb_slots;
+- bool rx_queue_purge;
++ unsigned long status;
+
+- struct timer_list wake_queue;
++ struct timer_list rx_stalled;
+
+ struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];
+
+@@ -200,7 +200,16 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+
+ enum state_bit_shift {
+ /* This bit marks that the vif is connected */
+- VIF_STATUS_CONNECTED
++ VIF_STATUS_CONNECTED,
++ /* This bit signals the RX thread that queuing was stopped (in
++ * start_xmit), and either the timer fired or an RX interrupt came
++ */
++ QUEUE_STATUS_RX_PURGE_EVENT,
++ /* This bit tells the interrupt handler that this queue was the reason
++ * for the carrier off, so it should kick the thread. Only queues which
++ * brought it down can turn on the carrier.
++ */
++ QUEUE_STATUS_RX_STALLED
+ };
+
+ struct xenvif {
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 67ebe35..b41ddbf 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -78,8 +78,12 @@ int xenvif_poll(struct napi_struct *napi, int budget)
+ /* This vif is rogue, we pretend we've there is nothing to do
+ * for this vif to deschedule it from NAPI. But this interface
+ * will be turned off in thread context later.
++ * Also, if a guest doesn't post enough slots to receive data on one of
++ * its queues, the carrier goes down and NAPI is descheduled here so
++ * the guest can't send more packets until it's ready to receive.
+ */
+- if (unlikely(queue->vif->disabled)) {
++ if (unlikely(queue->vif->disabled ||
++ !netif_carrier_ok(queue->vif->dev))) {
+ napi_complete(napi);
+ return 0;
+ }
+@@ -97,7 +101,16 @@ int xenvif_poll(struct napi_struct *napi, int budget)
+ static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id)
+ {
+ struct xenvif_queue *queue = dev_id;
++ struct netdev_queue *net_queue =
++ netdev_get_tx_queue(queue->vif->dev, queue->id);
+
++ /* QUEUE_STATUS_RX_PURGE_EVENT is only set if either QDisc was off OR
++ * the carrier went down and this queue was previously blocked
++ */
++ if (unlikely(netif_tx_queue_stopped(net_queue) ||
++ (!netif_carrier_ok(queue->vif->dev) &&
++ test_bit(QUEUE_STATUS_RX_STALLED, &queue->status))))
++ set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status);
+ xenvif_kick_thread(queue);
+
+ return IRQ_HANDLED;
+@@ -125,16 +138,14 @@ void xenvif_wake_queue(struct xenvif_queue *queue)
+ netif_tx_wake_queue(netdev_get_tx_queue(dev, id));
+ }
+
+-/* Callback to wake the queue and drain it on timeout */
+-static void xenvif_wake_queue_callback(unsigned long data)
++/* Callback to wake the queue's thread and turn the carrier off on timeout */
++static void xenvif_rx_stalled(unsigned long data)
+ {
+ struct xenvif_queue *queue = (struct xenvif_queue *)data;
+
+ if (xenvif_queue_stopped(queue)) {
+- netdev_err(queue->vif->dev, "draining TX queue\n");
+- queue->rx_queue_purge = true;
++ set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status);
+ xenvif_kick_thread(queue);
+- xenvif_wake_queue(queue);
+ }
+ }
+
+@@ -183,11 +194,11 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ * drain.
+ */
+ if (!xenvif_rx_ring_slots_available(queue, min_slots_needed)) {
+- queue->wake_queue.function = xenvif_wake_queue_callback;
+- queue->wake_queue.data = (unsigned long)queue;
++ queue->rx_stalled.function = xenvif_rx_stalled;
++ queue->rx_stalled.data = (unsigned long)queue;
+ xenvif_stop_queue(queue);
+- mod_timer(&queue->wake_queue,
+- jiffies + rx_drain_timeout_jiffies);
++ mod_timer(&queue->rx_stalled,
++ jiffies + rx_drain_timeout_jiffies);
+ }
+
+ skb_queue_tail(&queue->rx_queue, skb);
+@@ -515,7 +526,7 @@ int xenvif_init_queue(struct xenvif_queue *queue)
+ queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE;
+ }
+
+- init_timer(&queue->wake_queue);
++ init_timer(&queue->rx_stalled);
+
+ netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
+ XENVIF_NAPI_WEIGHT);
+@@ -666,7 +677,7 @@ void xenvif_disconnect(struct xenvif *vif)
+ queue = &vif->queues[queue_index];
+
+ if (queue->task) {
+- del_timer_sync(&queue->wake_queue);
++ del_timer_sync(&queue->rx_stalled);
+ kthread_stop(queue->task);
+ queue->task = NULL;
+ }
+@@ -708,16 +719,12 @@ void xenvif_free(struct xenvif *vif)
+ /* Here we want to avoid timeout messages if an skb can be legitimately
+ * stuck somewhere else. Realistically this could be an another vif's
+ * internal or QDisc queue. That another vif also has this
+- * rx_drain_timeout_msecs timeout, but the timer only ditches the
+- * internal queue. After that, the QDisc queue can put in worst case
+- * XEN_NETIF_RX_RING_SIZE / MAX_SKB_FRAGS skbs into that another vif's
+- * internal queue, so we need several rounds of such timeouts until we
+- * can be sure that no another vif should have skb's from us. We are
+- * not sending more skb's, so newly stuck packets are not interesting
+- * for us here.
++ * rx_drain_timeout_msecs timeout, so give it time to drain out.
++ * Although if that other guest wakes up just before its timeout happens
++ * and takes only one skb from QDisc, it can hold onto other skbs for a
++ * longer period.
+ */
+- unsigned int worst_case_skb_lifetime = (rx_drain_timeout_msecs/1000) *
+- DIV_ROUND_UP(XENVIF_QUEUE_LENGTH, (XEN_NETIF_RX_RING_SIZE / MAX_SKB_FRAGS));
++ unsigned int worst_case_skb_lifetime = (rx_drain_timeout_msecs/1000);
+
+ unregister_netdev(vif->dev);
+
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index 6c4cc0f..aa20933 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -1869,8 +1869,7 @@ void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx)
+ static inline int rx_work_todo(struct xenvif_queue *queue)
+ {
+ return (!skb_queue_empty(&queue->rx_queue) &&
+- xenvif_rx_ring_slots_available(queue, queue->rx_last_skb_slots)) ||
+- queue->rx_queue_purge;
++ xenvif_rx_ring_slots_available(queue, queue->rx_last_skb_slots));
+ }
+
+ static inline int tx_work_todo(struct xenvif_queue *queue)
+@@ -1935,6 +1934,75 @@ static void xenvif_start_queue(struct xenvif_queue *queue)
+ xenvif_wake_queue(queue);
+ }
+
++/* Only called from the queue's thread, it handles the situation when the guest
++ * doesn't post enough requests on the receiving ring.
++ * First xenvif_start_xmit disables QDisc and start a timer, and then either the
++ * timer fires, or the guest send an interrupt after posting new request. If it
++ * is the timer, the carrier is turned off here.
++ * */
++static void xenvif_rx_purge_event(struct xenvif_queue *queue)
++{
++ /* Either the last unsuccesful skb or at least 1 slot should fit */
++ int needed = queue->rx_last_skb_slots ?
++ queue->rx_last_skb_slots : 1;
++
++ /* It is assumed that if the guest post new slots after this, the RX
++ * interrupt will set the QUEUE_STATUS_RX_PURGE_EVENT bit and wake up
++ * the thread again
++ */
++ set_bit(QUEUE_STATUS_RX_STALLED, &queue->status);
++ if (!xenvif_rx_ring_slots_available(queue, needed)) {
++ rtnl_lock();
++ if (netif_carrier_ok(queue->vif->dev)) {
++ /* Timer fired and there are still no slots. Turn off
++ * everything except the interrupts
++ */
++ netif_carrier_off(queue->vif->dev);
++ skb_queue_purge(&queue->rx_queue);
++ queue->rx_last_skb_slots = 0;
++ if (net_ratelimit())
++ netdev_err(queue->vif->dev, "Carrier off due to lack of guest response on queue %d\n", queue->id);
++ } else {
++ /* Probably an another queue already turned the carrier
++ * off, make sure nothing is stucked in the internal
++ * queue of this queue
++ */
++ skb_queue_purge(&queue->rx_queue);
++ queue->rx_last_skb_slots = 0;
++ }
++ rtnl_unlock();
++ } else if (!netif_carrier_ok(queue->vif->dev)) {
++ unsigned int num_queues = queue->vif->num_queues;
++ unsigned int i;
++ /* The carrier was down, but an interrupt kicked
++ * the thread again after new requests were
++ * posted
++ */
++ clear_bit(QUEUE_STATUS_RX_STALLED,
++ &queue->status);
++ rtnl_lock();
++ netif_carrier_on(queue->vif->dev);
++ netif_tx_wake_all_queues(queue->vif->dev);
++ rtnl_unlock();
++
++ for (i = 0; i < num_queues; i++) {
++ struct xenvif_queue *temp = &queue->vif->queues[i];
++
++ xenvif_napi_schedule_or_enable_events(temp);
++ }
++ if (net_ratelimit())
++ netdev_err(queue->vif->dev, "Carrier on again\n");
++ } else {
++ /* Queuing were stopped, but the guest posted
++ * new requests and sent an interrupt
++ */
++ clear_bit(QUEUE_STATUS_RX_STALLED,
++ &queue->status);
++ del_timer_sync(&queue->rx_stalled);
++ xenvif_start_queue(queue);
++ }
++}
++
+ int xenvif_kthread_guest_rx(void *data)
+ {
+ struct xenvif_queue *queue = data;
+@@ -1944,8 +2012,12 @@ int xenvif_kthread_guest_rx(void *data)
+ wait_event_interruptible(queue->wq,
+ rx_work_todo(queue) ||
+ queue->vif->disabled ||
++ test_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status) ||
+ kthread_should_stop());
+
++ if (kthread_should_stop())
++ break;
++
+ /* This frontend is found to be rogue, disable it in
+ * kthread context. Currently this is only set when
+ * netback finds out frontend sends malformed packet,
+@@ -1955,24 +2027,21 @@ int xenvif_kthread_guest_rx(void *data)
+ */
+ if (unlikely(queue->vif->disabled && queue->id == 0))
+ xenvif_carrier_off(queue->vif);
+-
+- if (kthread_should_stop())
+- break;
+-
+- if (queue->rx_queue_purge) {
++ else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT,
++ &queue->status))) {
++ xenvif_rx_purge_event(queue);
++ } else if (!netif_carrier_ok(queue->vif->dev)) {
++ /* Another queue stalled and turned the carrier off, so
++ * purge the internal queue of queues which were not
++ * blocked
++ */
+ skb_queue_purge(&queue->rx_queue);
+- queue->rx_queue_purge = false;
++ queue->rx_last_skb_slots = 0;
+ }
+
+ if (!skb_queue_empty(&queue->rx_queue))
+ xenvif_rx_action(queue);
+
+- if (skb_queue_empty(&queue->rx_queue) &&
+- xenvif_queue_stopped(queue)) {
+- del_timer_sync(&queue->wake_queue);
+- xenvif_start_queue(queue);
+- }
+-
+ cond_resched();
+ }
+
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch)
@@ -0,0 +1,132 @@
+From 08cf39923b6a5728f0e1f8789f5f746c0ce0456d Mon Sep 17 00:00:00 2001
+From: Zoltan Kiss <zoltan.kiss at citrix.com>
+Date: Mon, 4 Aug 2014 16:20:57 +0100
+Subject: [PATCH 02/14] xen-netback: Using a new state bit instead of carrier
+Origin: https://git.kernel.org/linus/3d1af1df9762e56e563e8fd088a1b4ce2bcfaf8b
+
+This patch introduces a new state bit VIF_STATUS_CONNECTED to track whether the
+vif is in a connected state. Using carrier will not work with the next patch
+in this series, which aims to turn the carrier temporarily off if the guest
+doesn't seem to be able to receive packets.
+
+Signed-off-by: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Cc: netdev at vger.kernel.org
+Cc: linux-kernel at vger.kernel.org
+Cc: xen-devel at lists.xenproject.org
+
+v2:
+- rename the bitshift type to "enum state_bit_shift" here, not in the next patch
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit 3d1af1df9762e56e563e8fd088a1b4ce2bcfaf8b)
+---
+ drivers/net/xen-netback/common.h | 6 ++++++
+ drivers/net/xen-netback/interface.c | 19 +++++++++++--------
+ drivers/net/xen-netback/netback.c | 2 +-
+ 3 files changed, 18 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index 28c9822..4a92fc1 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -198,6 +198,11 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+ struct xenvif_stats stats;
+ };
+
++enum state_bit_shift {
++ /* This bit marks that the vif is connected */
++ VIF_STATUS_CONNECTED
++};
++
+ struct xenvif {
+ /* Unique identifier for this interface. */
+ domid_t domid;
+@@ -220,6 +225,7 @@ struct xenvif {
+ * frontend is rogue.
+ */
+ bool disabled;
++ unsigned long status;
+
+ /* Queues */
+ struct xenvif_queue *queues;
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index ef75b45..67ebe35 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -55,7 +55,8 @@ static inline void xenvif_stop_queue(struct xenvif_queue *queue)
+
+ int xenvif_schedulable(struct xenvif *vif)
+ {
+- return netif_running(vif->dev) && netif_carrier_ok(vif->dev);
++ return netif_running(vif->dev) &&
++ test_bit(VIF_STATUS_CONNECTED, &vif->status);
+ }
+
+ static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id)
+@@ -267,7 +268,7 @@ static void xenvif_down(struct xenvif *vif)
+ static int xenvif_open(struct net_device *dev)
+ {
+ struct xenvif *vif = netdev_priv(dev);
+- if (netif_carrier_ok(dev))
++ if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
+ xenvif_up(vif);
+ netif_tx_start_all_queues(dev);
+ return 0;
+@@ -276,7 +277,7 @@ static int xenvif_open(struct net_device *dev)
+ static int xenvif_close(struct net_device *dev)
+ {
+ struct xenvif *vif = netdev_priv(dev);
+- if (netif_carrier_ok(dev))
++ if (test_bit(VIF_STATUS_CONNECTED, &vif->status))
+ xenvif_down(vif);
+ netif_tx_stop_all_queues(dev);
+ return 0;
+@@ -528,6 +529,7 @@ void xenvif_carrier_on(struct xenvif *vif)
+ if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN)
+ dev_set_mtu(vif->dev, ETH_DATA_LEN);
+ netdev_update_features(vif->dev);
++ set_bit(VIF_STATUS_CONNECTED, &vif->status);
+ netif_carrier_on(vif->dev);
+ if (netif_running(vif->dev))
+ xenvif_up(vif);
+@@ -625,9 +627,11 @@ void xenvif_carrier_off(struct xenvif *vif)
+ struct net_device *dev = vif->dev;
+
+ rtnl_lock();
+- netif_carrier_off(dev); /* discard queued packets */
+- if (netif_running(dev))
+- xenvif_down(vif);
++ if (test_and_clear_bit(VIF_STATUS_CONNECTED, &vif->status)) {
++ netif_carrier_off(dev); /* discard queued packets */
++ if (netif_running(dev))
++ xenvif_down(vif);
++ }
+ rtnl_unlock();
+ }
+
+@@ -656,8 +660,7 @@ void xenvif_disconnect(struct xenvif *vif)
+ unsigned int num_queues = vif->num_queues;
+ unsigned int queue_index;
+
+- if (netif_carrier_ok(vif->dev))
+- xenvif_carrier_off(vif);
++ xenvif_carrier_off(vif);
+
+ for (queue_index = 0; queue_index < num_queues; ++queue_index) {
+ queue = &vif->queues[queue_index];
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index 769e553..6c4cc0f 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -1953,7 +1953,7 @@ int xenvif_kthread_guest_rx(void *data)
+ * context so we defer it here, if this thread is
+ * associated with queue 0.
+ */
+- if (unlikely(queue->vif->disabled && netif_carrier_ok(queue->vif->dev) && queue->id == 0))
++ if (unlikely(queue->vif->disabled && queue->id == 0))
+ xenvif_carrier_off(queue->vif);
+
+ if (kthread_should_stop())
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch)
@@ -0,0 +1,163 @@
+From 69f5afd56eae674e6c9332fff53b674930a852df Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Tue, 12 Aug 2014 11:48:07 +0100
+Subject: [PATCH 09/14] xen-netback: don't stop dealloc kthread too early
+Origin: https://git.kernel.org/linus/a64bd934528e26e8956112e43a279fba2ee0634e
+
+Reference count the number of packets in host stack, so that we don't
+stop the deallocation thread too early. If not, we can end up with
+xenvif_free permanently waiting for deallocation thread to unmap grefs.
+
+Reported-by: Thomas Leonard <talex5 at gmail.com>
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Cc: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit a64bd934528e26e8956112e43a279fba2ee0634e)
+---
+ drivers/net/xen-netback/common.h | 5 +++++
+ drivers/net/xen-netback/interface.c | 18 ++++++++++++++++++
+ drivers/net/xen-netback/netback.c | 26 +++++++++++++++++++-------
+ 3 files changed, 42 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index ef3026f..d4eb8d2 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -165,6 +165,7 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+ u16 dealloc_ring[MAX_PENDING_REQS];
+ struct task_struct *dealloc_task;
+ wait_queue_head_t dealloc_wq;
++ atomic_t inflight_packets;
+
+ /* Use kthread for guest RX */
+ struct task_struct *task;
+@@ -329,4 +330,8 @@ extern unsigned int xenvif_max_queues;
+ extern struct dentry *xen_netback_dbg_root;
+ #endif
+
++void xenvif_skb_zerocopy_prepare(struct xenvif_queue *queue,
++ struct sk_buff *skb);
++void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue);
++
+ #endif /* __XEN_NETBACK__COMMON_H__ */
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 23702ea..428c57c 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -43,6 +43,23 @@
+ #define XENVIF_QUEUE_LENGTH 32
+ #define XENVIF_NAPI_WEIGHT 64
+
++/* This function is used to set SKBTX_DEV_ZEROCOPY as well as
++ * increasing the inflight counter. We need to increase the inflight
++ * counter because core driver calls into xenvif_zerocopy_callback
++ * which calls xenvif_skb_zerocopy_complete.
++ */
++void xenvif_skb_zerocopy_prepare(struct xenvif_queue *queue,
++ struct sk_buff *skb)
++{
++ skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
++ atomic_inc(&queue->inflight_packets);
++}
++
++void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)
++{
++ atomic_dec(&queue->inflight_packets);
++}
++
+ static inline void xenvif_stop_queue(struct xenvif_queue *queue)
+ {
+ struct net_device *dev = queue->vif->dev;
+@@ -557,6 +574,7 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
+
+ init_waitqueue_head(&queue->wq);
+ init_waitqueue_head(&queue->dealloc_wq);
++ atomic_set(&queue->inflight_packets, 0);
+
+ if (tx_evtchn == rx_evtchn) {
+ /* feature-split-event-channels == 0 */
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index 4734472..08f6599 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -1525,10 +1525,12 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
+ /* remove traces of mapped pages and frag_list */
+ skb_frag_list_init(skb);
+ uarg = skb_shinfo(skb)->destructor_arg;
++ /* increase inflight counter to offset decrement in callback */
++ atomic_inc(&queue->inflight_packets);
+ uarg->callback(uarg, true);
+ skb_shinfo(skb)->destructor_arg = NULL;
+
+- skb_shinfo(nskb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
++ xenvif_skb_zerocopy_prepare(queue, nskb);
+ kfree_skb(nskb);
+
+ return 0;
+@@ -1589,7 +1591,7 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
+ if (net_ratelimit())
+ netdev_err(queue->vif->dev,
+ "Not enough memory to consolidate frag_list!\n");
+- skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
++ xenvif_skb_zerocopy_prepare(queue, skb);
+ kfree_skb(skb);
+ continue;
+ }
+@@ -1609,7 +1611,7 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
+ "Can't setup checksum in net_tx_action\n");
+ /* We have to set this flag to trigger the callback */
+ if (skb_shinfo(skb)->destructor_arg)
+- skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
++ xenvif_skb_zerocopy_prepare(queue, skb);
+ kfree_skb(skb);
+ continue;
+ }
+@@ -1641,7 +1643,7 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
+ * skb. E.g. the __pskb_pull_tail earlier can do such thing.
+ */
+ if (skb_shinfo(skb)->destructor_arg) {
+- skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
++ xenvif_skb_zerocopy_prepare(queue, skb);
+ queue->stats.tx_zerocopy_sent++;
+ }
+
+@@ -1681,6 +1683,7 @@ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success)
+ queue->stats.tx_zerocopy_success++;
+ else
+ queue->stats.tx_zerocopy_fail++;
++ xenvif_skb_zerocopy_complete(queue);
+ }
+
+ static inline void xenvif_tx_dealloc_action(struct xenvif_queue *queue)
+@@ -2058,15 +2061,24 @@ int xenvif_kthread_guest_rx(void *data)
+ return 0;
+ }
+
++static bool xenvif_dealloc_kthread_should_stop(struct xenvif_queue *queue)
++{
++ /* Dealloc thread must remain running until all inflight
++ * packets complete.
++ */
++ return kthread_should_stop() &&
++ !atomic_read(&queue->inflight_packets);
++}
++
+ int xenvif_dealloc_kthread(void *data)
+ {
+ struct xenvif_queue *queue = data;
+
+- while (!kthread_should_stop()) {
++ for (;;) {
+ wait_event_interruptible(queue->dealloc_wq,
+ tx_dealloc_work_todo(queue) ||
+- kthread_should_stop());
+- if (kthread_should_stop())
++ xenvif_dealloc_kthread_should_stop(queue));
++ if (xenvif_dealloc_kthread_should_stop(queue))
+ break;
+
+ xenvif_tx_dealloc_action(queue);
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-entry-creation.patch)
@@ -0,0 +1,51 @@
+From d78ae2894c307cabcf454877f6a45ed442778d02 Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Tue, 12 Aug 2014 11:59:30 +0100
+Subject: [PATCH 07/14] xen-netback: fix debugfs entry creation
+Origin: https://git.kernel.org/linus/628fa76b09d7b0923c142631fc25b6affbfb868d
+
+The original code is bogus. The function gets called in a loop which
+leaks entries created in previous rounds.
+
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Zoltan Kiss <zoltan.kiss at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit 628fa76b09d7b0923c142631fc25b6affbfb868d)
+---
+ drivers/net/xen-netback/xenbus.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 4c9041e..9c47b89 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -174,10 +174,9 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
+ .write = xenvif_write_io_ring,
+ };
+
+-static void xenvif_debugfs_addif(struct xenvif_queue *queue)
++static void xenvif_debugfs_addif(struct xenvif *vif)
+ {
+ struct dentry *pfile;
+- struct xenvif *vif = queue->vif;
+ int i;
+
+ if (IS_ERR_OR_NULL(xen_netback_dbg_root))
+@@ -736,10 +735,11 @@ static void connect(struct backend_info *be)
+ be->vif->num_queues = queue_index;
+ goto err;
+ }
++ }
++
+ #ifdef CONFIG_DEBUG_FS
+- xenvif_debugfs_addif(queue);
++ xenvif_debugfs_addif(be->vif);
+ #endif /* CONFIG_DEBUG_FS */
+- }
+
+ /* Initialisation completed, tell core driver the number of
+ * active queues.
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-debugfs-write-length-check.patch)
@@ -0,0 +1,65 @@
+From 588d54039ef4c17c7bba79abe057daf5b69b2330 Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Tue, 12 Aug 2014 11:59:29 +0100
+Subject: [PATCH 06/14] xen-netback: fix debugfs write length check
+Origin: https://git.kernel.org/linus/5c807005fa60deef2db6616d9b7b24fc4c436be9
+
+Enlarge buffer size and check input length properly, so that we don't
+misuse -ENOSPC.
+
+Note that command like "kickXXXX" is still allowed, that's one patch for
+another day if we really want to be very strict on this.
+
+Reported-by: SeeChen Ng <seechen81 at gmail.com>
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Zoltan Kiss <zoltan.kiss at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit 5c807005fa60deef2db6616d9b7b24fc4c436be9)
+---
+ drivers/net/xen-netback/xenbus.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 580517d..4c9041e 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -116,6 +116,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v)
+ }
+
+ #define XENVIF_KICK_STR "kick"
++#define BUFFER_SIZE 32
+
+ static ssize_t
+ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
+@@ -124,22 +125,24 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
+ struct xenvif_queue *queue =
+ ((struct seq_file *)filp->private_data)->private;
+ int len;
+- char write[sizeof(XENVIF_KICK_STR)];
++ char write[BUFFER_SIZE];
+
+ /* don't allow partial writes and check the length */
+ if (*ppos != 0)
+ return 0;
+- if (count < sizeof(XENVIF_KICK_STR) - 1)
++ if (count >= sizeof(write))
+ return -ENOSPC;
+
+ len = simple_write_to_buffer(write,
+- sizeof(write),
++ sizeof(write) - 1,
+ ppos,
+ buf,
+ count);
+ if (len < 0)
+ return len;
+
++ write[len] = '\0';
++
+ if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1))
+ xenvif_interrupt(0, (void *)queue);
+ else {
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch)
@@ -0,0 +1,614 @@
+From 8a73fe2999810038cde046462258a3cd5afe170e Mon Sep 17 00:00:00 2001
+From: David Vrabel <david.vrabel at citrix.com>
+Date: Wed, 22 Oct 2014 14:08:54 +0100
+Subject: [PATCH 13/14] xen-netback: fix unlimited guest Rx internal queue and
+ carrier flapping
+Origin: https://git.kernel.org/linus/f48da8b14d04ca87ffcffe68829afd45f926ec6a
+
+Netback needs to discard old to-guest skb's (guest Rx queue drain) and
+it needs detect guest Rx stalls (to disable the carrier so packets are
+discarded earlier), but the current implementation is very broken.
+
+1. The check in hard_start_xmit of the slot availability did not
+ consider the number of packets that were already in the guest Rx
+ queue. This could allow the queue to grow without bound.
+
+ The guest stops consuming packets and the ring was allowed to fill
+ leaving S slot free. Netback queues a packet requiring more than S
+ slots (ensuring that the ring stays with S slots free). Netback
+ queue indefinately packets provided that then require S or fewer
+ slots.
+
+2. The Rx stall detection is not triggered in this case since the
+ (host) Tx queue is not stopped.
+
+3. If the Tx queue is stopped and a guest Rx interrupt occurs, netback
+ will consider this an Rx purge event which may result in it taking
+ the carrier down unnecessarily. It also considers a queue with
+ only 1 slot free as unstalled (even though the next packet might
+ not fit in this).
+
+The internal guest Rx queue is limited by a byte length (to 512 Kib,
+enough for half the ring). The (host) Tx queue is stopped and started
+based on this limit. This sets an upper bound on the amount of memory
+used by packets on the internal queue.
+
+This allows the estimatation of the number of slots for an skb to be
+removed (it wasn't a very good estimate anyway). Instead, the guest
+Rx thread just waits for enough free slots for a maximum sized packet.
+
+skbs queued on the internal queue have an 'expires' time (set to the
+current time plus the drain timeout). The guest Rx thread will detect
+when the skb at the head of the queue has expired and discard expired
+skbs. This sets a clear upper bound on the length of time an skb can
+be queued for. For a guest being destroyed the maximum time needed to
+wait for all the packets it sent to be dropped is still the drain
+timeout (10 s) since it will not be sending new packets.
+
+Rx stall detection is reintroduced in a later commit.
+
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Reviewed-by: Wei Liu <wei.liu2 at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit f48da8b14d04ca87ffcffe68829afd45f926ec6a)
+---
+ drivers/net/xen-netback/common.h | 29 +++--
+ drivers/net/xen-netback/interface.c | 59 ++-------
+ drivers/net/xen-netback/netback.c | 243 ++++++++++++++++++-----------------
+ drivers/net/xen-netback/xenbus.c | 8 ++
+ 4 files changed, 161 insertions(+), 178 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index 93ca77c..c264240 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -176,10 +176,9 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+ char rx_irq_name[IRQ_NAME_SIZE]; /* DEVNAME-qN-rx */
+ struct xen_netif_rx_back_ring rx;
+ struct sk_buff_head rx_queue;
+- RING_IDX rx_last_skb_slots;
+- unsigned long status;
+
+- struct timer_list rx_stalled;
++ unsigned int rx_queue_max;
++ unsigned int rx_queue_len;
+
+ struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];
+
+@@ -199,18 +198,14 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+ struct xenvif_stats stats;
+ };
+
++/* Maximum number of Rx slots a to-guest packet may use, including the
++ * slot needed for GSO meta-data.
++ */
++#define XEN_NETBK_RX_SLOTS_MAX (MAX_SKB_FRAGS + 1)
++
+ enum state_bit_shift {
+ /* This bit marks that the vif is connected */
+ VIF_STATUS_CONNECTED,
+- /* This bit signals the RX thread that queuing was stopped (in
+- * start_xmit), and either the timer fired or an RX interrupt came
+- */
+- QUEUE_STATUS_RX_PURGE_EVENT,
+- /* This bit tells the interrupt handler that this queue was the reason
+- * for the carrier off, so it should kick the thread. Only queues which
+- * brought it down can turn on the carrier.
+- */
+- QUEUE_STATUS_RX_STALLED
+ };
+
+ struct xenvif {
+@@ -246,6 +241,14 @@ struct xenvif {
+ struct net_device *dev;
+ };
+
++struct xenvif_rx_cb {
++ unsigned long expires;
++ int meta_slots_used;
++ bool full_coalesce;
++};
++
++#define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb)
++
+ static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
+ {
+ return to_xenbus_device(vif->dev->dev.parent);
+@@ -291,6 +294,8 @@ void xenvif_kick_thread(struct xenvif_queue *queue);
+
+ int xenvif_dealloc_kthread(void *data);
+
++void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb);
++
+ /* Determine whether the needed number of slots (req) are available,
+ * and set req_event if not.
+ */
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 6879251..9e8af0b 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -43,6 +43,9 @@
+ #define XENVIF_QUEUE_LENGTH 32
+ #define XENVIF_NAPI_WEIGHT 64
+
++/* Number of bytes allowed on the internal guest Rx queue. */
++#define XENVIF_RX_QUEUE_BYTES (XEN_NETIF_RX_RING_SIZE/2 * PAGE_SIZE)
++
+ /* This function is used to set SKBTX_DEV_ZEROCOPY as well as
+ * increasing the inflight counter. We need to increase the inflight
+ * counter because core driver calls into xenvif_zerocopy_callback
+@@ -63,7 +66,8 @@ void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)
+ int xenvif_schedulable(struct xenvif *vif)
+ {
+ return netif_running(vif->dev) &&
+- test_bit(VIF_STATUS_CONNECTED, &vif->status);
++ test_bit(VIF_STATUS_CONNECTED, &vif->status) &&
++ !vif->disabled;
+ }
+
+ static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id)
+@@ -104,16 +108,7 @@ int xenvif_poll(struct napi_struct *napi, int budget)
+ static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id)
+ {
+ struct xenvif_queue *queue = dev_id;
+- struct netdev_queue *net_queue =
+- netdev_get_tx_queue(queue->vif->dev, queue->id);
+
+- /* QUEUE_STATUS_RX_PURGE_EVENT is only set if either QDisc was off OR
+- * the carrier went down and this queue was previously blocked
+- */
+- if (unlikely(netif_tx_queue_stopped(net_queue) ||
+- (!netif_carrier_ok(queue->vif->dev) &&
+- test_bit(QUEUE_STATUS_RX_STALLED, &queue->status))))
+- set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status);
+ xenvif_kick_thread(queue);
+
+ return IRQ_HANDLED;
+@@ -141,24 +136,13 @@ void xenvif_wake_queue(struct xenvif_queue *queue)
+ netif_tx_wake_queue(netdev_get_tx_queue(dev, id));
+ }
+
+-/* Callback to wake the queue's thread and turn the carrier off on timeout */
+-static void xenvif_rx_stalled(unsigned long data)
+-{
+- struct xenvif_queue *queue = (struct xenvif_queue *)data;
+-
+- if (xenvif_queue_stopped(queue)) {
+- set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status);
+- xenvif_kick_thread(queue);
+- }
+-}
+-
+ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+ struct xenvif *vif = netdev_priv(dev);
+ struct xenvif_queue *queue = NULL;
+ unsigned int num_queues = vif->num_queues;
+ u16 index;
+- int min_slots_needed;
++ struct xenvif_rx_cb *cb;
+
+ BUG_ON(skb->dev != dev);
+
+@@ -181,30 +165,10 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ !xenvif_schedulable(vif))
+ goto drop;
+
+- /* At best we'll need one slot for the header and one for each
+- * frag.
+- */
+- min_slots_needed = 1 + skb_shinfo(skb)->nr_frags;
++ cb = XENVIF_RX_CB(skb);
++ cb->expires = jiffies + rx_drain_timeout_jiffies;
+
+- /* If the skb is GSO then we'll also need an extra slot for the
+- * metadata.
+- */
+- if (skb_is_gso(skb))
+- min_slots_needed++;
+-
+- /* If the skb can't possibly fit in the remaining slots
+- * then turn off the queue to give the ring a chance to
+- * drain.
+- */
+- if (!xenvif_rx_ring_slots_available(queue, min_slots_needed)) {
+- queue->rx_stalled.function = xenvif_rx_stalled;
+- queue->rx_stalled.data = (unsigned long)queue;
+- netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id));
+- mod_timer(&queue->rx_stalled,
+- jiffies + rx_drain_timeout_jiffies);
+- }
+-
+- skb_queue_tail(&queue->rx_queue, skb);
++ xenvif_rx_queue_tail(queue, skb);
+ xenvif_kick_thread(queue);
+
+ return NETDEV_TX_OK;
+@@ -498,6 +462,8 @@ int xenvif_init_queue(struct xenvif_queue *queue)
+ init_timer(&queue->credit_timeout);
+ queue->credit_window_start = get_jiffies_64();
+
++ queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES;
++
+ skb_queue_head_init(&queue->rx_queue);
+ skb_queue_head_init(&queue->tx_queue);
+
+@@ -529,8 +495,6 @@ int xenvif_init_queue(struct xenvif_queue *queue)
+ queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE;
+ }
+
+- init_timer(&queue->rx_stalled);
+-
+ return 0;
+ }
+
+@@ -664,7 +628,6 @@ void xenvif_disconnect(struct xenvif *vif)
+ netif_napi_del(&queue->napi);
+
+ if (queue->task) {
+- del_timer_sync(&queue->rx_stalled);
+ kthread_stop(queue->task);
+ queue->task = NULL;
+ }
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index 08f6599..57aa3b5 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -55,8 +55,8 @@
+ bool separate_tx_rx_irq = 1;
+ module_param(separate_tx_rx_irq, bool, 0644);
+
+-/* When guest ring is filled up, qdisc queues the packets for us, but we have
+- * to timeout them, otherwise other guests' packets can get stuck there
++/* The time that packets can stay on the guest Rx internal queue
++ * before they are dropped.
+ */
+ unsigned int rx_drain_timeout_msecs = 10000;
+ module_param(rx_drain_timeout_msecs, uint, 0444);
+@@ -83,7 +83,6 @@ static void make_tx_response(struct xenvif_queue *queue,
+ s8 st);
+
+ static inline int tx_work_todo(struct xenvif_queue *queue);
+-static inline int rx_work_todo(struct xenvif_queue *queue);
+
+ static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue,
+ u16 id,
+@@ -163,6 +162,69 @@ bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue, int needed)
+ return false;
+ }
+
++void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb)
++{
++ unsigned long flags;
++
++ spin_lock_irqsave(&queue->rx_queue.lock, flags);
++
++ __skb_queue_tail(&queue->rx_queue, skb);
++
++ queue->rx_queue_len += skb->len;
++ if (queue->rx_queue_len > queue->rx_queue_max)
++ netif_tx_stop_queue(netdev_get_tx_queue(queue->vif->dev, queue->id));
++
++ spin_unlock_irqrestore(&queue->rx_queue.lock, flags);
++}
++
++static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue)
++{
++ struct sk_buff *skb;
++
++ spin_lock_irq(&queue->rx_queue.lock);
++
++ skb = __skb_dequeue(&queue->rx_queue);
++ if (skb)
++ queue->rx_queue_len -= skb->len;
++
++ spin_unlock_irq(&queue->rx_queue.lock);
++
++ return skb;
++}
++
++static void xenvif_rx_queue_maybe_wake(struct xenvif_queue *queue)
++{
++ spin_lock_irq(&queue->rx_queue.lock);
++
++ if (queue->rx_queue_len < queue->rx_queue_max)
++ netif_tx_wake_queue(netdev_get_tx_queue(queue->vif->dev, queue->id));
++
++ spin_unlock_irq(&queue->rx_queue.lock);
++}
++
++
++static void xenvif_rx_queue_purge(struct xenvif_queue *queue)
++{
++ struct sk_buff *skb;
++ while ((skb = xenvif_rx_dequeue(queue)) != NULL)
++ kfree_skb(skb);
++}
++
++static void xenvif_rx_queue_drop_expired(struct xenvif_queue *queue)
++{
++ struct sk_buff *skb;
++
++ for(;;) {
++ skb = skb_peek(&queue->rx_queue);
++ if (!skb)
++ break;
++ if (time_before(jiffies, XENVIF_RX_CB(skb)->expires))
++ break;
++ xenvif_rx_dequeue(queue);
++ kfree_skb(skb);
++ }
++}
++
+ /*
+ * Returns true if we should start a new receive buffer instead of
+ * adding 'size' bytes to a buffer which currently contains 'offset'
+@@ -237,13 +299,6 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif_queue *queue,
+ return meta;
+ }
+
+-struct xenvif_rx_cb {
+- int meta_slots_used;
+- bool full_coalesce;
+-};
+-
+-#define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb)
+-
+ /*
+ * Set up the grant operations for this fragment. If it's a flipping
+ * interface, we also set up the unmap request from here.
+@@ -587,7 +642,8 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
+
+ skb_queue_head_init(&rxq);
+
+- while ((skb = skb_dequeue(&queue->rx_queue)) != NULL) {
++ while (xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX)
++ && (skb = xenvif_rx_dequeue(queue)) != NULL) {
+ RING_IDX max_slots_needed;
+ RING_IDX old_req_cons;
+ RING_IDX ring_slots_used;
+@@ -634,15 +690,6 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
+ skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6))
+ max_slots_needed++;
+
+- /* If the skb may not fit then bail out now */
+- if (!xenvif_rx_ring_slots_available(queue, max_slots_needed)) {
+- skb_queue_head(&queue->rx_queue, skb);
+- need_to_notify = true;
+- queue->rx_last_skb_slots = max_slots_needed;
+- break;
+- } else
+- queue->rx_last_skb_slots = 0;
+-
+ old_req_cons = queue->rx.req_cons;
+ XENVIF_RX_CB(skb)->meta_slots_used = xenvif_gop_skb(skb, &npo, queue);
+ ring_slots_used = queue->rx.req_cons - old_req_cons;
+@@ -1869,12 +1916,6 @@ void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx)
+ }
+ }
+
+-static inline int rx_work_todo(struct xenvif_queue *queue)
+-{
+- return (!skb_queue_empty(&queue->rx_queue) &&
+- xenvif_rx_ring_slots_available(queue, queue->rx_last_skb_slots));
+-}
+-
+ static inline int tx_work_todo(struct xenvif_queue *queue)
+ {
+ if (likely(RING_HAS_UNCONSUMED_REQUESTS(&queue->tx)))
+@@ -1931,92 +1972,64 @@ err:
+ return err;
+ }
+
+-static void xenvif_start_queue(struct xenvif_queue *queue)
++static bool xenvif_have_rx_work(struct xenvif_queue *queue)
+ {
+- if (xenvif_schedulable(queue->vif))
+- xenvif_wake_queue(queue);
++ return (!skb_queue_empty(&queue->rx_queue)
++ && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX))
++ || kthread_should_stop()
++ || queue->vif->disabled;
+ }
+
+-/* Only called from the queue's thread, it handles the situation when the guest
+- * doesn't post enough requests on the receiving ring.
+- * First xenvif_start_xmit disables QDisc and start a timer, and then either the
+- * timer fires, or the guest send an interrupt after posting new request. If it
+- * is the timer, the carrier is turned off here.
+- * */
+-static void xenvif_rx_purge_event(struct xenvif_queue *queue)
++static long xenvif_rx_queue_timeout(struct xenvif_queue *queue)
+ {
+- /* Either the last unsuccesful skb or at least 1 slot should fit */
+- int needed = queue->rx_last_skb_slots ?
+- queue->rx_last_skb_slots : 1;
++ struct sk_buff *skb;
++ long timeout;
+
+- /* It is assumed that if the guest post new slots after this, the RX
+- * interrupt will set the QUEUE_STATUS_RX_PURGE_EVENT bit and wake up
+- * the thread again
+- */
+- set_bit(QUEUE_STATUS_RX_STALLED, &queue->status);
+- if (!xenvif_rx_ring_slots_available(queue, needed)) {
+- rtnl_lock();
+- if (netif_carrier_ok(queue->vif->dev)) {
+- /* Timer fired and there are still no slots. Turn off
+- * everything except the interrupts
+- */
+- netif_carrier_off(queue->vif->dev);
+- skb_queue_purge(&queue->rx_queue);
+- queue->rx_last_skb_slots = 0;
+- if (net_ratelimit())
+- netdev_err(queue->vif->dev, "Carrier off due to lack of guest response on queue %d\n", queue->id);
+- } else {
+- /* Probably an another queue already turned the carrier
+- * off, make sure nothing is stucked in the internal
+- * queue of this queue
+- */
+- skb_queue_purge(&queue->rx_queue);
+- queue->rx_last_skb_slots = 0;
+- }
+- rtnl_unlock();
+- } else if (!netif_carrier_ok(queue->vif->dev)) {
+- unsigned int num_queues = queue->vif->num_queues;
+- unsigned int i;
+- /* The carrier was down, but an interrupt kicked
+- * the thread again after new requests were
+- * posted
+- */
+- clear_bit(QUEUE_STATUS_RX_STALLED,
+- &queue->status);
+- rtnl_lock();
+- netif_carrier_on(queue->vif->dev);
+- netif_tx_wake_all_queues(queue->vif->dev);
+- rtnl_unlock();
++ skb = skb_peek(&queue->rx_queue);
++ if (!skb)
++ return MAX_SCHEDULE_TIMEOUT;
+
+- for (i = 0; i < num_queues; i++) {
+- struct xenvif_queue *temp = &queue->vif->queues[i];
++ timeout = XENVIF_RX_CB(skb)->expires - jiffies;
++ return timeout < 0 ? 0 : timeout;
++}
+
+- xenvif_napi_schedule_or_enable_events(temp);
+- }
+- if (net_ratelimit())
+- netdev_err(queue->vif->dev, "Carrier on again\n");
+- } else {
+- /* Queuing were stopped, but the guest posted
+- * new requests and sent an interrupt
+- */
+- clear_bit(QUEUE_STATUS_RX_STALLED,
+- &queue->status);
+- del_timer_sync(&queue->rx_stalled);
+- xenvif_start_queue(queue);
++/* Wait until the guest Rx thread has work.
++ *
++ * The timeout needs to be adjusted based on the current head of the
++ * queue (and not just the head at the beginning). In particular, if
++ * the queue is initially empty an infinite timeout is used and this
++ * needs to be reduced when a skb is queued.
++ *
++ * This cannot be done with wait_event_timeout() because it only
++ * calculates the timeout once.
++ */
++static void xenvif_wait_for_rx_work(struct xenvif_queue *queue)
++{
++ DEFINE_WAIT(wait);
++
++ if (xenvif_have_rx_work(queue))
++ return;
++
++ for (;;) {
++ long ret;
++
++ prepare_to_wait(&queue->wq, &wait, TASK_INTERRUPTIBLE);
++ if (xenvif_have_rx_work(queue))
++ break;
++ ret = schedule_timeout(xenvif_rx_queue_timeout(queue));
++ if (!ret)
++ break;
+ }
++ finish_wait(&queue->wq, &wait);
+ }
+
+ int xenvif_kthread_guest_rx(void *data)
+ {
+ struct xenvif_queue *queue = data;
+- struct sk_buff *skb;
++ struct xenvif *vif = queue->vif;
+
+- while (!kthread_should_stop()) {
+- wait_event_interruptible(queue->wq,
+- rx_work_todo(queue) ||
+- queue->vif->disabled ||
+- test_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status) ||
+- kthread_should_stop());
++ for (;;) {
++ xenvif_wait_for_rx_work(queue);
+
+ if (kthread_should_stop())
+ break;
+@@ -2028,35 +2041,29 @@ int xenvif_kthread_guest_rx(void *data)
+ * context so we defer it here, if this thread is
+ * associated with queue 0.
+ */
+- if (unlikely(queue->vif->disabled && queue->id == 0)) {
+- xenvif_carrier_off(queue->vif);
+- } else if (unlikely(queue->vif->disabled)) {
+- /* kthread_stop() would be called upon this thread soon,
+- * be a bit proactive
+- */
+- skb_queue_purge(&queue->rx_queue);
+- queue->rx_last_skb_slots = 0;
+- } else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT,
+- &queue->status))) {
+- xenvif_rx_purge_event(queue);
+- } else if (!netif_carrier_ok(queue->vif->dev)) {
+- /* Another queue stalled and turned the carrier off, so
+- * purge the internal queue of queues which were not
+- * blocked
+- */
+- skb_queue_purge(&queue->rx_queue);
+- queue->rx_last_skb_slots = 0;
++ if (unlikely(vif->disabled && queue->id == 0)) {
++ xenvif_carrier_off(vif);
++ xenvif_rx_queue_purge(queue);
++ continue;
+ }
+
+ if (!skb_queue_empty(&queue->rx_queue))
+ xenvif_rx_action(queue);
+
++ /* Queued packets may have foreign pages from other
++ * domains. These cannot be queued indefinitely as
++ * this would starve guests of grant refs and transmit
++ * slots.
++ */
++ xenvif_rx_queue_drop_expired(queue);
++
++ xenvif_rx_queue_maybe_wake(queue);
++
+ cond_resched();
+ }
+
+ /* Bin any remaining skbs */
+- while ((skb = skb_dequeue(&queue->rx_queue)) != NULL)
+- dev_kfree_skb(skb);
++ xenvif_rx_queue_purge(queue);
+
+ return 0;
+ }
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 5e5cca1..54b5f24 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -52,6 +52,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v)
+ struct xenvif_queue *queue = m->private;
+ struct xen_netif_tx_back_ring *tx_ring = &queue->tx;
+ struct xen_netif_rx_back_ring *rx_ring = &queue->rx;
++ struct netdev_queue *dev_queue;
+
+ if (tx_ring->sring) {
+ struct xen_netif_tx_sring *sring = tx_ring->sring;
+@@ -112,6 +113,13 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v)
+ queue->credit_timeout.expires,
+ jiffies);
+
++ dev_queue = netdev_get_tx_queue(queue->vif->dev, queue->id);
++
++ seq_printf(m, "\nRx internal queue: len %u max %u pkts %u %s\n",
++ queue->rx_queue_len, queue->rx_queue_max,
++ skb_queue_len(&queue->rx_queue),
++ netif_tx_queue_stopped(dev_queue) ? "stopped" : "running");
++
+ return 0;
+ }
+
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch)
@@ -0,0 +1,103 @@
+From 63350994825046216104c9c4c99db9e7a2715a97 Mon Sep 17 00:00:00 2001
+From: David Vrabel <david.vrabel at citrix.com>
+Date: Wed, 22 Oct 2014 14:08:53 +0100
+Subject: [PATCH 12/14] xen-netback: make feature-rx-notify mandatory
+Origin: https://git.kernel.org/linus/bc96f648df1bbc2729abbb84513cf4f64273a1f1
+
+Frontends that do not provide feature-rx-notify may stall because
+netback depends on the notification from frontend to wake the guest Rx
+thread (even if can_queue is false).
+
+This could be fixed but feature-rx-notify was introduced in 2006 and I
+am not aware of any frontends that do not implement this.
+
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Acked-by: Wei Liu <wei.liu2 at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit bc96f648df1bbc2729abbb84513cf4f64273a1f1)
+---
+ drivers/net/xen-netback/common.h | 5 -----
+ drivers/net/xen-netback/interface.c | 12 +-----------
+ drivers/net/xen-netback/xenbus.c | 13 ++++---------
+ 3 files changed, 5 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index d4eb8d2..93ca77c 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -228,9 +228,6 @@ struct xenvif {
+ u8 ip_csum:1;
+ u8 ipv6_csum:1;
+
+- /* Internal feature information. */
+- u8 can_queue:1; /* can queue packets for receiver? */
+-
+ /* Is this interface disabled? True when backend discovers
+ * frontend is rogue.
+ */
+@@ -272,8 +269,6 @@ void xenvif_xenbus_fini(void);
+
+ int xenvif_schedulable(struct xenvif *vif);
+
+-int xenvif_must_stop_queue(struct xenvif_queue *queue);
+-
+ int xenvif_queue_stopped(struct xenvif_queue *queue);
+ void xenvif_wake_queue(struct xenvif_queue *queue);
+
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 18cdc81..6879251 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -60,16 +60,6 @@ void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)
+ atomic_dec(&queue->inflight_packets);
+ }
+
+-static inline void xenvif_stop_queue(struct xenvif_queue *queue)
+-{
+- struct net_device *dev = queue->vif->dev;
+-
+- if (!queue->vif->can_queue)
+- return;
+-
+- netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id));
+-}
+-
+ int xenvif_schedulable(struct xenvif *vif)
+ {
+ return netif_running(vif->dev) &&
+@@ -209,7 +199,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ if (!xenvif_rx_ring_slots_available(queue, min_slots_needed)) {
+ queue->rx_stalled.function = xenvif_rx_stalled;
+ queue->rx_stalled.data = (unsigned long)queue;
+- xenvif_stop_queue(queue);
++ netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id));
+ mod_timer(&queue->rx_stalled,
+ jiffies + rx_drain_timeout_jiffies);
+ }
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 9c47b89..5e5cca1 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -873,15 +873,10 @@ static int read_xenbus_vif_flags(struct backend_info *be)
+ if (!rx_copy)
+ return -EOPNOTSUPP;
+
+- if (vif->dev->tx_queue_len != 0) {
+- if (xenbus_scanf(XBT_NIL, dev->otherend,
+- "feature-rx-notify", "%d", &val) < 0)
+- val = 0;
+- if (val)
+- vif->can_queue = 1;
+- else
+- /* Must be non-zero for pfifo_fast to work. */
+- vif->dev->tx_queue_len = 1;
++ if (xenbus_scanf(XBT_NIL, dev->otherend,
++ "feature-rx-notify", "%d", &val) < 0 || val == 0) {
++ xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory");
++ return -EINVAL;
+ }
+
+ if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg",
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch)
@@ -0,0 +1,65 @@
+From 7b37ef7c88a7d4e20e268c02b65980b03281ddce Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Tue, 12 Aug 2014 11:48:06 +0100
+Subject: [PATCH 08/14] xen-netback: move NAPI add/remove calls
+Origin: https://git.kernel.org/linus/ea2c5e134237eadc9924ce821ded678750024549
+
+Originally netif_napi_add was in xenvif_init_queue and netif_napi_del
+was in xenvif_deinit_queue, while kthreads were handled in
+xenvif_connect and xenvif_disconnect. Move netif_napi_add and
+netif_napi_del to xenvif_connect and xenvif_disconnect so that they
+reside together with kthread operations.
+
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Cc: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit ea2c5e134237eadc9924ce821ded678750024549)
+---
+ drivers/net/xen-netback/interface.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 04696fc..23702ea 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -524,9 +524,6 @@ int xenvif_init_queue(struct xenvif_queue *queue)
+
+ init_timer(&queue->rx_stalled);
+
+- netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
+- XENVIF_NAPI_WEIGHT);
+-
+ return 0;
+ }
+
+@@ -614,6 +611,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
+ wake_up_process(queue->task);
+ wake_up_process(queue->dealloc_task);
+
++ netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
++ XENVIF_NAPI_WEIGHT);
++
+ return 0;
+
+ err_rx_unbind:
+@@ -672,6 +672,8 @@ void xenvif_disconnect(struct xenvif *vif)
+ for (queue_index = 0; queue_index < num_queues; ++queue_index) {
+ queue = &vif->queues[queue_index];
+
++ netif_napi_del(&queue->napi);
++
+ if (queue->task) {
+ del_timer_sync(&queue->rx_stalled);
+ kthread_stop(queue->task);
+@@ -704,7 +706,6 @@ void xenvif_disconnect(struct xenvif *vif)
+ void xenvif_deinit_queue(struct xenvif_queue *queue)
+ {
+ free_xenballooned_pages(MAX_PENDING_REQS, queue->mmap_pages);
+- netif_napi_del(&queue->napi);
+ }
+
+ void xenvif_free(struct xenvif *vif)
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch)
@@ -0,0 +1,57 @@
+From 7ffe40b3013c6c4d66ebbc9a946173013a590a61 Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Mon, 25 Aug 2014 16:44:00 +0100
+Subject: [PATCH 11/14] xen-netback: move netif_napi_add before binding
+ interrupt
+Origin: https://git.kernel.org/linus/e24f8191cc35ae3780b4656a6befae8b8657edc2
+
+Interrupt is enabled when bind_interdomain_evtchn_to_irqhandler returns.
+If there's interrupt pending interrupt handler is invoked.
+
+NAPI needs to be initialised before binding interrupt otherwise the
+interrupt handler will try to scheduling a NAPI instance that is not
+initialised yet, resulting in kernel OOPS.
+
+This fixes a regression introduced in ea2c5e13 ("xen-netback: move NAPI
+add/remove calls").
+
+Ideally function calls to create kthreads should also be moved before
+binding but I intent to fix this regression with minimal changes and
+refactor the code with another patch.
+
+Reported-by: Thomas Leonard <talex5 at gmail.com>
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit e24f8191cc35ae3780b4656a6befae8b8657edc2)
+---
+ drivers/net/xen-netback/interface.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 10d832a..18cdc81 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -576,6 +576,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
+ init_waitqueue_head(&queue->dealloc_wq);
+ atomic_set(&queue->inflight_packets, 0);
+
++ netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
++ XENVIF_NAPI_WEIGHT);
++
+ if (tx_evtchn == rx_evtchn) {
+ /* feature-split-event-channels == 0 */
+ err = bind_interdomain_evtchn_to_irqhandler(
+@@ -629,9 +632,6 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
+ wake_up_process(queue->task);
+ wake_up_process(queue->dealloc_task);
+
+- netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
+- XENVIF_NAPI_WEIGHT);
+-
+ return 0;
+
+ err_rx_unbind:
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch)
@@ -0,0 +1,218 @@
+From bd54d3b8d2a15e230f81965041169ba0dc2210c8 Mon Sep 17 00:00:00 2001
+From: David Vrabel <david.vrabel at citrix.com>
+Date: Wed, 22 Oct 2014 14:08:55 +0100
+Subject: [PATCH 14/14] xen-netback: reintroduce guest Rx stall detection
+Origin: https://git.kernel.org/linus/ecf08d2dbb96d5a4b4bcc53a39e8d29cc8fef02e
+
+If a frontend not receiving packets it is useful to detect this and
+turn off the carrier so packets are dropped early instead of being
+queued and drained when they expire.
+
+A to-guest queue is stalled if it doesn't have enough free slots for a
+an extended period of time (default 60 s).
+
+If at least one queue is stalled, the carrier is turned off (in the
+expectation that the other queues will soon stall as well). The
+carrier is only turned on once all queues are ready.
+
+When the frontend connects, all the queues start in the stalled state
+and only become ready once the frontend queues enough Rx requests.
+
+Signed-off-by: David Vrabel <david.vrabel at citrix.com>
+Reviewed-by: Wei Liu <wei.liu2 at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit ecf08d2dbb96d5a4b4bcc53a39e8d29cc8fef02e)
+---
+ drivers/net/xen-netback/common.h | 5 +++
+ drivers/net/xen-netback/interface.c | 5 ++-
+ drivers/net/xen-netback/netback.c | 76 +++++++++++++++++++++++++++++++++++
+ drivers/net/xen-netback/xenbus.c | 1 +
+ 4 files changed, 86 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
+index c264240..083ecc9 100644
+--- a/drivers/net/xen-netback/common.h
++++ b/drivers/net/xen-netback/common.h
+@@ -179,6 +179,8 @@ struct xenvif_queue { /* Per-queue data for xenvif */
+
+ unsigned int rx_queue_max;
+ unsigned int rx_queue_len;
++ unsigned long last_rx_time;
++ bool stalled;
+
+ struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];
+
+@@ -232,6 +234,9 @@ struct xenvif {
+ /* Queues */
+ struct xenvif_queue *queues;
+ unsigned int num_queues; /* active queues, resource allocated */
++ unsigned int stalled_queues;
++
++ spinlock_t lock;
+
+ #ifdef CONFIG_DEBUG_FS
+ struct dentry *xenvif_dbg_root;
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 9e8af0b..21d8db8 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -419,6 +419,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
+ vif->queues = NULL;
+ vif->num_queues = 0;
+
++ spin_lock_init(&vif->lock);
++
+ dev->netdev_ops = &xenvif_netdev_ops;
+ dev->hw_features = NETIF_F_SG |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+@@ -505,7 +507,6 @@ void xenvif_carrier_on(struct xenvif *vif)
+ dev_set_mtu(vif->dev, ETH_DATA_LEN);
+ netdev_update_features(vif->dev);
+ set_bit(VIF_STATUS_CONNECTED, &vif->status);
+- netif_carrier_on(vif->dev);
+ if (netif_running(vif->dev))
+ xenvif_up(vif);
+ rtnl_unlock();
+@@ -565,6 +566,8 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
+ disable_irq(queue->rx_irq);
+ }
+
++ queue->stalled = true;
++
+ task = kthread_create(xenvif_kthread_guest_rx,
+ (void *)queue, "%s-guest-rx", queue->name);
+ if (IS_ERR(task)) {
+diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
+index 57aa3b5..6563f07 100644
+--- a/drivers/net/xen-netback/netback.c
++++ b/drivers/net/xen-netback/netback.c
+@@ -62,6 +62,13 @@ unsigned int rx_drain_timeout_msecs = 10000;
+ module_param(rx_drain_timeout_msecs, uint, 0444);
+ unsigned int rx_drain_timeout_jiffies;
+
++/* The length of time before the frontend is considered unresponsive
++ * because it isn't providing Rx slots.
++ */
++static unsigned int rx_stall_timeout_msecs = 60000;
++module_param(rx_stall_timeout_msecs, uint, 0444);
++static unsigned int rx_stall_timeout_jiffies;
++
+ unsigned int xenvif_max_queues;
+ module_param_named(max_queues, xenvif_max_queues, uint, 0644);
+ MODULE_PARM_DESC(max_queues,
+@@ -649,6 +656,8 @@ static void xenvif_rx_action(struct xenvif_queue *queue)
+ RING_IDX ring_slots_used;
+ int i;
+
++ queue->last_rx_time = jiffies;
++
+ /* We need a cheap worse case estimate for the number of
+ * slots we'll use.
+ */
+@@ -1972,10 +1981,67 @@ err:
+ return err;
+ }
+
++static void xenvif_queue_carrier_off(struct xenvif_queue *queue)
++{
++ struct xenvif *vif = queue->vif;
++
++ queue->stalled = true;
++
++ /* At least one queue has stalled? Disable the carrier. */
++ spin_lock(&vif->lock);
++ if (vif->stalled_queues++ == 0) {
++ netdev_info(vif->dev, "Guest Rx stalled");
++ netif_carrier_off(vif->dev);
++ }
++ spin_unlock(&vif->lock);
++}
++
++static void xenvif_queue_carrier_on(struct xenvif_queue *queue)
++{
++ struct xenvif *vif = queue->vif;
++
++ queue->last_rx_time = jiffies; /* Reset Rx stall detection. */
++ queue->stalled = false;
++
++ /* All queues are ready? Enable the carrier. */
++ spin_lock(&vif->lock);
++ if (--vif->stalled_queues == 0) {
++ netdev_info(vif->dev, "Guest Rx ready");
++ netif_carrier_on(vif->dev);
++ }
++ spin_unlock(&vif->lock);
++}
++
++static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue)
++{
++ RING_IDX prod, cons;
++
++ prod = queue->rx.sring->req_prod;
++ cons = queue->rx.req_cons;
++
++ return !queue->stalled
++ && prod - cons < XEN_NETBK_RX_SLOTS_MAX
++ && time_after(jiffies,
++ queue->last_rx_time + rx_stall_timeout_jiffies);
++}
++
++static bool xenvif_rx_queue_ready(struct xenvif_queue *queue)
++{
++ RING_IDX prod, cons;
++
++ prod = queue->rx.sring->req_prod;
++ cons = queue->rx.req_cons;
++
++ return queue->stalled
++ && prod - cons >= XEN_NETBK_RX_SLOTS_MAX;
++}
++
+ static bool xenvif_have_rx_work(struct xenvif_queue *queue)
+ {
+ return (!skb_queue_empty(&queue->rx_queue)
+ && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX))
++ || xenvif_rx_queue_stalled(queue)
++ || xenvif_rx_queue_ready(queue)
+ || kthread_should_stop()
+ || queue->vif->disabled;
+ }
+@@ -2050,6 +2116,15 @@ int xenvif_kthread_guest_rx(void *data)
+ if (!skb_queue_empty(&queue->rx_queue))
+ xenvif_rx_action(queue);
+
++ /* If the guest hasn't provided any Rx slots for a
++ * while it's probably not responsive, drop the
++ * carrier so packets are dropped earlier.
++ */
++ if (xenvif_rx_queue_stalled(queue))
++ xenvif_queue_carrier_off(queue);
++ else if (xenvif_rx_queue_ready(queue))
++ xenvif_queue_carrier_on(queue);
++
+ /* Queued packets may have foreign pages from other
+ * domains. These cannot be queued indefinitely as
+ * this would starve guests of grant refs and transmit
+@@ -2120,6 +2195,7 @@ static int __init netback_init(void)
+ goto failed_init;
+
+ rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs);
++ rx_stall_timeout_jiffies = msecs_to_jiffies(rx_stall_timeout_msecs);
+
+ #ifdef CONFIG_DEBUG_FS
+ xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL);
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 54b5f24..396b3d9 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -711,6 +711,7 @@ static void connect(struct backend_info *be)
+ be->vif->queues = vzalloc(requested_num_queues *
+ sizeof(struct xenvif_queue));
+ be->vif->num_queues = requested_num_queues;
++ be->vif->stalled_queues = requested_num_queues;
+
+ for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) {
+ queue = &be->vif->queues[queue_index];
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch (from r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/all/xen-netback-remove-loop-waiting-function.patch)
@@ -0,0 +1,74 @@
+From db6a4a063a4f3f8069fb7f95d07bbc1d0d6fd1bd Mon Sep 17 00:00:00 2001
+From: Wei Liu <wei.liu2 at citrix.com>
+Date: Tue, 12 Aug 2014 11:48:08 +0100
+Subject: [PATCH 10/14] xen-netback: remove loop waiting function
+Origin: https://git.kernel.org/linus/b1252858213f39700dac1bc3295b6e88f6cce24b
+
+The original implementation relies on a loop to check if all inflight
+packets are freed. Now we have proper reference counting, there's no
+need to use loop anymore.
+
+Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
+Cc: Ian Campbell <ian.campbell at citrix.com>
+Cc: Zoltan Kiss <zoltan.kiss at citrix.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+(cherry picked from commit b1252858213f39700dac1bc3295b6e88f6cce24b)
+---
+ drivers/net/xen-netback/interface.c | 29 -----------------------------
+ 1 file changed, 29 deletions(-)
+
+diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
+index 428c57c..10d832a 100644
+--- a/drivers/net/xen-netback/interface.c
++++ b/drivers/net/xen-netback/interface.c
+@@ -660,25 +660,6 @@ void xenvif_carrier_off(struct xenvif *vif)
+ rtnl_unlock();
+ }
+
+-static void xenvif_wait_unmap_timeout(struct xenvif_queue *queue,
+- unsigned int worst_case_skb_lifetime)
+-{
+- int i, unmap_timeout = 0;
+-
+- for (i = 0; i < MAX_PENDING_REQS; ++i) {
+- if (queue->grant_tx_handle[i] != NETBACK_INVALID_HANDLE) {
+- unmap_timeout++;
+- schedule_timeout(msecs_to_jiffies(1000));
+- if (unmap_timeout > worst_case_skb_lifetime &&
+- net_ratelimit())
+- netdev_err(queue->vif->dev,
+- "Page still granted! Index: %x\n",
+- i);
+- i = -1;
+- }
+- }
+-}
+-
+ void xenvif_disconnect(struct xenvif *vif)
+ {
+ struct xenvif_queue *queue = NULL;
+@@ -731,21 +712,11 @@ void xenvif_free(struct xenvif *vif)
+ struct xenvif_queue *queue = NULL;
+ unsigned int num_queues = vif->num_queues;
+ unsigned int queue_index;
+- /* Here we want to avoid timeout messages if an skb can be legitimately
+- * stuck somewhere else. Realistically this could be an another vif's
+- * internal or QDisc queue. That another vif also has this
+- * rx_drain_timeout_msecs timeout, so give it time to drain out.
+- * Although if that other guest wakes up just before its timeout happens
+- * and takes only one skb from QDisc, it can hold onto other skbs for a
+- * longer period.
+- */
+- unsigned int worst_case_skb_lifetime = (rx_drain_timeout_msecs/1000);
+
+ unregister_netdev(vif->dev);
+
+ for (queue_index = 0; queue_index < num_queues; ++queue_index) {
+ queue = &vif->queues[queue_index];
+- xenvif_wait_unmap_timeout(queue, worst_case_skb_lifetime);
+ xenvif_deinit_queue(queue);
+ }
+
+--
+1.7.10.4
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch (from r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch)
@@ -0,0 +1,36 @@
+From 2d209a4c68627218140f29ca31ee1f01ce476b89 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc at hellion.org.uk>
+Date: Wed, 26 Nov 2014 15:30:03 +0000
+Subject: [PATCH 1/2] arm64: add missing dts entry for X-Gene platform.
+Origin: http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/216347.html
+
+This add missing dts entry for X-Gene reboot driver.
+
+Signed-off-by: Feng Kan <fkan at apm.com>
+
+ijc -- obsoleted by upstream syscon-reboot driver reworking, but that is too
+big to backport.
+
+---
+ arch/arm64/boot/dts/apm-storm.dtsi | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
+index e2af321..0d796ad 100644
+--- a/arch/arm64/boot/dts/apm-storm.dtsi
++++ b/arch/arm64/boot/dts/apm-storm.dtsi
+@@ -302,6 +302,11 @@
+ interrupts = <0x0 0x4c 0x4>;
+ };
+
++ reboot at 17000014 {
++ compatible = "apm,xgene-reboot";
++ reg = <0x0 0x17000014 0x0 0x4>;
++ };
++
+ serial1: serial at 1c021000 {
+ status = "disabled";
+ device_type = "serial";
+--
+2.1.3
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch (from r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch)
@@ -0,0 +1,37 @@
+From b2553d6241a68e991e59c0a99857ae6ac21a67a8 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc at hellion.org.uk>
+Date: Wed, 26 Nov 2014 15:31:50 +0000
+Subject: [PATCH 2/2] arm64: removed using of the mask attribute in the dts for
+ reset bit.
+Origin: http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/216350.html
+
+Remove the use of the mask attribute from original reboot driver. The use
+of the mask attribute provided unneeded complexity and security risk. Also
+fix minor compilation warning.
+
+Signed-off-by: Feng Kan <fkan at apm.com>
+
+ijc -- obsoleted by upstream syscon-reboot driver reworking, but that is too
+big to backport.
+
+---
+ drivers/power/reset/xgene-reboot.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c
+index ecd55f8..4a63f8f 100644
+--- a/drivers/power/reset/xgene-reboot.c
++++ b/drivers/power/reset/xgene-reboot.c
+@@ -73,8 +73,7 @@ static int xgene_reboot_probe(struct platform_device *pdev)
+ return -ENODEV;
+ }
+
+- if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask))
+- ctx->mask = 0xFFFFFFFF;
++ ctx->mask = 0x1;
+
+ ctx->pdev = pdev;
+ arm_pm_restart = xgene_restart;
+--
+2.1.3
+
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch (from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch)
@@ -0,0 +1,50 @@
+From: Andy Lutomirski <luto at amacapital.net>
+Date: Mon, 24 Nov 2014 17:39:06 -0800
+Subject: x86/asm/traps: Disable tracing and kprobes in fixup_bad_iret and
+ sync_regs
+Origin: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit?id=7ddc6a2199f1da405a2fb68c40db8899b1a8cd87
+
+These functions can be executed on the int3 stack, so kprobes
+are dangerous. Tracing is probably a bad idea, too.
+
+Fixes: b645af2d5905 ("x86_64, traps: Rework bad_iret")
+Signed-off-by: Andy Lutomirski <luto at amacapital.net>
+Cc: <stable at vger.kernel.org> # Backport as far back as it would apply
+Cc: Linus Torvalds <torvalds at linux-foundation.org>
+Cc: Steven Rostedt <rostedt at goodmis.org>
+Link: http://lkml.kernel.org/r/50e33d26adca60816f3ba968875801652507d0c4.1416870125.git.luto@amacapital.net
+Signed-off-by: Ingo Molnar <mingo at kernel.org>
+---
+ arch/x86/kernel/traps.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
+index de801f2..07ab8e9 100644
+--- a/arch/x86/kernel/traps.c
++++ b/arch/x86/kernel/traps.c
+@@ -387,7 +387,7 @@ NOKPROBE_SYMBOL(do_int3);
+ * for scheduling or signal handling. The actual stack switch is done in
+ * entry.S
+ */
+-asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs)
++asmlinkage __visible notrace struct pt_regs *sync_regs(struct pt_regs *eregs)
+ {
+ struct pt_regs *regs = eregs;
+ /* Did already sync */
+@@ -413,7 +413,7 @@ struct bad_iret_stack {
+ struct pt_regs regs;
+ };
+
+-asmlinkage __visible
++asmlinkage __visible notrace
+ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
+ {
+ /*
+@@ -436,6 +436,7 @@ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
+ BUG_ON(!user_mode_vm(&new_stack->regs));
+ return new_stack;
+ }
++NOKPROBE_SYMBOL(fixup_bad_iret);
+ #endif
+
+ /*
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch (from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch)
@@ -0,0 +1,111 @@
+From: Andy Lutomirski <luto at amacapital.net>
+Date: Sat, 22 Nov 2014 18:00:31 -0800
+Subject: x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C
+Origin: https://git.kernel.org/linus/af726f21ed8af2cdaa4e93098dc211521218ae65
+
+There's nothing special enough about the espfix64 double fault fixup to
+justify writing it in assembly. Move it to C.
+
+This also fixes a bug: if the double fault came from an IST stack, the
+old asm code would return to a partially uninitialized stack frame.
+
+Fixes: 3891a04aafd668686239349ea58f3314ea2af86b
+Signed-off-by: Andy Lutomirski <luto at amacapital.net>
+Reviewed-by: Thomas Gleixner <tglx at linutronix.de>
+Cc: stable at vger.kernel.org
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ arch/x86/kernel/entry_64.S | 34 ++--------------------------------
+ arch/x86/kernel/traps.c | 24 ++++++++++++++++++++++++
+ 2 files changed, 26 insertions(+), 32 deletions(-)
+
+--- a/arch/x86/kernel/entry_64.S
++++ b/arch/x86/kernel/entry_64.S
+@@ -860,6 +860,7 @@ ENTRY(native_iret)
+ jnz native_irq_return_ldt
+ #endif
+
++.global native_irq_return_iret
+ native_irq_return_iret:
+ iretq
+ _ASM_EXTABLE(native_irq_return_iret, bad_iret)
+@@ -954,37 +955,6 @@ ENTRY(retint_kernel)
+ CFI_ENDPROC
+ END(common_interrupt)
+
+- /*
+- * If IRET takes a fault on the espfix stack, then we
+- * end up promoting it to a doublefault. In that case,
+- * modify the stack to make it look like we just entered
+- * the #GP handler from user space, similar to bad_iret.
+- */
+-#ifdef CONFIG_X86_ESPFIX64
+- ALIGN
+-__do_double_fault:
+- XCPT_FRAME 1 RDI+8
+- movq RSP(%rdi),%rax /* Trap on the espfix stack? */
+- sarq $PGDIR_SHIFT,%rax
+- cmpl $ESPFIX_PGD_ENTRY,%eax
+- jne do_double_fault /* No, just deliver the fault */
+- cmpl $__KERNEL_CS,CS(%rdi)
+- jne do_double_fault
+- movq RIP(%rdi),%rax
+- cmpq $native_irq_return_iret,%rax
+- jne do_double_fault /* This shouldn't happen... */
+- movq PER_CPU_VAR(kernel_stack),%rax
+- subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */
+- movq %rax,RSP(%rdi)
+- movq $0,(%rax) /* Missing (lost) #GP error code */
+- movq $general_protection,RIP(%rdi)
+- retq
+- CFI_ENDPROC
+-END(__do_double_fault)
+-#else
+-# define __do_double_fault do_double_fault
+-#endif
+-
+ /*
+ * APIC interrupts.
+ */
+@@ -1156,7 +1126,7 @@ idtentry overflow do_overflow has_error_
+ idtentry bounds do_bounds has_error_code=0
+ idtentry invalid_op do_invalid_op has_error_code=0
+ idtentry device_not_available do_device_not_available has_error_code=0
+-idtentry double_fault __do_double_fault has_error_code=1 paranoid=1
++idtentry double_fault do_double_fault has_error_code=1 paranoid=1
+ idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0
+ idtentry invalid_TSS do_invalid_TSS has_error_code=1
+ idtentry segment_not_present do_segment_not_present has_error_code=1
+--- a/arch/x86/kernel/traps.c
++++ b/arch/x86/kernel/traps.c
+@@ -243,6 +243,30 @@ dotraplinkage void do_double_fault(struc
+ static const char str[] = "double fault";
+ struct task_struct *tsk = current;
+
++#ifdef CONFIG_X86_ESPFIX64
++ extern unsigned char native_irq_return_iret[];
++
++ /*
++ * If IRET takes a non-IST fault on the espfix64 stack, then we
++ * end up promoting it to a doublefault. In that case, modify
++ * the stack to make it look like we just entered the #GP
++ * handler from user space, similar to bad_iret.
++ */
++ if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY &&
++ regs->cs == __KERNEL_CS &&
++ regs->ip == (unsigned long)native_irq_return_iret)
++ {
++ struct pt_regs *normal_regs = task_pt_regs(current);
++
++ /* Fake a #GP(0) from userspace. */
++ memmove(&normal_regs->ip, (void *)regs->sp, 5*8);
++ normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */
++ regs->ip = (unsigned long)general_protection;
++ regs->sp = (unsigned long)&normal_regs->orig_ax;
++ return;
++ }
++#endif
++
+ exception_enter();
+ /* Return not checked because double check cannot be ignored */
+ notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch (from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Rework-bad_iret.patch)
@@ -0,0 +1,154 @@
+From: Andy Lutomirski <luto at amacapital.net>
+Date: Sat, 22 Nov 2014 18:00:33 -0800
+Subject: x86_64, traps: Rework bad_iret
+Origin: https://git.kernel.org/linus/b645af2d5905c4e32399005b867987919cbfc3ae
+
+It's possible for iretq to userspace to fail. This can happen because
+of a bad CS, SS, or RIP.
+
+Historically, we've handled it by fixing up an exception from iretq to
+land at bad_iret, which pretends that the failed iret frame was really
+the hardware part of #GP(0) from userspace. To make this work, there's
+an extra fixup to fudge the gs base into a usable state.
+
+This is suboptimal because it loses the original exception. It's also
+buggy because there's no guarantee that we were on the kernel stack to
+begin with. For example, if the failing iret happened on return from an
+NMI, then we'll end up executing general_protection on the NMI stack.
+This is bad for several reasons, the most immediate of which is that
+general_protection, as a non-paranoid idtentry, will try to deliver
+signals and/or schedule from the wrong stack.
+
+This patch throws out bad_iret entirely. As a replacement, it augments
+the existing swapgs fudge into a full-blown iret fixup, mostly written
+in C. It's should be clearer and more correct.
+
+Signed-off-by: Andy Lutomirski <luto at amacapital.net>
+Reviewed-by: Thomas Gleixner <tglx at linutronix.de>
+Cc: stable at vger.kernel.org
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+[bwh: Backported to 3.16: adjust context]
+---
+ arch/x86/kernel/entry_64.S | 45 +++++++++++++++++++--------------------------
+ arch/x86/kernel/traps.c | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 48 insertions(+), 26 deletions(-)
+
+--- a/arch/x86/kernel/entry_64.S
++++ b/arch/x86/kernel/entry_64.S
+@@ -862,8 +862,13 @@ ENTRY(native_iret)
+
+ .global native_irq_return_iret
+ native_irq_return_iret:
++ /*
++ * This may fault. Non-paranoid faults on return to userspace are
++ * handled by fixup_bad_iret. These include #SS, #GP, and #NP.
++ * Double-faults due to espfix64 are handled in do_double_fault.
++ * Other faults here are fatal.
++ */
+ iretq
+- _ASM_EXTABLE(native_irq_return_iret, bad_iret)
+
+ #ifdef CONFIG_X86_ESPFIX64
+ native_irq_return_ldt:
+@@ -891,25 +896,6 @@ native_irq_return_ldt:
+ jmp native_irq_return_iret
+ #endif
+
+- .section .fixup,"ax"
+-bad_iret:
+- /*
+- * The iret traps when the %cs or %ss being restored is bogus.
+- * We've lost the original trap vector and error code.
+- * #GPF is the most likely one to get for an invalid selector.
+- * So pretend we completed the iret and took the #GPF in user mode.
+- *
+- * We are now running with the kernel GS after exception recovery.
+- * But error_entry expects us to have user GS to match the user %cs,
+- * so swap back.
+- */
+- pushq $0
+-
+- SWAPGS
+- jmp general_protection
+-
+- .previous
+-
+ /* edi: workmask, edx: work */
+ retint_careful:
+ CFI_RESTORE_STATE
+@@ -1401,16 +1387,15 @@ error_sti:
+
+ /*
+ * There are two places in the kernel that can potentially fault with
+- * usergs. Handle them here. The exception handlers after iret run with
+- * kernel gs again, so don't set the user space flag. B stepping K8s
+- * sometimes report an truncated RIP for IRET exceptions returning to
+- * compat mode. Check for these here too.
++ * usergs. Handle them here. B stepping K8s sometimes report a
++ * truncated RIP for IRET exceptions returning to compat mode. Check
++ * for these here too.
+ */
+ error_kernelspace:
+ incl %ebx
+ leaq native_irq_return_iret(%rip),%rcx
+ cmpq %rcx,RIP+8(%rsp)
+- je error_swapgs
++ je error_bad_iret
+ movl %ecx,%eax /* zero extend */
+ cmpq %rax,RIP+8(%rsp)
+ je bstep_iret
+@@ -1421,7 +1406,15 @@ error_kernelspace:
+ bstep_iret:
+ /* Fix truncated RIP */
+ movq %rcx,RIP+8(%rsp)
+- jmp error_swapgs
++ /* fall through */
++
++error_bad_iret:
++ SWAPGS
++ mov %rsp,%rdi
++ call fixup_bad_iret
++ mov %rax,%rsp
++ decl %ebx /* Return to usergs */
++ jmp error_sti
+ CFI_ENDPROC
+ END(error_entry)
+
+--- a/arch/x86/kernel/traps.c
++++ b/arch/x86/kernel/traps.c
+@@ -407,6 +407,35 @@ asmlinkage __visible struct pt_regs *syn
+ return regs;
+ }
+ NOKPROBE_SYMBOL(sync_regs);
++
++struct bad_iret_stack {
++ void *error_entry_ret;
++ struct pt_regs regs;
++};
++
++asmlinkage __visible
++struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
++{
++ /*
++ * This is called from entry_64.S early in handling a fault
++ * caused by a bad iret to user mode. To handle the fault
++ * correctly, we want move our stack frame to task_pt_regs
++ * and we want to pretend that the exception came from the
++ * iret target.
++ */
++ struct bad_iret_stack *new_stack =
++ container_of(task_pt_regs(current),
++ struct bad_iret_stack, regs);
++
++ /* Copy the IRET target to the new stack. */
++ memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8);
++
++ /* Copy the remainder of the stack from the current stack. */
++ memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip));
++
++ BUG_ON(!user_mode_vm(&new_stack->regs));
++ return new_stack;
++}
+ #endif
+
+ /*
Copied: dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch (from r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch)
@@ -0,0 +1,131 @@
+From: Andy Lutomirski <luto at amacapital.net>
+Date: Sat, 22 Nov 2014 18:00:32 -0800
+Subject: x86_64, traps: Stop using IST for #SS
+Origin: https://git.kernel.org/linus/6f442be2fb22be02cafa606f1769fa1e6f894441
+
+On a 32-bit kernel, this has no effect, since there are no IST stacks.
+
+On a 64-bit kernel, #SS can only happen in user code, on a failed iret
+to user space, a canonical violation on access via RSP or RBP, or a
+genuine stack segment violation in 32-bit kernel code. The first two
+cases don't need IST, and the latter two cases are unlikely fatal bugs,
+and promoting them to double faults would be fine.
+
+This fixes a bug in which the espfix64 code mishandles a stack segment
+violation.
+
+This saves 4k of memory per CPU and a tiny bit of code.
+
+Signed-off-by: Andy Lutomirski <luto at amacapital.net>
+Reviewed-by: Thomas Gleixner <tglx at linutronix.de>
+Cc: stable at vger.kernel.org
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ arch/x86/include/asm/page_32_types.h | 1 -
+ arch/x86/include/asm/page_64_types.h | 11 +++++------
+ arch/x86/include/asm/traps.h | 1 +
+ arch/x86/kernel/dumpstack_64.c | 1 -
+ arch/x86/kernel/entry_64.S | 2 +-
+ arch/x86/kernel/traps.c | 18 +-----------------
+ 6 files changed, 8 insertions(+), 26 deletions(-)
+
+--- a/arch/x86/include/asm/page_32_types.h
++++ b/arch/x86/include/asm/page_32_types.h
+@@ -20,7 +20,6 @@
+ #define THREAD_SIZE_ORDER 1
+ #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
+
+-#define STACKFAULT_STACK 0
+ #define DOUBLEFAULT_STACK 1
+ #define NMI_STACK 0
+ #define DEBUG_STACK 0
+--- a/arch/x86/include/asm/page_64_types.h
++++ b/arch/x86/include/asm/page_64_types.h
+@@ -14,12 +14,11 @@
+ #define IRQ_STACK_ORDER 2
+ #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
+
+-#define STACKFAULT_STACK 1
+-#define DOUBLEFAULT_STACK 2
+-#define NMI_STACK 3
+-#define DEBUG_STACK 4
+-#define MCE_STACK 5
+-#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
++#define DOUBLEFAULT_STACK 1
++#define NMI_STACK 2
++#define DEBUG_STACK 3
++#define MCE_STACK 4
++#define N_EXCEPTION_STACKS 4 /* hw limit: 7 */
+
+ #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
+ #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
+--- a/arch/x86/include/asm/traps.h
++++ b/arch/x86/include/asm/traps.h
+@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(v
+
+ #ifdef CONFIG_TRACING
+ asmlinkage void trace_page_fault(void);
++#define trace_stack_segment stack_segment
+ #define trace_divide_error divide_error
+ #define trace_bounds bounds
+ #define trace_invalid_op invalid_op
+--- a/arch/x86/kernel/dumpstack_64.c
++++ b/arch/x86/kernel/dumpstack_64.c
+@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
+ [ DEBUG_STACK-1 ] = "#DB",
+ [ NMI_STACK-1 ] = "NMI",
+ [ DOUBLEFAULT_STACK-1 ] = "#DF",
+- [ STACKFAULT_STACK-1 ] = "#SS",
+ [ MCE_STACK-1 ] = "#MC",
+ #if DEBUG_STKSZ > EXCEPTION_STKSZ
+ [ N_EXCEPTION_STACKS ...
+--- a/arch/x86/kernel/entry_64.S
++++ b/arch/x86/kernel/entry_64.S
+@@ -1321,7 +1321,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTO
+
+ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
+ idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
+-idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1
++idtentry stack_segment do_stack_segment has_error_code=1
+ #ifdef CONFIG_XEN
+ idtentry xen_debug do_debug has_error_code=0
+ idtentry xen_int3 do_int3 has_error_code=0
+--- a/arch/x86/kernel/traps.c
++++ b/arch/x86/kernel/traps.c
+@@ -233,27 +233,11 @@ DO_ERROR(X86_TRAP_UD, SIGILL, "inva
+ DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun)
+ DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
+ DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
+-#ifdef CONFIG_X86_32
+ DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
+-#endif
+ DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check)
+
+ #ifdef CONFIG_X86_64
+ /* Runs on IST stack */
+-dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
+-{
+- enum ctx_state prev_state;
+-
+- prev_state = exception_enter();
+- if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
+- X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
+- preempt_conditional_sti(regs);
+- do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
+- preempt_conditional_cli(regs);
+- }
+- exception_exit(prev_state);
+-}
+-
+ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
+ {
+ static const char str[] = "double fault";
+@@ -778,7 +762,7 @@ void __init trap_init(void)
+ set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun);
+ set_intr_gate(X86_TRAP_TS, invalid_TSS);
+ set_intr_gate(X86_TRAP_NP, segment_not_present);
+- set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
++ set_intr_gate(X86_TRAP_SS, stack_segment);
+ set_intr_gate(X86_TRAP_GP, general_protection);
+ set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug);
+ set_intr_gate(X86_TRAP_MF, coprocessor_error);
Copied: dists/wheezy-backports/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch (from r22142, dists/sid/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch)
@@ -0,0 +1,58 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 08 Dec 2014 01:22:04 +0000
+Subject: iovec: Fix ABI change in 3.16.7-ckt1
+Forwarded: not-needed
+
+The combination of 'switch iov_iter_get_pages() to passing maximal
+number of pages' and 'fuse: honour max_read and max_write in direct_io
+mode' adds a new parameter to iov_iter_get_pages().
+
+I don't think it's very likely to be used OOT, but just in case it is:
+- Rename the new version to iov_iter_get_pages_fixed()
+- Define and export iov_iter_get_pages() with the old parameters
+ for ABI compatibility
+- Define iov_iter_get_pages as a macro alias for iov_iter_get_pages_fixed
+
+--- a/include/linux/uio.h
++++ b/include/linux/uio.h
+@@ -84,7 +84,10 @@ unsigned long iov_iter_alignment(const s
+ void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
+ unsigned long nr_segs, size_t count);
+ ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
++ size_t maxsize, size_t *start);
++ssize_t iov_iter_get_pages_fixed(struct iov_iter *i, struct page **pages,
+ size_t maxsize, unsigned maxpages, size_t *start);
++#define iov_iter_get_pages iov_iter_get_pages_fixed
+ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
+ size_t maxsize, size_t *start);
+ int iov_iter_npages(const struct iov_iter *i, int maxpages);
+--- a/mm/iov_iter.c
++++ b/mm/iov_iter.c
+@@ -714,7 +714,8 @@ unsigned long iov_iter_alignment(const s
+ }
+ EXPORT_SYMBOL(iov_iter_alignment);
+
+-ssize_t iov_iter_get_pages(struct iov_iter *i,
++/* Called as iov_iter_get_pages() */
++ssize_t iov_iter_get_pages_fixed(struct iov_iter *i,
+ struct page **pages, size_t maxsize, unsigned maxpages,
+ size_t *start)
+ {
+@@ -723,6 +724,17 @@ ssize_t iov_iter_get_pages(struct iov_it
+ else
+ return get_pages_iovec(i, pages, maxsize, maxpages, start);
+ }
++EXPORT_SYMBOL(iov_iter_get_pages_fixed);
++
++/* ABI compatibility wrapper */
++#undef iov_iter_get_pages
++ssize_t iov_iter_get_pages(struct iov_iter *i,
++ struct page **pages, size_t maxsize,
++ size_t *start)
++{
++ return iov_iter_get_pages_fixed(i, pages, maxsize, maxsize / PAGE_SIZE,
++ start);
++}
+ EXPORT_SYMBOL(iov_iter_get_pages);
+
+ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
Copied: dists/wheezy-backports/linux/debian/patches/debian/of-fix-abi-changes.patch (from r22142, dists/sid/linux/debian/patches/debian/of-fix-abi-changes.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/debian/of-fix-abi-changes.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/debian/of-fix-abi-changes.patch)
@@ -0,0 +1,178 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 08 Dec 2014 01:10:36 +0000
+Subject: of: Fix ABI changes
+Forwarded: not-needed
+
+'of: Fix overflow bug in string property parsing functions'
+(included in 3.16.7-ckt2) and 'of: add optional options parameter to
+of_find_node_by_path()' (cherry-picked to support console selection)
+changed various exported functions into inline wrappers. Change the
+wrappers to exported extern functions, to maintain the ABI.
+
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -882,6 +882,12 @@ struct device_node *of_find_node_opts_by
+ }
+ EXPORT_SYMBOL(of_find_node_opts_by_path);
+
++struct device_node *of_find_node_by_path(const char *path)
++{
++ return of_find_node_opts_by_path(path, NULL);
++}
++EXPORT_SYMBOL(of_find_node_by_path);
++
+ /**
+ * of_find_node_by_name - Find a node by its "name" property
+ * @from: The node to start searching from or NULL, the node
+@@ -1460,6 +1466,51 @@ int of_property_read_string_helper(struc
+ }
+ EXPORT_SYMBOL_GPL(of_property_read_string_helper);
+
++/**
++ * of_property_count_strings() - Find and return the number of strings from a
++ * multiple strings property.
++ * @np: device node from which the property value is to be read.
++ * @propname: name of the property to be searched.
++ *
++ * Search for a property in a device tree node and retrieve the number of null
++ * terminated string contain in it. Returns the number of strings on
++ * success, -EINVAL if the property does not exist, -ENODATA if property
++ * does not have a value, and -EILSEQ if the string is not null-terminated
++ * within the length of the property data.
++ */
++int of_property_count_strings(struct device_node *np, const char *propname)
++{
++ return of_property_read_string_helper(np, propname, NULL, 0, 0);
++}
++EXPORT_SYMBOL_GPL(of_property_count_strings);
++
++/**
++ * of_property_read_string_index() - Find and read a string from a multiple
++ * strings property.
++ * @np: device node from which the property value is to be read.
++ * @propname: name of the property to be searched.
++ * @index: index of the string in the list of strings
++ * @out_string: pointer to null terminated return string, modified only if
++ * return value is 0.
++ *
++ * Search for a property in a device tree node and retrieve a null
++ * terminated string value (pointer to data, not a copy) in the list of strings
++ * contained in that property.
++ * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
++ * property does not have a value, and -EILSEQ if the string is not
++ * null-terminated within the length of the property data.
++ *
++ * The out_string pointer is modified only if a valid string can be decoded.
++ */
++int of_property_read_string_index(struct device_node *np,
++ const char *propname,
++ int index, const char **output)
++{
++ int rc = of_property_read_string_helper(np, propname, output, 1, index);
++ return rc < 0 ? rc : 0;
++}
++EXPORT_SYMBOL_GPL(of_property_read_string_index);
++
+ void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
+ {
+ int i;
+--- a/include/linux/of.h
++++ b/include/linux/of.h
+@@ -230,10 +230,7 @@ extern struct device_node *of_find_match
+
+ extern struct device_node *of_find_node_opts_by_path(const char *path,
+ const char **opts);
+-static inline struct device_node *of_find_node_by_path(const char *path)
+-{
+- return of_find_node_opts_by_path(path, NULL);
+-}
++extern struct device_node *of_find_node_by_path(const char *path);
+
+ extern struct device_node *of_find_node_by_phandle(phandle handle);
+ extern struct device_node *of_get_parent(const struct device_node *node);
+@@ -273,9 +270,14 @@ extern int of_property_read_u64(const st
+ extern int of_property_read_string(struct device_node *np,
+ const char *propname,
+ const char **out_string);
++extern int of_property_read_string_index(struct device_node *np,
++ const char *propname,
++ int index, const char **output);
+ extern int of_property_match_string(struct device_node *np,
+ const char *propname,
+ const char *string);
++extern int of_property_count_strings(struct device_node *np,
++ const char *propname);
+ extern int of_property_read_string_helper(struct device_node *np,
+ const char *propname,
+ const char **out_strs, size_t sz, int index);
+@@ -495,6 +497,19 @@ static inline int of_property_read_strin
+ return -ENOSYS;
+ }
+
++static inline int of_property_read_string_index(struct device_node *np,
++ const char *propname, int index,
++ const char **out_string)
++{
++ return -ENOSYS;
++}
++
++static inline int of_property_count_strings(struct device_node *np,
++ const char *propname)
++{
++ return -ENOSYS;
++}
++
+ static inline int of_property_read_string_helper(struct device_node *np,
+ const char *propname,
+ const char **out_strs, size_t sz, int index)
+@@ -691,50 +706,6 @@ static inline int of_property_read_strin
+ }
+
+ /**
+- * of_property_count_strings() - Find and return the number of strings from a
+- * multiple strings property.
+- * @np: device node from which the property value is to be read.
+- * @propname: name of the property to be searched.
+- *
+- * Search for a property in a device tree node and retrieve the number of null
+- * terminated string contain in it. Returns the number of strings on
+- * success, -EINVAL if the property does not exist, -ENODATA if property
+- * does not have a value, and -EILSEQ if the string is not null-terminated
+- * within the length of the property data.
+- */
+-static inline int of_property_count_strings(struct device_node *np,
+- const char *propname)
+-{
+- return of_property_read_string_helper(np, propname, NULL, 0, 0);
+-}
+-
+-/**
+- * of_property_read_string_index() - Find and read a string from a multiple
+- * strings property.
+- * @np: device node from which the property value is to be read.
+- * @propname: name of the property to be searched.
+- * @index: index of the string in the list of strings
+- * @out_string: pointer to null terminated return string, modified only if
+- * return value is 0.
+- *
+- * Search for a property in a device tree node and retrieve a null
+- * terminated string value (pointer to data, not a copy) in the list of strings
+- * contained in that property.
+- * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
+- * property does not have a value, and -EILSEQ if the string is not
+- * null-terminated within the length of the property data.
+- *
+- * The out_string pointer is modified only if a valid string can be decoded.
+- */
+-static inline int of_property_read_string_index(struct device_node *np,
+- const char *propname,
+- int index, const char **output)
+-{
+- int rc = of_property_read_string_helper(np, propname, output, 1, index);
+- return rc < 0 ? rc : 0;
+-}
+-
+-/**
+ * of_property_read_bool - Findfrom a property
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
Copied: dists/wheezy-backports/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch (from r22142, dists/sid/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/debian/perf-fix-abi-change-in-3.16.7-ckt2.patch)
@@ -0,0 +1,20 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 08 Dec 2014 01:39:31 +0000
+Subject: perf: Fix ABI change in 3.16.7-ckt2
+Forwarded: not-needed
+
+Hide the new #include from genksyms.
+
+
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -41,7 +41,9 @@
+ #include <linux/cgroup.h>
+ #include <linux/module.h>
+ #include <linux/mman.h>
++#ifndef __GENKSYMS__
+ #include <linux/compat.h>
++#endif
+
+ #include "internal.h"
+
Copied: dists/wheezy-backports/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch (from r22142, dists/sid/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch)
@@ -0,0 +1,19 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 08 Dec 2014 01:34:44 +0000
+Subject: truncate: Fix ABI change in 3.16.7-ckt1
+Forwarded: not-needed
+
+Hide the new #include from genksyms.
+
+--- a/mm/truncate.c
++++ b/mm/truncate.c
+@@ -20,7 +20,9 @@
+ #include <linux/buffer_head.h> /* grr. try_to_release_page,
+ do_invalidatepage */
+ #include <linux/cleancache.h>
++#ifndef __GENKSYMS__
+ #include <linux/rmap.h>
++#endif
+ #include "internal.h"
+
+ static void clear_exceptional_entry(struct address_space *mapping,
Copied: dists/wheezy-backports/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch (from r22142, dists/sid/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/all/of-Create-of_console_check-for-selecting-a-console-s.patch)
@@ -0,0 +1,95 @@
+From 3482f2c52b77bf6596e24aae82e204a0603eba66 Mon Sep 17 00:00:00 2001
+From: Grant Likely <grant.likely at linaro.org>
+Date: Thu, 27 Mar 2014 17:18:55 -0700
+Subject: [PATCH] of: Create of_console_check() for selecting a console
+ specified in /chosen
+Origin: https://git.kernel.org/linus/3482f2c52b77bf6596e24aae82e204a0603eba66
+
+The devicetree has a binding for specifying the console device in the
+/chosen node, but the kernel doesn't use it consistently. This change
+adds an API for testing if a device node is a console, and adds a
+preferred console entry if it is.
+
+At the same time this patch removes the of_device_is_stdout_path() API
+since it is unused.
+
+Signed-off-by: Grant Likely <grant.likely at linaro.org>
+Tested-by: Sascha Hauer <s.hauer at pengutronix.de>
+---
+ drivers/of/base.c | 23 +++++++++++++----------
+ include/linux/of.h | 6 +++---
+ 2 files changed, 16 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index b986480..df9b2bb 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -17,6 +17,7 @@
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
++#include <linux/console.h>
+ #include <linux/ctype.h>
+ #include <linux/cpu.h>
+ #include <linux/module.h>
+@@ -2180,20 +2181,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
+ EXPORT_SYMBOL_GPL(of_prop_next_string);
+
+ /**
+- * of_device_is_stdout_path - check if a device node matches the
+- * linux,stdout-path property
+- *
+- * Check if this device node matches the linux,stdout-path property
+- * in the chosen node. return true if yes, false otherwise.
++ * of_console_check() - Test and setup console for DT setup
++ * @dn - Pointer to device node
++ * @name - Name to use for preferred console without index. ex. "ttyS"
++ * @index - Index to use for preferred console.
++ *
++ * Check if the given device node matches the stdout-path property in the
++ * /chosen node. If it does then register it as the preferred console and return
++ * TRUE. Otherwise return FALSE.
+ */
+-int of_device_is_stdout_path(struct device_node *dn)
++bool of_console_check(struct device_node *dn, char *name, int index)
+ {
+- if (!of_stdout)
++ if (!dn || dn != of_stdout || console_set_on_cmdline)
+ return false;
+-
+- return of_stdout == dn;
++ return add_preferred_console(name, index, NULL);
+ }
+-EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
++EXPORT_SYMBOL_GPL(of_console_check);
+
+ /**
+ * of_find_next_cache_node - Find a node's subsidiary cache
+diff --git a/include/linux/of.h b/include/linux/of.h
+index 196b34c..9d97340 100644
+--- a/include/linux/of.h
++++ b/include/linux/of.h
+@@ -352,7 +352,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
+ */
+ const char *of_prop_next_string(struct property *prop, const char *cur);
+
+-int of_device_is_stdout_path(struct device_node *dn);
++bool of_console_check(struct device_node *dn, char *name, int index);
+
+ #else /* CONFIG_OF */
+
+@@ -564,9 +564,9 @@ static inline int of_machine_is_compatible(const char *compat)
+ return 0;
+ }
+
+-static inline int of_device_is_stdout_path(struct device_node *dn)
++static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
+ {
+- return 0;
++ return false;
+ }
+
+ static inline const __be32 *of_prop_next_u32(struct property *prop,
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch (from r22142, dists/sid/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch)
@@ -0,0 +1,47 @@
+From a208ffd251d08ed7ba6bdf3ae1e423373fb12d3d Mon Sep 17 00:00:00 2001
+From: Grant Likely <grant.likely at linaro.org>
+Date: Thu, 27 Mar 2014 18:29:46 -0700
+Subject: [PATCH] of: Enable console on serial ports specified by
+ /chosen/stdout-path
+Origin: https://git.kernel.org/linus/a208ffd251d08ed7ba6bdf3ae1e423373fb12d3d
+
+If the devicetree specifies a serial port as a stdout device, then the
+kernel can use it as the default console if nothing else was selected on
+the command line. For any serial port that uses the uart_add_one_port()
+feature, the uart_add_one_port() has all the information needed to
+automatically enable the console device, which is what this patch does.
+
+With this change applied, a device tree platform can be booted without
+any console= parameters on the command line and the kernel will still be
+able to determine its console.
+
+Tested on QEMU Versatile model and i.MX
+
+Signed-off-by: Grant Likely <grant.likely at linaro.org>
+Tested-by: Sascha Hauer <s.hauer at pengutronix.de>
+[bwh: Avoid ABI change]
+---
+ drivers/tty/serial/serial_core.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/tty/serial/serial_core.c
++++ b/drivers/tty/serial/serial_core.c
+@@ -26,6 +26,9 @@
+ #include <linux/slab.h>
+ #include <linux/init.h>
+ #include <linux/console.h>
++#ifndef __GENKSYMS__
++#include <linux/of.h>
++#endif
+ #include <linux/proc_fs.h>
+ #include <linux/seq_file.h>
+ #include <linux/device.h>
+@@ -2618,6 +2621,8 @@ int uart_add_one_port(struct uart_driver
+ spin_lock_init(&uport->lock);
+ lockdep_set_class(&uport->lock, &port_lock_key);
+ }
++ if (uport->cons && uport->dev)
++ of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
+
+ uart_configure_port(drv, state, uport);
+
Copied: dists/wheezy-backports/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch (from r22142, dists/sid/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/all/of-add-optional-options-parameter-to-of_find_node_by.patch)
@@ -0,0 +1,128 @@
+From 7130f1ef9a22b7fbfea43443a437a92b19f02309 Mon Sep 17 00:00:00 2001
+From: Leif Lindholm <leif.lindholm at linaro.org>
+Date: Fri, 28 Nov 2014 11:34:28 +0000
+Subject: [PATCH 1/2] of: add optional options parameter to
+ of_find_node_by_path()
+Origin: https://git.kernel.org/cgit/linux/kernel/git/glikely/linux.git/commit/?id=75c28c09af99a0db0ccd8b4395469761aa736543
+
+Update of_find_node_by_path():
+1) Rename function to of_find_node_opts_by_path(), adding an optional
+ pointer argument. Provide a static inline wrapper version of
+ of_find_node_by_path() which calls the new function with NULL as
+ the optional argument.
+2) Ignore any part of the path beyond and including the ':' separator.
+3) Set the new provided pointer argument to the beginning of the string
+ following the ':' separator.
+4: Add tests.
+
+---
+ drivers/of/base.c | 20 ++++++++++++++++----
+ include/linux/of.h | 14 +++++++++++++-
+ 2 files changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index 9fd1415..da9a8d2 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -796,10 +796,15 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
+ {
+ struct device_node *child;
+ int len = strchrnul(path, '/') - path;
++ int term;
+
+ if (!len)
+ return NULL;
+
++ term = strchrnul(path, ':') - path;
++ if (term < len)
++ len = term;
++
+ __for_each_child_of_node(parent, child) {
+ const char *name = strrchr(child->full_name, '/');
+ if (WARN(!name, "malformed device_node %s\n", child->full_name))
+@@ -812,11 +817,14 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
+ }
+
+ /**
+- * of_find_node_by_path - Find a node matching a full OF path
++ * of_find_node_opts_by_path - Find a node matching a full OF path
+ * @path: Either the full path to match, or if the path does not
+ * start with '/', the name of a property of the /aliases
+ * node (an alias). In the case of an alias, the node
+ * matching the alias' value will be returned.
++ * @opts: Address of a pointer into which to store the start of
++ * an options string appended to the end of the path with
++ * a ':' separator.
+ *
+ * Valid paths:
+ * /foo/bar Full path
+@@ -826,11 +834,15 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
+ * Returns a node pointer with refcount incremented, use
+ * of_node_put() on it when done.
+ */
+-struct device_node *of_find_node_by_path(const char *path)
++struct device_node *of_find_node_opts_by_path(const char *path, const char **opts)
+ {
+ struct device_node *np = NULL;
+ struct property *pp;
+ unsigned long flags;
++ const char *separator = strchr(path, ':');
++
++ if (opts)
++ *opts = separator ? separator + 1 : NULL;
+
+ if (strcmp(path, "/") == 0)
+ return of_node_get(of_allnodes);
+@@ -838,7 +850,7 @@ struct device_node *of_find_node_by_path(const char *path)
+ /* The path could begin with an alias */
+ if (*path != '/') {
+ char *p = strchrnul(path, '/');
+- int len = p - path;
++ int len = separator ? separator - path : p - path;
+
+ /* of_aliases must not be NULL */
+ if (!of_aliases)
+@@ -867,7 +879,7 @@ struct device_node *of_find_node_by_path(const char *path)
+ raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ return np;
+ }
+-EXPORT_SYMBOL(of_find_node_by_path);
++EXPORT_SYMBOL(of_find_node_opts_by_path);
+
+ /**
+ * of_find_node_by_name - Find a node by its "name" property
+diff --git a/include/linux/of.h b/include/linux/of.h
+index 9d97340..0d2b4c4 100644
+--- a/include/linux/of.h
++++ b/include/linux/of.h
+@@ -228,7 +228,13 @@ extern struct device_node *of_find_matching_node_and_match(
+ const struct of_device_id *matches,
+ const struct of_device_id **match);
+
+-extern struct device_node *of_find_node_by_path(const char *path);
++extern struct device_node *of_find_node_opts_by_path(const char *path,
++ const char **opts);
++static inline struct device_node *of_find_node_by_path(const char *path)
++{
++ return of_find_node_opts_by_path(path, NULL);
++}
++
+ extern struct device_node *of_find_node_by_phandle(phandle handle);
+ extern struct device_node *of_get_parent(const struct device_node *node);
+ extern struct device_node *of_get_next_parent(struct device_node *node);
+@@ -386,6 +392,12 @@ static inline struct device_node *of_find_node_by_path(const char *path)
+ return NULL;
+ }
+
++static inline struct device_node *of_find_node_opts_by_path(const char *path,
++ const char **opts)
++{
++ return NULL;
++}
++
+ static inline struct device_node *of_get_parent(const struct device_node *node)
+ {
+ return NULL;
+--
+2.1.3
+
Copied: dists/wheezy-backports/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch (from r22142, dists/sid/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/all/of-correct-of_console_check-s-return-value.patch)
@@ -0,0 +1,39 @@
+From 5f74d8b7b8546255db6af45b017e9cbb18aed609 Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace at gmail.com>
+Date: Wed, 3 Sep 2014 11:06:43 -0700
+Subject: [PATCH] of: correct of_console_check()'s return value
+Origin: https://git.kernel.org/linus/5f74d8b7b8546255db6af45b017e9cbb18aed609
+
+The comments above of_console_check() say that it will return TRUE if it
+registers a preferred console, but add_preferred_console() uses a
+0-equals-success convention, so this leaves of_console_check() with an
+inconsistent policy for its return values.
+
+Fortunately, nobody was actually checking the return value of
+of_console_check(), so this isn't significant at the moment.
+
+But let's match the comments, so we're doing what we say.
+
+Fixes: 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
+Signed-off-by: Brian Norris <computersforpeace at gmail.com>
+Signed-off-by: Grant Likely <grant.likely at linaro.org>
+---
+ drivers/of/base.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index d8574ad..bcfd08c 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -1986,7 +1986,7 @@ bool of_console_check(struct device_node *dn, char *name, int index)
+ {
+ if (!dn || dn != of_stdout || console_set_on_cmdline)
+ return false;
+- return add_preferred_console(name, index, NULL);
++ return !add_preferred_console(name, index, NULL);
+ }
+ EXPORT_SYMBOL_GPL(of_console_check);
+
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch (from r22142, dists/sid/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/all/of-support-passing-console-options-with-stdout-path.patch)
@@ -0,0 +1,53 @@
+From 469319d402ab844778cf7fbcd94ba1c9d9cfc9ed Mon Sep 17 00:00:00 2001
+From: Leif Lindholm <leif.lindholm at linaro.org>
+Date: Thu, 27 Nov 2014 17:56:07 +0000
+Subject: [PATCH 2/2] of: support passing console options with stdout-path
+Origin: https://git.kernel.org/cgit/linux/kernel/git/glikely/linux.git/commit/?id=7914a7c5651a51617d952e8fa745000ed8c4f001
+
+Support specifying console options (like with console=ttyXN,<options>)
+by appending them to the stdout-path property after a separating ':'.
+
+Example:
+ stdout-path = "uart0:115200";
+
+Signed-off-by: Leif Lindholm <leif.lindholm at linaro.org>
+[grant.likely: minor rework to shorten the diffstat]
+Signed-off-by: Grant Likely <grant.likely at linaro.org>
+---
+ drivers/of/base.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index da9a8d2..bad67ca 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -37,6 +37,7 @@ EXPORT_SYMBOL(of_allnodes);
+ struct device_node *of_chosen;
+ struct device_node *of_aliases;
+ static struct device_node *of_stdout;
++static const char *of_stdout_options;
+
+ static struct kset *of_kset;
+
+@@ -2079,7 +2080,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
+ if (!name)
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name)
+- of_stdout = of_find_node_by_path(name);
++ of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
+ }
+
+ of_aliases = of_find_node_by_path("/aliases");
+@@ -2206,7 +2207,8 @@ bool of_console_check(struct device_node *dn, char *name, int index)
+ {
+ if (!dn || dn != of_stdout || console_set_on_cmdline)
+ return false;
+- return !add_preferred_console(name, index, NULL);
++ return !add_preferred_console(name, index,
++ kstrdup(of_stdout_options, GFP_KERNEL));
+ }
+ EXPORT_SYMBOL_GPL(of_console_check);
+
+--
+2.1.3
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch (from r22142, dists/sid/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch)
@@ -0,0 +1,35 @@
+From f82f99afaa65fd28d0f8409c50e8fcc65ee5e15b Mon Sep 17 00:00:00 2001
+From: Karsten Merker <merker at debian.org>
+Date: Wed, 12 Nov 2014 00:01:46 +0100
+Subject: ARM: dts: sunxi: Banana Pi: increase startup-delay for the GMAC PHY regulator
+Origin: https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/commit/?h=sunxi/dt-for-3.19&id=f82f99afaa65fd28d0f8409c50e8fcc65ee5e15b
+
+On the LeMaker Banana Pi, probing the external ethernet PHY connected
+to the SoC's internal GMAC module sometimes fails. The PHY power
+supply is handled via a GPIO-controlled regulator, and the existing
+regulator startup-delay of 50000us is too short to make sure that the
+PHY is always fully powered up when it is queried by phylib. Tests
+have shown that to provide a reliable PHY detection, the startup-delay
+has to be increased to at least 60000us. To have a certain safety margin
+and to cater for manufacturing variations between different boards,
+the delay gets set to 100000us as discussed on the linux-arm-kernel
+mailinglist.
+
+Signed-off-by: Karsten Merker <merker at debian.org>
+Acked-by: Hans de Goede <hdegoede at redhat.com>
+Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
+
+diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi.dts b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+index 3de847d..1cf1214 100644
+--- a/arch/arm/boot/dts/sun7i-a20-bananapi.dts
++++ b/arch/arm/boot/dts/sun7i-a20-bananapi.dts
+@@ -207,7 +207,7 @@
+ regulator-name = "gmac-3v3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+- startup-delay-us = <50000>;
++ startup-delay-us = <100000>;
+ enable-active-high;
+ gpio = <&pio 7 23 0>;
+ };
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch)
@@ -0,0 +1,64 @@
+From 23a92cd33a89eaf4c76c0a848ec878035c08cc85 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Thu, 9 Oct 2014 18:32:07 -0700
+Subject: [PATCH 03/11] drivers: net: xgene: Add 10GbE ethtool support
+Origin: https://git.kernel.org/linus/41aace6e088d198f2441f3d0e579657d6815234c
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ .../net/ethernet/apm/xgene/xgene_enet_ethtool.c | 28 +++++++++++++++++-----
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
+index 63f2aa5..c1c997b 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
+@@ -59,10 +59,22 @@ static int xgene_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+ struct xgene_enet_pdata *pdata = netdev_priv(ndev);
+ struct phy_device *phydev = pdata->phy_dev;
+
+- if (phydev == NULL)
+- return -ENODEV;
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
++ if (phydev == NULL)
++ return -ENODEV;
+
+- return phy_ethtool_gset(phydev, cmd);
++ return phy_ethtool_gset(phydev, cmd);
++ }
++
++ cmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE;
++ cmd->advertising = cmd->supported;
++ ethtool_cmd_speed_set(cmd, SPEED_10000);
++ cmd->duplex = DUPLEX_FULL;
++ cmd->port = PORT_FIBRE;
++ cmd->transceiver = XCVR_EXTERNAL;
++ cmd->autoneg = AUTONEG_DISABLE;
++
++ return 0;
+ }
+
+ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+@@ -70,10 +82,14 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+ struct xgene_enet_pdata *pdata = netdev_priv(ndev);
+ struct phy_device *phydev = pdata->phy_dev;
+
+- if (phydev == NULL)
+- return -ENODEV;
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
++ if (phydev == NULL)
++ return -ENODEV;
++
++ return phy_ethtool_sset(phydev, cmd);
++ }
+
+- return phy_ethtool_sset(phydev, cmd);
++ return -EINVAL;
+ }
+
+ static void xgene_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-10GbE-support.patch)
@@ -0,0 +1,662 @@
+From 226068a83722c5cf3da300cce9bab7201088a061 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Thu, 9 Oct 2014 18:32:06 -0700
+Subject: [PATCH 02/11] drivers: net: xgene: Add 10GbE support
+Origin: https://git.kernel.org/linus/0148d38d36b76b190ddddff68f02d2617ada3bcb
+
+- Added 10GbE support
+- Removed unused macros/variables
+- Moved mac_init call to the end of hardware init
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/Makefile | 3 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 14 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 58 ++--
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 5 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 331 ++++++++++++++++++++++
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h | 57 ++++
+ 6 files changed, 438 insertions(+), 30 deletions(-)
+ create mode 100644 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+ create mode 100644 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+
+diff --git a/drivers/net/ethernet/apm/xgene/Makefile b/drivers/net/ethernet/apm/xgene/Makefile
+index c643e8a..589b352 100644
+--- a/drivers/net/ethernet/apm/xgene/Makefile
++++ b/drivers/net/ethernet/apm/xgene/Makefile
+@@ -2,5 +2,6 @@
+ # Makefile for APM X-Gene Ethernet Driver.
+ #
+
+-xgene-enet-objs := xgene_enet_hw.o xgene_enet_main.o xgene_enet_ethtool.o
++xgene-enet-objs := xgene_enet_hw.o xgene_enet_xgmac.o \
++ xgene_enet_main.o xgene_enet_ethtool.o
+ obj-$(CONFIG_NET_XGENE) += xgene-enet.o
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+index 084ac68..15ec426 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+@@ -42,6 +42,11 @@ static inline u32 xgene_get_bits(u32 val, u32 start, u32 end)
+ return (val & GENMASK(end, start)) >> start;
+ }
+
++enum xgene_enet_rm {
++ RM0,
++ RM3 = 3
++};
++
+ #define CSR_RING_ID 0x0008
+ #define OVERWRITE BIT(31)
+ #define IS_BUFFER_POOL BIT(20)
+@@ -52,7 +57,6 @@ static inline u32 xgene_get_bits(u32 val, u32 start, u32 end)
+ #define CSR_RING_WR_BASE 0x0070
+ #define NUM_RING_CONFIG 5
+ #define BUFPOOL_MODE 3
+-#define RM3 3
+ #define INC_DEC_CMD_ADDR 0x002c
+ #define UDP_HDR_SIZE 2
+ #define BUF_LEN_CODE_2K 0x5000
+@@ -94,11 +98,9 @@ static inline u32 xgene_get_bits(u32 val, u32 start, u32 end)
+
+ #define BLOCK_ETH_CSR_OFFSET 0x2000
+ #define BLOCK_ETH_RING_IF_OFFSET 0x9000
+-#define BLOCK_ETH_CLKRST_CSR_OFFSET 0xC000
+ #define BLOCK_ETH_DIAG_CSR_OFFSET 0xD000
+
+ #define BLOCK_ETH_MAC_OFFSET 0x0000
+-#define BLOCK_ETH_STATS_OFFSET 0x0014
+ #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800
+
+ #define MAC_ADDR_REG_OFFSET 0x00
+@@ -107,12 +109,6 @@ static inline u32 xgene_get_bits(u32 val, u32 start, u32 end)
+ #define MAC_READ_REG_OFFSET 0x0c
+ #define MAC_COMMAND_DONE_REG_OFFSET 0x10
+
+-#define STAT_ADDR_REG_OFFSET 0x00
+-#define STAT_COMMAND_REG_OFFSET 0x04
+-#define STAT_WRITE_REG_OFFSET 0x08
+-#define STAT_READ_REG_OFFSET 0x0c
+-#define STAT_COMMAND_DONE_REG_OFFSET 0x10
+-
+ #define MII_MGMT_CONFIG_ADDR 0x20
+ #define MII_MGMT_COMMAND_ADDR 0x24
+ #define MII_MGMT_ADDRESS_ADDR 0x28
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index c432644..9b85239 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -21,6 +21,7 @@
+
+ #include "xgene_enet_main.h"
+ #include "xgene_enet_hw.h"
++#include "xgene_enet_xgmac.h"
+
+ static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool)
+ {
+@@ -390,7 +391,7 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring,
+ }
+ }
+
+- return budget;
++ return count;
+ }
+
+ static int xgene_enet_napi(struct napi_struct *napi, const int budget)
+@@ -456,8 +457,10 @@ static int xgene_enet_open(struct net_device *ndev)
+ return ret;
+ napi_enable(&pdata->rx_ring->napi);
+
+- if (pdata->phy_dev)
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+ phy_start(pdata->phy_dev);
++ else
++ schedule_delayed_work(&pdata->link_work, PHY_POLL_LINK_OFF);
+
+ netif_start_queue(ndev);
+
+@@ -471,8 +474,10 @@ static int xgene_enet_close(struct net_device *ndev)
+
+ netif_stop_queue(ndev);
+
+- if (pdata->phy_dev)
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+ phy_stop(pdata->phy_dev);
++ else
++ cancel_delayed_work_sync(&pdata->link_work);
+
+ napi_disable(&pdata->rx_ring->napi);
+ xgene_enet_free_irq(ndev);
+@@ -615,7 +620,6 @@ static struct xgene_enet_desc_ring *xgene_enet_create_desc_ring(
+
+ ring->cmd_base = pdata->ring_cmd_addr + (ring->num << 6);
+ ring->cmd = ring->cmd_base + INC_DEC_CMD_ADDR;
+- pdata->rm = RM3;
+ ring = xgene_enet_setup_ring(ring);
+ netdev_dbg(ndev, "ring info: num=%d size=%d id=%d slots=%d\n",
+ ring->num, ring->size, ring->id, ring->slots);
+@@ -805,8 +809,13 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
+
+ pdata->phy_mode = of_get_phy_mode(pdev->dev.of_node);
+ if (pdata->phy_mode < 0) {
+- dev_err(dev, "Incorrect phy-connection-type in DTS\n");
+- return -EINVAL;
++ dev_err(dev, "Unable to get phy-connection-type\n");
++ return pdata->phy_mode;
++ }
++ if (pdata->phy_mode != PHY_INTERFACE_MODE_RGMII &&
++ pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) {
++ dev_err(dev, "Incorrect phy-connection-type specified\n");
++ return -ENODEV;
+ }
+
+ pdata->clk = devm_clk_get(&pdev->dev, NULL);
+@@ -821,12 +830,18 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
+ pdata->eth_csr_addr = base_addr + BLOCK_ETH_CSR_OFFSET;
+ pdata->eth_ring_if_addr = base_addr + BLOCK_ETH_RING_IF_OFFSET;
+ pdata->eth_diag_csr_addr = base_addr + BLOCK_ETH_DIAG_CSR_OFFSET;
+- pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET;
+- pdata->mcx_stats_addr = base_addr + BLOCK_ETH_STATS_OFFSET;
+- pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET;
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
++ pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET;
++ pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET;
++ pdata->rm = RM3;
++ } else {
++ pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET;
++ pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET;
++ pdata->rm = RM0;
++ }
+ pdata->rx_buff_cnt = NUM_PKT_BUF;
+
+- return ret;
++ return 0;
+ }
+
+ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+@@ -836,8 +851,7 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+ u16 dst_ring_num;
+ int ret;
+
+- pdata->mac_ops->tx_disable(pdata);
+- pdata->mac_ops->rx_disable(pdata);
++ pdata->port_ops->reset(pdata);
+
+ ret = xgene_enet_create_desc_rings(ndev);
+ if (ret) {
+@@ -856,14 +870,23 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+
+ dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring);
+ pdata->port_ops->cle_bypass(pdata, dst_ring_num, buf_pool->id);
++ pdata->mac_ops->init(pdata);
+
+ return ret;
+ }
+
+ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
+ {
+- pdata->mac_ops = &xgene_gmac_ops;
+- pdata->port_ops = &xgene_gport_ops;
++ switch (pdata->phy_mode) {
++ case PHY_INTERFACE_MODE_RGMII:
++ pdata->mac_ops = &xgene_gmac_ops;
++ pdata->port_ops = &xgene_gport_ops;
++ break;
++ default:
++ pdata->mac_ops = &xgene_xgmac_ops;
++ pdata->port_ops = &xgene_xgport_ops;
++ break;
++ }
+ }
+
+ static int xgene_enet_probe(struct platform_device *pdev)
+@@ -895,8 +918,6 @@ static int xgene_enet_probe(struct platform_device *pdev)
+ goto err;
+
+ xgene_enet_setup_ops(pdata);
+- pdata->port_ops->reset(pdata);
+- pdata->mac_ops->init(pdata);
+
+ ret = register_netdev(ndev);
+ if (ret) {
+@@ -916,7 +937,10 @@ static int xgene_enet_probe(struct platform_device *pdev)
+
+ napi = &pdata->rx_ring->napi;
+ netif_napi_add(ndev, napi, xgene_enet_napi, NAPI_POLL_WEIGHT);
+- ret = xgene_enet_mdio_config(pdata);
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
++ ret = xgene_enet_mdio_config(pdata);
++ else
++ INIT_DELAYED_WORK(&pdata->link_work, xgene_enet_link_state);
+
+ return ret;
+ err:
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index ac180f9..86cf68b 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -105,18 +105,17 @@ struct xgene_enet_pdata {
+ void __iomem *eth_ring_if_addr;
+ void __iomem *eth_diag_csr_addr;
+ void __iomem *mcx_mac_addr;
+- void __iomem *mcx_stats_addr;
+ void __iomem *mcx_mac_csr_addr;
+ void __iomem *base_addr;
+ void __iomem *ring_csr_addr;
+ void __iomem *ring_cmd_addr;
+ u32 phy_addr;
+ int phy_mode;
+- u32 speed;
+- u16 rm;
++ enum xgene_enet_rm rm;
+ struct rtnl_link_stats64 stats;
+ struct xgene_mac_ops *mac_ops;
+ struct xgene_port_ops *port_ops;
++ struct delayed_work link_work;
+ };
+
+ /* Set the specified value into a bit-field defined by its starting position
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+new file mode 100644
+index 0000000..cd64b9f
+--- /dev/null
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+@@ -0,0 +1,331 @@
++/* Applied Micro X-Gene SoC Ethernet Driver
++ *
++ * Copyright (c) 2014, Applied Micro Circuits Corporation
++ * Authors: Iyappan Subramanian <isubramanian at apm.com>
++ * Keyur Chudgar <kchudgar at apm.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "xgene_enet_main.h"
++#include "xgene_enet_hw.h"
++#include "xgene_enet_xgmac.h"
++
++static void xgene_enet_wr_csr(struct xgene_enet_pdata *pdata,
++ u32 offset, u32 val)
++{
++ void __iomem *addr = pdata->eth_csr_addr + offset;
++
++ iowrite32(val, addr);
++}
++
++static void xgene_enet_wr_ring_if(struct xgene_enet_pdata *pdata,
++ u32 offset, u32 val)
++{
++ void __iomem *addr = pdata->eth_ring_if_addr + offset;
++
++ iowrite32(val, addr);
++}
++
++static void xgene_enet_wr_diag_csr(struct xgene_enet_pdata *pdata,
++ u32 offset, u32 val)
++{
++ void __iomem *addr = pdata->eth_diag_csr_addr + offset;
++
++ iowrite32(val, addr);
++}
++
++static bool xgene_enet_wr_indirect(void __iomem *addr, void __iomem *wr,
++ void __iomem *cmd, void __iomem *cmd_done,
++ u32 wr_addr, u32 wr_data)
++{
++ u32 done;
++ u8 wait = 10;
++
++ iowrite32(wr_addr, addr);
++ iowrite32(wr_data, wr);
++ iowrite32(XGENE_ENET_WR_CMD, cmd);
++
++ /* wait for write command to complete */
++ while (!(done = ioread32(cmd_done)) && wait--)
++ udelay(1);
++
++ if (!done)
++ return false;
++
++ iowrite32(0, cmd);
++
++ return true;
++}
++
++static void xgene_enet_wr_mac(struct xgene_enet_pdata *pdata,
++ u32 wr_addr, u32 wr_data)
++{
++ void __iomem *addr, *wr, *cmd, *cmd_done;
++
++ addr = pdata->mcx_mac_addr + MAC_ADDR_REG_OFFSET;
++ wr = pdata->mcx_mac_addr + MAC_WRITE_REG_OFFSET;
++ cmd = pdata->mcx_mac_addr + MAC_COMMAND_REG_OFFSET;
++ cmd_done = pdata->mcx_mac_addr + MAC_COMMAND_DONE_REG_OFFSET;
++
++ if (!xgene_enet_wr_indirect(addr, wr, cmd, cmd_done, wr_addr, wr_data))
++ netdev_err(pdata->ndev, "MCX mac write failed, addr: %04x\n",
++ wr_addr);
++}
++
++static void xgene_enet_rd_csr(struct xgene_enet_pdata *pdata,
++ u32 offset, u32 *val)
++{
++ void __iomem *addr = pdata->eth_csr_addr + offset;
++
++ *val = ioread32(addr);
++}
++
++static void xgene_enet_rd_diag_csr(struct xgene_enet_pdata *pdata,
++ u32 offset, u32 *val)
++{
++ void __iomem *addr = pdata->eth_diag_csr_addr + offset;
++
++ *val = ioread32(addr);
++}
++
++static bool xgene_enet_rd_indirect(void __iomem *addr, void __iomem *rd,
++ void __iomem *cmd, void __iomem *cmd_done,
++ u32 rd_addr, u32 *rd_data)
++{
++ u32 done;
++ u8 wait = 10;
++
++ iowrite32(rd_addr, addr);
++ iowrite32(XGENE_ENET_RD_CMD, cmd);
++
++ /* wait for read command to complete */
++ while (!(done = ioread32(cmd_done)) && wait--)
++ udelay(1);
++
++ if (!done)
++ return false;
++
++ *rd_data = ioread32(rd);
++ iowrite32(0, cmd);
++
++ return true;
++}
++
++static void xgene_enet_rd_mac(struct xgene_enet_pdata *pdata,
++ u32 rd_addr, u32 *rd_data)
++{
++ void __iomem *addr, *rd, *cmd, *cmd_done;
++
++ addr = pdata->mcx_mac_addr + MAC_ADDR_REG_OFFSET;
++ rd = pdata->mcx_mac_addr + MAC_READ_REG_OFFSET;
++ cmd = pdata->mcx_mac_addr + MAC_COMMAND_REG_OFFSET;
++ cmd_done = pdata->mcx_mac_addr + MAC_COMMAND_DONE_REG_OFFSET;
++
++ if (!xgene_enet_rd_indirect(addr, rd, cmd, cmd_done, rd_addr, rd_data))
++ netdev_err(pdata->ndev, "MCX mac read failed, addr: %04x\n",
++ rd_addr);
++}
++
++static int xgene_enet_ecc_init(struct xgene_enet_pdata *pdata)
++{
++ struct net_device *ndev = pdata->ndev;
++ u32 data;
++ u8 wait = 10;
++
++ xgene_enet_wr_diag_csr(pdata, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0x0);
++ do {
++ usleep_range(100, 110);
++ xgene_enet_rd_diag_csr(pdata, ENET_BLOCK_MEM_RDY_ADDR, &data);
++ } while ((data != 0xffffffff) && wait--);
++
++ if (data != 0xffffffff) {
++ netdev_err(ndev, "Failed to release memory from shutdown\n");
++ return -ENODEV;
++ }
++
++ return 0;
++}
++
++static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata)
++{
++ xgene_enet_wr_ring_if(pdata, ENET_CFGSSQMIWQASSOC_ADDR, 0);
++ xgene_enet_wr_ring_if(pdata, ENET_CFGSSQMIFPQASSOC_ADDR, 0);
++ xgene_enet_wr_ring_if(pdata, ENET_CFGSSQMIQMLITEWQASSOC_ADDR, 0);
++ xgene_enet_wr_ring_if(pdata, ENET_CFGSSQMIQMLITEFPQASSOC_ADDR, 0);
++}
++
++static void xgene_xgmac_reset(struct xgene_enet_pdata *pdata)
++{
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_0, HSTMACRST);
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_0, 0);
++}
++
++static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata)
++{
++ u32 addr0, addr1;
++ u8 *dev_addr = pdata->ndev->dev_addr;
++
++ addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
++ (dev_addr[1] << 8) | dev_addr[0];
++ addr1 = (dev_addr[5] << 24) | (dev_addr[4] << 16);
++
++ xgene_enet_wr_mac(pdata, HSTMACADR_LSW_ADDR, addr0);
++ xgene_enet_wr_mac(pdata, HSTMACADR_MSW_ADDR, addr1);
++}
++
++static u32 xgene_enet_link_status(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_enet_rd_csr(pdata, XG_LINK_STATUS_ADDR, &data);
++
++ return data;
++}
++
++static void xgene_xgmac_init(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_xgmac_reset(pdata);
++
++ xgene_enet_rd_mac(pdata, AXGMAC_CONFIG_1, &data);
++ data |= HSTPPEN;
++ data &= ~HSTLENCHK;
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data);
++
++ xgene_enet_wr_mac(pdata, HSTMAXFRAME_LENGTH_ADDR, 0x06000600);
++ xgene_xgmac_set_mac_addr(pdata);
++
++ xgene_enet_rd_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, &data);
++ data |= CFG_RSIF_FPBUFF_TIMEOUT_EN;
++ xgene_enet_wr_csr(pdata, XG_RSIF_CONFIG_REG_ADDR, data);
++
++ xgene_enet_wr_csr(pdata, XG_CFG_BYPASS_ADDR, RESUME_TX);
++ xgene_enet_wr_csr(pdata, XGENET_RX_DV_GATE_REG_0_ADDR, 0);
++ xgene_enet_rd_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, &data);
++ data |= BIT(12);
++ xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_ADDR, data);
++ xgene_enet_wr_csr(pdata, XG_ENET_SPARE_CFG_REG_1_ADDR, 0x82);
++}
++
++static void xgene_xgmac_rx_enable(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_enet_rd_mac(pdata, AXGMAC_CONFIG_1, &data);
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data | HSTRFEN);
++}
++
++static void xgene_xgmac_tx_enable(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_enet_rd_mac(pdata, AXGMAC_CONFIG_1, &data);
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data | HSTTFEN);
++}
++
++static void xgene_xgmac_rx_disable(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_enet_rd_mac(pdata, AXGMAC_CONFIG_1, &data);
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTRFEN);
++}
++
++static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata)
++{
++ u32 data;
++
++ xgene_enet_rd_mac(pdata, AXGMAC_CONFIG_1, &data);
++ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN);
++}
++
++static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
++{
++ clk_prepare_enable(pdata->clk);
++ clk_disable_unprepare(pdata->clk);
++ clk_prepare_enable(pdata->clk);
++
++ xgene_enet_ecc_init(pdata);
++ xgene_enet_config_ring_if_assoc(pdata);
++}
++
++static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
++ u32 dst_ring_num, u16 bufpool_id)
++{
++ u32 cb, fpsel;
++
++ xgene_enet_rd_csr(pdata, XCLE_BYPASS_REG0_ADDR, &cb);
++ cb |= CFG_CLE_BYPASS_EN0;
++ CFG_CLE_IP_PROTOCOL0_SET(&cb, 3);
++ xgene_enet_wr_csr(pdata, XCLE_BYPASS_REG0_ADDR, cb);
++
++ fpsel = xgene_enet_ring_bufnum(bufpool_id) - 0x20;
++ xgene_enet_rd_csr(pdata, XCLE_BYPASS_REG1_ADDR, &cb);
++ CFG_CLE_DSTQID0_SET(&cb, dst_ring_num);
++ CFG_CLE_FPSEL0_SET(&cb, fpsel);
++ xgene_enet_wr_csr(pdata, XCLE_BYPASS_REG1_ADDR, cb);
++}
++
++static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
++{
++ clk_disable_unprepare(pdata->clk);
++}
++
++void xgene_enet_link_state(struct work_struct *work)
++{
++ struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work),
++ struct xgene_enet_pdata, link_work);
++ struct net_device *ndev = pdata->ndev;
++ u32 link_status, poll_interval;
++
++ link_status = xgene_enet_link_status(pdata);
++ if (link_status) {
++ if (!netif_carrier_ok(ndev)) {
++ netif_carrier_on(ndev);
++ xgene_xgmac_init(pdata);
++ xgene_xgmac_rx_enable(pdata);
++ xgene_xgmac_tx_enable(pdata);
++ netdev_info(ndev, "Link is Up - 10Gbps\n");
++ }
++ poll_interval = PHY_POLL_LINK_ON;
++ } else {
++ if (netif_carrier_ok(ndev)) {
++ xgene_xgmac_rx_disable(pdata);
++ xgene_xgmac_tx_disable(pdata);
++ netif_carrier_off(ndev);
++ netdev_info(ndev, "Link is Down\n");
++ }
++ poll_interval = PHY_POLL_LINK_OFF;
++ }
++
++ schedule_delayed_work(&pdata->link_work, poll_interval);
++}
++
++struct xgene_mac_ops xgene_xgmac_ops = {
++ .init = xgene_xgmac_init,
++ .reset = xgene_xgmac_reset,
++ .rx_enable = xgene_xgmac_rx_enable,
++ .tx_enable = xgene_xgmac_tx_enable,
++ .rx_disable = xgene_xgmac_rx_disable,
++ .tx_disable = xgene_xgmac_tx_disable,
++ .set_mac_addr = xgene_xgmac_set_mac_addr,
++};
++
++struct xgene_port_ops xgene_xgport_ops = {
++ .reset = xgene_enet_reset,
++ .cle_bypass = xgene_enet_xgcle_bypass,
++ .shutdown = xgene_enet_shutdown,
++};
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+new file mode 100644
+index 0000000..d2d59e7
+--- /dev/null
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+@@ -0,0 +1,57 @@
++/* Applied Micro X-Gene SoC Ethernet Driver
++ *
++ * Copyright (c) 2014, Applied Micro Circuits Corporation
++ * Authors: Iyappan Subramanian <isubramanian at apm.com>
++ * Keyur Chudgar <kchudgar at apm.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef __XGENE_ENET_XGMAC_H__
++#define __XGENE_ENET_XGMAC_H__
++
++#define BLOCK_AXG_MAC_OFFSET 0x0800
++#define BLOCK_AXG_MAC_CSR_OFFSET 0x2000
++
++#define AXGMAC_CONFIG_0 0x0000
++#define AXGMAC_CONFIG_1 0x0004
++#define HSTMACRST BIT(31)
++#define HSTTCTLEN BIT(31)
++#define HSTTFEN BIT(30)
++#define HSTRCTLEN BIT(29)
++#define HSTRFEN BIT(28)
++#define HSTPPEN BIT(7)
++#define HSTDRPLT64 BIT(5)
++#define HSTLENCHK BIT(3)
++#define HSTMACADR_LSW_ADDR 0x0010
++#define HSTMACADR_MSW_ADDR 0x0014
++#define HSTMAXFRAME_LENGTH_ADDR 0x0020
++
++#define XG_RSIF_CONFIG_REG_ADDR 0x00a0
++#define XCLE_BYPASS_REG0_ADDR 0x0160
++#define XCLE_BYPASS_REG1_ADDR 0x0164
++#define XG_CFG_BYPASS_ADDR 0x0204
++#define XG_LINK_STATUS_ADDR 0x0228
++#define XG_ENET_SPARE_CFG_REG_ADDR 0x040c
++#define XG_ENET_SPARE_CFG_REG_1_ADDR 0x0410
++#define XGENET_RX_DV_GATE_REG_0_ADDR 0x0804
++
++#define PHY_POLL_LINK_ON (10 * HZ)
++#define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
++
++void xgene_enet_link_state(struct work_struct *work);
++extern struct xgene_mac_ops xgene_xgmac_ops;
++extern struct xgene_port_ops xgene_xgport_ops;
++
++#endif /* __XGENE_ENET_XGMAC_H__ */
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch)
@@ -0,0 +1,55 @@
+From c566829d7ea3c25a85a372901b0fce080017034b Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 13 Oct 2014 17:05:35 -0700
+Subject: [PATCH 06/11] drivers: net: xgene: Add SGMII based 1GbE ethtool
+ support
+Origin: https://git.kernel.org/linus/5e6a024bebea5bad6b787cf2c0ee28116b4147f0
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ .../net/ethernet/apm/xgene/xgene_enet_ethtool.c | 25 +++++++++++++++-------
+ 1 file changed, 17 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
+index c1c997b..416d6eb 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
+@@ -64,16 +64,25 @@ static int xgene_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+ return -ENODEV;
+
+ return phy_ethtool_gset(phydev, cmd);
++ } else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
++ cmd->supported = SUPPORTED_1000baseT_Full |
++ SUPPORTED_Autoneg | SUPPORTED_MII;
++ cmd->advertising = cmd->supported;
++ ethtool_cmd_speed_set(cmd, SPEED_1000);
++ cmd->duplex = DUPLEX_FULL;
++ cmd->port = PORT_MII;
++ cmd->transceiver = XCVR_INTERNAL;
++ cmd->autoneg = AUTONEG_ENABLE;
++ } else {
++ cmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE;
++ cmd->advertising = cmd->supported;
++ ethtool_cmd_speed_set(cmd, SPEED_10000);
++ cmd->duplex = DUPLEX_FULL;
++ cmd->port = PORT_FIBRE;
++ cmd->transceiver = XCVR_INTERNAL;
++ cmd->autoneg = AUTONEG_DISABLE;
+ }
+
+- cmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE;
+- cmd->advertising = cmd->supported;
+- ethtool_cmd_speed_set(cmd, SPEED_10000);
+- cmd->duplex = DUPLEX_FULL;
+- cmd->port = PORT_FIBRE;
+- cmd->transceiver = XCVR_EXTERNAL;
+- cmd->autoneg = AUTONEG_DISABLE;
+-
+ return 0;
+ }
+
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch)
@@ -0,0 +1,583 @@
+From 30bf224d12eb84225e3c0dcdd520cf9a23276f11 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 13 Oct 2014 17:05:34 -0700
+Subject: [PATCH 05/11] drivers: net: xgene: Add SGMII based 1GbE support
+Origin: https://git.kernel.org/linus/32f784b50e14c653ad0f010fbd5921a5f8caf846
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/Makefile | 2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 3 +
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 10 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 10 +
+ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 389 ++++++++++++++++++++++
+ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h | 41 +++
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h | 3 -
+ 7 files changed, 453 insertions(+), 5 deletions(-)
+ create mode 100644 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+ create mode 100644 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h
+
+diff --git a/drivers/net/ethernet/apm/xgene/Makefile b/drivers/net/ethernet/apm/xgene/Makefile
+index 589b352..68be5655 100644
+--- a/drivers/net/ethernet/apm/xgene/Makefile
++++ b/drivers/net/ethernet/apm/xgene/Makefile
+@@ -2,6 +2,6 @@
+ # Makefile for APM X-Gene Ethernet Driver.
+ #
+
+-xgene-enet-objs := xgene_enet_hw.o xgene_enet_xgmac.o \
++xgene-enet-objs := xgene_enet_hw.o xgene_enet_sgmac.o xgene_enet_xgmac.o \
+ xgene_enet_main.o xgene_enet_ethtool.o
+ obj-$(CONFIG_NET_XGENE) += xgene-enet.o
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+index 2efc4d9..3855858 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+@@ -44,6 +44,7 @@ static inline u32 xgene_get_bits(u32 val, u32 start, u32 end)
+
+ enum xgene_enet_rm {
+ RM0,
++ RM1,
+ RM3 = 3
+ };
+
+@@ -143,6 +144,8 @@ enum xgene_enet_rm {
+ #define CFG_CLE_FPSEL0_SET(dst, val) xgene_set_bits(dst, val, 16, 4)
+ #define CFG_MACMODE_SET(dst, val) xgene_set_bits(dst, val, 18, 2)
+ #define CFG_WAITASYNCRD_SET(dst, val) xgene_set_bits(dst, val, 0, 16)
++#define CFG_CLE_DSTQID0(val) (val & GENMASK(11, 0))
++#define CFG_CLE_FPSEL0(val) ((val << 16) & GENMASK(19, 16))
+ #define ICM_CONFIG0_REG_0_ADDR 0x0400
+ #define ICM_CONFIG2_REG_0_ADDR 0x0410
+ #define RX_DV_GATE_REG_0_ADDR 0x05fc
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index 9e251ec..3c208cc 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -21,6 +21,7 @@
+
+ #include "xgene_enet_main.h"
+ #include "xgene_enet_hw.h"
++#include "xgene_enet_sgmac.h"
+ #include "xgene_enet_xgmac.h"
+
+ static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool)
+@@ -813,6 +814,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
+ return pdata->phy_mode;
+ }
+ if (pdata->phy_mode != PHY_INTERFACE_MODE_RGMII &&
++ pdata->phy_mode != PHY_INTERFACE_MODE_SGMII &&
+ pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) {
+ dev_err(dev, "Incorrect phy-connection-type specified\n");
+ return -ENODEV;
+@@ -830,7 +832,8 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
+ pdata->eth_csr_addr = base_addr + BLOCK_ETH_CSR_OFFSET;
+ pdata->eth_ring_if_addr = base_addr + BLOCK_ETH_RING_IF_OFFSET;
+ pdata->eth_diag_csr_addr = base_addr + BLOCK_ETH_DIAG_CSR_OFFSET;
+- if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
++ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII ||
++ pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) {
+ pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET;
+ pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET;
+ } else {
+@@ -881,6 +884,11 @@ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
+ pdata->port_ops = &xgene_gport_ops;
+ pdata->rm = RM3;
+ break;
++ case PHY_INTERFACE_MODE_SGMII:
++ pdata->mac_ops = &xgene_sgmac_ops;
++ pdata->port_ops = &xgene_sgport_ops;
++ pdata->rm = RM1;
++ break;
+ default:
+ pdata->mac_ops = &xgene_xgmac_ops;
+ pdata->port_ops = &xgene_xgport_ops;
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index 10b03a1..874e5a0 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -39,6 +39,9 @@
+ #define NUM_PKT_BUF 64
+ #define NUM_BUFPOOL 32
+
++#define PHY_POLL_LINK_ON (10 * HZ)
++#define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
++
+ /* software context of a descriptor ring */
+ struct xgene_enet_desc_ring {
+ struct net_device *ndev;
+@@ -118,6 +121,13 @@ struct xgene_enet_pdata {
+ struct delayed_work link_work;
+ };
+
++struct xgene_indirect_ctl {
++ void __iomem *addr;
++ void __iomem *ctl;
++ void __iomem *cmd;
++ void __iomem *cmd_done;
++};
++
+ /* Set the specified value into a bit-field defined by its starting position
+ * and length within a single u64.
+ */
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+new file mode 100644
+index 0000000..e6d24c2
+--- /dev/null
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+@@ -0,0 +1,389 @@
++/* Applied Micro X-Gene SoC Ethernet Driver
++ *
++ * Copyright (c) 2014, Applied Micro Circuits Corporation
++ * Authors: Iyappan Subramanian <isubramanian at apm.com>
++ * Keyur Chudgar <kchudgar at apm.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "xgene_enet_main.h"
++#include "xgene_enet_hw.h"
++#include "xgene_enet_sgmac.h"
++
++static void xgene_enet_wr_csr(struct xgene_enet_pdata *p, u32 offset, u32 val)
++{
++ iowrite32(val, p->eth_csr_addr + offset);
++}
++
++static void xgene_enet_wr_ring_if(struct xgene_enet_pdata *p,
++ u32 offset, u32 val)
++{
++ iowrite32(val, p->eth_ring_if_addr + offset);
++}
++
++static void xgene_enet_wr_diag_csr(struct xgene_enet_pdata *p,
++ u32 offset, u32 val)
++{
++ iowrite32(val, p->eth_diag_csr_addr + offset);
++}
++
++static bool xgene_enet_wr_indirect(struct xgene_indirect_ctl *ctl,
++ u32 wr_addr, u32 wr_data)
++{
++ int i;
++
++ iowrite32(wr_addr, ctl->addr);
++ iowrite32(wr_data, ctl->ctl);
++ iowrite32(XGENE_ENET_WR_CMD, ctl->cmd);
++
++ /* wait for write command to complete */
++ for (i = 0; i < 10; i++) {
++ if (ioread32(ctl->cmd_done)) {
++ iowrite32(0, ctl->cmd);
++ return true;
++ }
++ udelay(1);
++ }
++
++ return false;
++}
++
++static void xgene_enet_wr_mac(struct xgene_enet_pdata *p,
++ u32 wr_addr, u32 wr_data)
++{
++ struct xgene_indirect_ctl ctl = {
++ .addr = p->mcx_mac_addr + MAC_ADDR_REG_OFFSET,
++ .ctl = p->mcx_mac_addr + MAC_WRITE_REG_OFFSET,
++ .cmd = p->mcx_mac_addr + MAC_COMMAND_REG_OFFSET,
++ .cmd_done = p->mcx_mac_addr + MAC_COMMAND_DONE_REG_OFFSET
++ };
++
++ if (!xgene_enet_wr_indirect(&ctl, wr_addr, wr_data))
++ netdev_err(p->ndev, "mac write failed, addr: %04x\n", wr_addr);
++}
++
++static u32 xgene_enet_rd_csr(struct xgene_enet_pdata *p, u32 offset)
++{
++ return ioread32(p->eth_csr_addr + offset);
++}
++
++static u32 xgene_enet_rd_diag_csr(struct xgene_enet_pdata *p, u32 offset)
++{
++ return ioread32(p->eth_diag_csr_addr + offset);
++}
++
++static u32 xgene_enet_rd_indirect(struct xgene_indirect_ctl *ctl, u32 rd_addr)
++{
++ u32 rd_data;
++ int i;
++
++ iowrite32(rd_addr, ctl->addr);
++ iowrite32(XGENE_ENET_RD_CMD, ctl->cmd);
++
++ /* wait for read command to complete */
++ for (i = 0; i < 10; i++) {
++ if (ioread32(ctl->cmd_done)) {
++ rd_data = ioread32(ctl->ctl);
++ iowrite32(0, ctl->cmd);
++
++ return rd_data;
++ }
++ udelay(1);
++ }
++
++ pr_err("%s: mac read failed, addr: %04x\n", __func__, rd_addr);
++
++ return 0;
++}
++
++static u32 xgene_enet_rd_mac(struct xgene_enet_pdata *p, u32 rd_addr)
++{
++ struct xgene_indirect_ctl ctl = {
++ .addr = p->mcx_mac_addr + MAC_ADDR_REG_OFFSET,
++ .ctl = p->mcx_mac_addr + MAC_READ_REG_OFFSET,
++ .cmd = p->mcx_mac_addr + MAC_COMMAND_REG_OFFSET,
++ .cmd_done = p->mcx_mac_addr + MAC_COMMAND_DONE_REG_OFFSET
++ };
++
++ return xgene_enet_rd_indirect(&ctl, rd_addr);
++}
++
++static int xgene_enet_ecc_init(struct xgene_enet_pdata *p)
++{
++ struct net_device *ndev = p->ndev;
++ u32 data;
++ int i;
++
++ xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0);
++ for (i = 0; i < 10 && data != ~0U ; i++) {
++ usleep_range(100, 110);
++ data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR);
++ }
++
++ if (data != ~0U) {
++ netdev_err(ndev, "Failed to release memory from shutdown\n");
++ return -ENODEV;
++ }
++
++ return 0;
++}
++
++static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p)
++{
++ u32 val = 0xffffffff;
++
++ xgene_enet_wr_ring_if(p, ENET_CFGSSQMIWQASSOC_ADDR, val);
++ xgene_enet_wr_ring_if(p, ENET_CFGSSQMIFPQASSOC_ADDR, val);
++}
++
++static void xgene_mii_phy_write(struct xgene_enet_pdata *p, u8 phy_id,
++ u32 reg, u16 data)
++{
++ u32 addr, wr_data, done;
++ int i;
++
++ addr = PHY_ADDR(phy_id) | REG_ADDR(reg);
++ xgene_enet_wr_mac(p, MII_MGMT_ADDRESS_ADDR, addr);
++
++ wr_data = PHY_CONTROL(data);
++ xgene_enet_wr_mac(p, MII_MGMT_CONTROL_ADDR, wr_data);
++
++ for (i = 0; i < 10; i++) {
++ done = xgene_enet_rd_mac(p, MII_MGMT_INDICATORS_ADDR);
++ if (!(done & BUSY_MASK))
++ return;
++ usleep_range(10, 20);
++ }
++
++ netdev_err(p->ndev, "MII_MGMT write failed\n");
++}
++
++static u32 xgene_mii_phy_read(struct xgene_enet_pdata *p, u8 phy_id, u32 reg)
++{
++ u32 addr, data, done;
++ int i;
++
++ addr = PHY_ADDR(phy_id) | REG_ADDR(reg);
++ xgene_enet_wr_mac(p, MII_MGMT_ADDRESS_ADDR, addr);
++ xgene_enet_wr_mac(p, MII_MGMT_COMMAND_ADDR, READ_CYCLE_MASK);
++
++ for (i = 0; i < 10; i++) {
++ done = xgene_enet_rd_mac(p, MII_MGMT_INDICATORS_ADDR);
++ if (!(done & BUSY_MASK)) {
++ data = xgene_enet_rd_mac(p, MII_MGMT_STATUS_ADDR);
++ xgene_enet_wr_mac(p, MII_MGMT_COMMAND_ADDR, 0);
++
++ return data;
++ }
++ usleep_range(10, 20);
++ }
++
++ netdev_err(p->ndev, "MII_MGMT read failed\n");
++
++ return 0;
++}
++
++static void xgene_sgmac_reset(struct xgene_enet_pdata *p)
++{
++ xgene_enet_wr_mac(p, MAC_CONFIG_1_ADDR, SOFT_RESET1);
++ xgene_enet_wr_mac(p, MAC_CONFIG_1_ADDR, 0);
++}
++
++static void xgene_sgmac_set_mac_addr(struct xgene_enet_pdata *p)
++{
++ u32 addr0, addr1;
++ u8 *dev_addr = p->ndev->dev_addr;
++
++ addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
++ (dev_addr[1] << 8) | dev_addr[0];
++ xgene_enet_wr_mac(p, STATION_ADDR0_ADDR, addr0);
++
++ addr1 = xgene_enet_rd_mac(p, STATION_ADDR1_ADDR);
++ addr1 |= (dev_addr[5] << 24) | (dev_addr[4] << 16);
++ xgene_enet_wr_mac(p, STATION_ADDR1_ADDR, addr1);
++}
++
++static u32 xgene_enet_link_status(struct xgene_enet_pdata *p)
++{
++ u32 data;
++
++ data = xgene_mii_phy_read(p, INT_PHY_ADDR,
++ SGMII_BASE_PAGE_ABILITY_ADDR >> 2);
++
++ return data & LINK_UP;
++}
++
++static void xgene_sgmac_init(struct xgene_enet_pdata *p)
++{
++ u32 data, loop = 10;
++
++ xgene_sgmac_reset(p);
++
++ /* Enable auto-negotiation */
++ xgene_mii_phy_write(p, INT_PHY_ADDR, SGMII_CONTROL_ADDR >> 2, 0x1000);
++ xgene_mii_phy_write(p, INT_PHY_ADDR, SGMII_TBI_CONTROL_ADDR >> 2, 0);
++
++ while (loop--) {
++ data = xgene_mii_phy_read(p, INT_PHY_ADDR,
++ SGMII_STATUS_ADDR >> 2);
++ if ((data & AUTO_NEG_COMPLETE) && (data & LINK_STATUS))
++ break;
++ usleep_range(10, 20);
++ }
++ if (!(data & AUTO_NEG_COMPLETE) || !(data & LINK_STATUS))
++ netdev_err(p->ndev, "Auto-negotiation failed\n");
++
++ data = xgene_enet_rd_mac(p, MAC_CONFIG_2_ADDR);
++ ENET_INTERFACE_MODE2_SET(&data, 2);
++ xgene_enet_wr_mac(p, MAC_CONFIG_2_ADDR, data | FULL_DUPLEX2);
++ xgene_enet_wr_mac(p, INTERFACE_CONTROL_ADDR, ENET_GHD_MODE);
++
++ data = xgene_enet_rd_csr(p, ENET_SPARE_CFG_REG_ADDR);
++ data |= MPA_IDLE_WITH_QMI_EMPTY;
++ xgene_enet_wr_csr(p, ENET_SPARE_CFG_REG_ADDR, data);
++
++ xgene_sgmac_set_mac_addr(p);
++
++ data = xgene_enet_rd_csr(p, DEBUG_REG_ADDR);
++ data |= CFG_BYPASS_UNISEC_TX | CFG_BYPASS_UNISEC_RX;
++ xgene_enet_wr_csr(p, DEBUG_REG_ADDR, data);
++
++ /* Adjust MDC clock frequency */
++ data = xgene_enet_rd_mac(p, MII_MGMT_CONFIG_ADDR);
++ MGMT_CLOCK_SEL_SET(&data, 7);
++ xgene_enet_wr_mac(p, MII_MGMT_CONFIG_ADDR, data);
++
++ /* Enable drop if bufpool not available */
++ data = xgene_enet_rd_csr(p, RSIF_CONFIG_REG_ADDR);
++ data |= CFG_RSIF_FPBUFF_TIMEOUT_EN;
++ xgene_enet_wr_csr(p, RSIF_CONFIG_REG_ADDR, data);
++
++ /* Rtype should be copied from FP */
++ xgene_enet_wr_csr(p, RSIF_RAM_DBG_REG0_ADDR, 0);
++
++ /* Bypass traffic gating */
++ xgene_enet_wr_csr(p, CFG_LINK_AGGR_RESUME_0_ADDR, TX_PORT0);
++ xgene_enet_wr_csr(p, CFG_BYPASS_ADDR, RESUME_TX);
++ xgene_enet_wr_csr(p, SG_RX_DV_GATE_REG_0_ADDR, RESUME_RX0);
++}
++
++static void xgene_sgmac_rxtx(struct xgene_enet_pdata *p, u32 bits, bool set)
++{
++ u32 data;
++
++ data = xgene_enet_rd_mac(p, MAC_CONFIG_1_ADDR);
++
++ if (set)
++ data |= bits;
++ else
++ data &= ~bits;
++
++ xgene_enet_wr_mac(p, MAC_CONFIG_1_ADDR, data);
++}
++
++static void xgene_sgmac_rx_enable(struct xgene_enet_pdata *p)
++{
++ xgene_sgmac_rxtx(p, RX_EN, true);
++}
++
++static void xgene_sgmac_tx_enable(struct xgene_enet_pdata *p)
++{
++ xgene_sgmac_rxtx(p, TX_EN, true);
++}
++
++static void xgene_sgmac_rx_disable(struct xgene_enet_pdata *p)
++{
++ xgene_sgmac_rxtx(p, RX_EN, false);
++}
++
++static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p)
++{
++ xgene_sgmac_rxtx(p, TX_EN, false);
++}
++
++static void xgene_enet_reset(struct xgene_enet_pdata *p)
++{
++ clk_prepare_enable(p->clk);
++ clk_disable_unprepare(p->clk);
++ clk_prepare_enable(p->clk);
++
++ xgene_enet_ecc_init(p);
++ xgene_enet_config_ring_if_assoc(p);
++}
++
++static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
++ u32 dst_ring_num, u16 bufpool_id)
++{
++ u32 data, fpsel;
++
++ data = CFG_CLE_BYPASS_EN0;
++ xgene_enet_wr_csr(p, CLE_BYPASS_REG0_0_ADDR, data);
++
++ fpsel = xgene_enet_ring_bufnum(bufpool_id) - 0x20;
++ data = CFG_CLE_DSTQID0(dst_ring_num) | CFG_CLE_FPSEL0(fpsel);
++ xgene_enet_wr_csr(p, CLE_BYPASS_REG1_0_ADDR, data);
++}
++
++static void xgene_enet_shutdown(struct xgene_enet_pdata *p)
++{
++ clk_disable_unprepare(p->clk);
++}
++
++static void xgene_enet_link_state(struct work_struct *work)
++{
++ struct xgene_enet_pdata *p = container_of(to_delayed_work(work),
++ struct xgene_enet_pdata, link_work);
++ struct net_device *ndev = p->ndev;
++ u32 link, poll_interval;
++
++ link = xgene_enet_link_status(p);
++ if (link) {
++ if (!netif_carrier_ok(ndev)) {
++ netif_carrier_on(ndev);
++ xgene_sgmac_init(p);
++ xgene_sgmac_rx_enable(p);
++ xgene_sgmac_tx_enable(p);
++ netdev_info(ndev, "Link is Up - 1Gbps\n");
++ }
++ poll_interval = PHY_POLL_LINK_ON;
++ } else {
++ if (netif_carrier_ok(ndev)) {
++ xgene_sgmac_rx_disable(p);
++ xgene_sgmac_tx_disable(p);
++ netif_carrier_off(ndev);
++ netdev_info(ndev, "Link is Down\n");
++ }
++ poll_interval = PHY_POLL_LINK_OFF;
++ }
++
++ schedule_delayed_work(&p->link_work, poll_interval);
++}
++
++struct xgene_mac_ops xgene_sgmac_ops = {
++ .init = xgene_sgmac_init,
++ .reset = xgene_sgmac_reset,
++ .rx_enable = xgene_sgmac_rx_enable,
++ .tx_enable = xgene_sgmac_tx_enable,
++ .rx_disable = xgene_sgmac_rx_disable,
++ .tx_disable = xgene_sgmac_tx_disable,
++ .set_mac_addr = xgene_sgmac_set_mac_addr,
++ .link_state = xgene_enet_link_state
++};
++
++struct xgene_port_ops xgene_sgport_ops = {
++ .reset = xgene_enet_reset,
++ .cle_bypass = xgene_enet_cle_bypass,
++ .shutdown = xgene_enet_shutdown
++};
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h
+new file mode 100644
+index 0000000..de43246
+--- /dev/null
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h
+@@ -0,0 +1,41 @@
++/* Applied Micro X-Gene SoC Ethernet Driver
++ *
++ * Copyright (c) 2014, Applied Micro Circuits Corporation
++ * Authors: Iyappan Subramanian <isubramanian at apm.com>
++ * Keyur Chudgar <kchudgar at apm.com>
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef __XGENE_ENET_SGMAC_H__
++#define __XGENE_ENET_SGMAC_H__
++
++#define PHY_ADDR(src) (((src)<<8) & GENMASK(12, 8))
++#define REG_ADDR(src) ((src) & GENMASK(4, 0))
++#define PHY_CONTROL(src) ((src) & GENMASK(15, 0))
++#define INT_PHY_ADDR 0x1e
++#define SGMII_TBI_CONTROL_ADDR 0x44
++#define SGMII_CONTROL_ADDR 0x00
++#define SGMII_STATUS_ADDR 0x04
++#define SGMII_BASE_PAGE_ABILITY_ADDR 0x14
++#define AUTO_NEG_COMPLETE BIT(5)
++#define LINK_STATUS BIT(2)
++#define LINK_UP BIT(15)
++#define MPA_IDLE_WITH_QMI_EMPTY BIT(12)
++#define SG_RX_DV_GATE_REG_0_ADDR 0x0dfc
++
++extern struct xgene_mac_ops xgene_sgmac_ops;
++extern struct xgene_port_ops xgene_sgport_ops;
++
++#endif /* __XGENE_ENET_SGMAC_H__ */
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+index dcb2087..5a5296a 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+@@ -47,9 +47,6 @@
+ #define XG_ENET_SPARE_CFG_REG_1_ADDR 0x0410
+ #define XGENET_RX_DV_GATE_REG_0_ADDR 0x0804
+
+-#define PHY_POLL_LINK_ON (10 * HZ)
+-#define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
+-
+ extern struct xgene_mac_ops xgene_xgmac_ops;
+ extern struct xgene_port_ops xgene_xgport_ops;
+
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch)
@@ -0,0 +1,175 @@
+From 092e35e5b10fdea2d814aa96ab2c2f2aad477640 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 3 Nov 2014 11:59:55 -0800
+Subject: [PATCH 08/11] drivers: net: xgene: Backward compatibility with older
+ firmware
+Origin: https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=c3f4465d272fa94d5a077c502e83d3e712ec8d62
+
+This patch adds support when used with older firmware (<= 1.13.28).
+
+- Added xgene_ring_mgr_init() to check whether ring manager is initialized
+- Calling xgene_ring_mgr_init() from xgene_port_ops.reset()
+- To handle errors, changed the return type of xgene_port_ops.reset()
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 18 +++++++++++++++++-
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 4 ++++
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 5 ++++-
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 7 ++++++-
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 7 ++++++-
+ 6 files changed, 38 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+index 63ea194..7ba83ff 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+@@ -575,10 +575,24 @@ static void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN);
+ }
+
+-static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
++bool xgene_ring_mgr_init(struct xgene_enet_pdata *p)
++{
++ if (!ioread32(p->ring_csr_addr + CLKEN_ADDR))
++ return false;
++
++ if (ioread32(p->ring_csr_addr + SRST_ADDR))
++ return false;
++
++ return true;
++}
++
++static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
+ {
+ u32 val;
+
++ if (!xgene_ring_mgr_init(pdata))
++ return -ENODEV;
++
+ clk_prepare_enable(pdata->clk);
+ clk_disable_unprepare(pdata->clk);
+ clk_prepare_enable(pdata->clk);
+@@ -590,6 +604,8 @@ static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
+ val |= SCAN_AUTO_INCR;
+ MGMT_CLOCK_SEL_SET(&val, 1);
+ xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val);
++
++ return 0;
+ }
+
+ static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+index 3855858..ec45f32 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+@@ -104,6 +104,9 @@ enum xgene_enet_rm {
+ #define BLOCK_ETH_MAC_OFFSET 0x0000
+ #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800
+
++#define CLKEN_ADDR 0xc208
++#define SRST_ADDR 0xc200
++
+ #define MAC_ADDR_REG_OFFSET 0x00
+ #define MAC_COMMAND_REG_OFFSET 0x04
+ #define MAC_WRITE_REG_OFFSET 0x08
+@@ -318,6 +321,7 @@ void xgene_enet_parse_error(struct xgene_enet_desc_ring *ring,
+
+ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata);
+ void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata);
++bool xgene_ring_mgr_init(struct xgene_enet_pdata *p);
+
+ extern struct xgene_mac_ops xgene_gmac_ops;
+ extern struct xgene_port_ops xgene_gport_ops;
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index 3c208cc..cc3f955 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -852,7 +852,9 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+ u16 dst_ring_num;
+ int ret;
+
+- pdata->port_ops->reset(pdata);
++ ret = pdata->port_ops->reset(pdata);
++ if (ret)
++ return ret;
+
+ ret = xgene_enet_create_desc_rings(ndev);
+ if (ret) {
+@@ -954,6 +956,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
+
+ return ret;
+ err:
++ unregister_netdev(ndev);
+ free_netdev(ndev);
+ return ret;
+ }
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index 874e5a0..dba647d 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -83,7 +83,7 @@ struct xgene_mac_ops {
+ };
+
+ struct xgene_port_ops {
+- void (*reset)(struct xgene_enet_pdata *pdata);
++ int (*reset)(struct xgene_enet_pdata *pdata);
+ void (*cle_bypass)(struct xgene_enet_pdata *pdata,
+ u32 dst_ring_num, u16 bufpool_id);
+ void (*shutdown)(struct xgene_enet_pdata *pdata);
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+index c22f326..f5d4f68 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+@@ -311,14 +311,19 @@ static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p)
+ xgene_sgmac_rxtx(p, TX_EN, false);
+ }
+
+-static void xgene_enet_reset(struct xgene_enet_pdata *p)
++static int xgene_enet_reset(struct xgene_enet_pdata *p)
+ {
++ if (!xgene_ring_mgr_init(p))
++ return -ENODEV;
++
+ clk_prepare_enable(p->clk);
+ clk_disable_unprepare(p->clk);
+ clk_prepare_enable(p->clk);
+
+ xgene_enet_ecc_init(p);
+ xgene_enet_config_ring_if_assoc(p);
++
++ return 0;
+ }
+
+ static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p,
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+index 67d0720..a18a9d1 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+@@ -252,14 +252,19 @@ static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN);
+ }
+
+-static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
++static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
+ {
++ if (!xgene_ring_mgr_init(pdata))
++ return -ENODEV;
++
+ clk_prepare_enable(pdata->clk);
+ clk_disable_unprepare(pdata->clk);
+ clk_prepare_enable(pdata->clk);
+
+ xgene_enet_ecc_init(pdata);
+ xgene_enet_config_ring_if_assoc(pdata);
++
++ return 0;
+ }
+
+ static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch)
@@ -0,0 +1,353 @@
+From 33f8dba6cb5493b2fff26c43a6cc0321e0814732 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Thu, 9 Oct 2014 18:32:05 -0700
+Subject: [PATCH 01/11] drivers: net: xgene: Preparing for adding 10GbE support
+Origin: https://git.kernel.org/linus/d0eb74582fa7b5c15710d293a3c4d8d3409ae165
+
+- Rearranged code to pave the way for adding 10GbE support
+- Added mac_ops structure containing function pointers for mac specific functions
+- Added port_ops structure containing function pointers for port specific functions
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 44 ++++++++++++++++--------
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 16 ++-------
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 40 +++++++++++++--------
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 19 ++++++++++
+ 4 files changed, 78 insertions(+), 41 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+index 812d8d6..c8f3824 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+@@ -402,7 +402,7 @@ static int xgene_mii_phy_read(struct xgene_enet_pdata *pdata,
+ return data;
+ }
+
+-void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata)
+ {
+ u32 addr0, addr1;
+ u8 *dev_addr = pdata->ndev->dev_addr;
+@@ -436,13 +436,13 @@ static int xgene_enet_ecc_init(struct xgene_enet_pdata *pdata)
+ return 0;
+ }
+
+-void xgene_gmac_reset(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_reset(struct xgene_enet_pdata *pdata)
+ {
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, SOFT_RESET1);
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, 0);
+ }
+
+-void xgene_gmac_init(struct xgene_enet_pdata *pdata, int speed)
++static void xgene_gmac_init(struct xgene_enet_pdata *pdata)
+ {
+ u32 value, mc2;
+ u32 intf_ctl, rgmii;
+@@ -456,7 +456,7 @@ void xgene_gmac_init(struct xgene_enet_pdata *pdata, int speed)
+ xgene_enet_rd_mcx_mac(pdata, INTERFACE_CONTROL_ADDR, &intf_ctl);
+ xgene_enet_rd_csr(pdata, RGMII_REG_0_ADDR, &rgmii);
+
+- switch (speed) {
++ switch (pdata->phy_speed) {
+ case SPEED_10:
+ ENET_INTERFACE_MODE2_SET(&mc2, 1);
+ CFG_MACMODE_SET(&icm0, 0);
+@@ -525,8 +525,8 @@ static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_ring_if(pdata, ENET_CFGSSQMIQMLITEFPQASSOC_ADDR, val);
+ }
+
+-void xgene_enet_cle_bypass(struct xgene_enet_pdata *pdata,
+- u32 dst_ring_num, u16 bufpool_id)
++static void xgene_enet_cle_bypass(struct xgene_enet_pdata *pdata,
++ u32 dst_ring_num, u16 bufpool_id)
+ {
+ u32 cb;
+ u32 fpsel;
+@@ -544,7 +544,7 @@ void xgene_enet_cle_bypass(struct xgene_enet_pdata *pdata,
+ xgene_enet_wr_csr(pdata, CLE_BYPASS_REG1_0_ADDR, cb);
+ }
+
+-void xgene_gmac_rx_enable(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_rx_enable(struct xgene_enet_pdata *pdata)
+ {
+ u32 data;
+
+@@ -552,7 +552,7 @@ void xgene_gmac_rx_enable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data | RX_EN);
+ }
+
+-void xgene_gmac_tx_enable(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_tx_enable(struct xgene_enet_pdata *pdata)
+ {
+ u32 data;
+
+@@ -560,7 +560,7 @@ void xgene_gmac_tx_enable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data | TX_EN);
+ }
+
+-void xgene_gmac_rx_disable(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_rx_disable(struct xgene_enet_pdata *pdata)
+ {
+ u32 data;
+
+@@ -568,7 +568,7 @@ void xgene_gmac_rx_disable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~RX_EN);
+ }
+
+-void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata)
++static void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata)
+ {
+ u32 data;
+
+@@ -576,7 +576,7 @@ void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN);
+ }
+
+-void xgene_enet_reset(struct xgene_enet_pdata *pdata)
++static void xgene_enet_reset(struct xgene_enet_pdata *pdata)
+ {
+ u32 val;
+
+@@ -593,7 +593,7 @@ void xgene_enet_reset(struct xgene_enet_pdata *pdata)
+ xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val);
+ }
+
+-void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
++static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
+ {
+ clk_disable_unprepare(pdata->clk);
+ }
+@@ -627,10 +627,10 @@ static void xgene_enet_adjust_link(struct net_device *ndev)
+
+ if (phydev->link) {
+ if (pdata->phy_speed != phydev->speed) {
+- xgene_gmac_init(pdata, phydev->speed);
++ pdata->phy_speed = phydev->speed;
++ xgene_gmac_init(pdata);
+ xgene_gmac_rx_enable(pdata);
+ xgene_gmac_tx_enable(pdata);
+- pdata->phy_speed = phydev->speed;
+ phy_print_status(phydev);
+ }
+ } else {
+@@ -726,3 +726,19 @@ void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata)
+ mdiobus_free(pdata->mdio_bus);
+ pdata->mdio_bus = NULL;
+ }
++
++struct xgene_mac_ops xgene_gmac_ops = {
++ .init = xgene_gmac_init,
++ .reset = xgene_gmac_reset,
++ .rx_enable = xgene_gmac_rx_enable,
++ .tx_enable = xgene_gmac_tx_enable,
++ .rx_disable = xgene_gmac_rx_disable,
++ .tx_disable = xgene_gmac_tx_disable,
++ .set_mac_addr = xgene_gmac_set_mac_addr,
++};
++
++struct xgene_port_ops xgene_gport_ops = {
++ .reset = xgene_enet_reset,
++ .cle_bypass = xgene_enet_cle_bypass,
++ .shutdown = xgene_gport_shutdown,
++};
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+index 371e7a5..084ac68 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+@@ -318,20 +318,10 @@ void xgene_enet_parse_error(struct xgene_enet_desc_ring *ring,
+ struct xgene_enet_pdata *pdata,
+ enum xgene_enet_err_code status);
+
+-void xgene_enet_reset(struct xgene_enet_pdata *priv);
+-void xgene_gmac_reset(struct xgene_enet_pdata *priv);
+-void xgene_gmac_init(struct xgene_enet_pdata *priv, int speed);
+-void xgene_gmac_tx_enable(struct xgene_enet_pdata *priv);
+-void xgene_gmac_rx_enable(struct xgene_enet_pdata *priv);
+-void xgene_gmac_tx_disable(struct xgene_enet_pdata *priv);
+-void xgene_gmac_rx_disable(struct xgene_enet_pdata *priv);
+-void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata);
+-void xgene_enet_cle_bypass(struct xgene_enet_pdata *pdata,
+- u32 dst_ring_num, u16 bufpool_id);
+-void xgene_gport_shutdown(struct xgene_enet_pdata *priv);
+-void xgene_gmac_get_tx_stats(struct xgene_enet_pdata *pdata);
+-
+ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata);
+ void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata);
+
++extern struct xgene_mac_ops xgene_gmac_ops;
++extern struct xgene_port_ops xgene_gport_ops;
++
+ #endif /* __XGENE_ENET_HW_H__ */
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index e4222af..c432644 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -413,7 +413,7 @@ static void xgene_enet_timeout(struct net_device *ndev)
+ {
+ struct xgene_enet_pdata *pdata = netdev_priv(ndev);
+
+- xgene_gmac_reset(pdata);
++ pdata->mac_ops->reset(pdata);
+ }
+
+ static int xgene_enet_register_irq(struct net_device *ndev)
+@@ -445,10 +445,11 @@ static void xgene_enet_free_irq(struct net_device *ndev)
+ static int xgene_enet_open(struct net_device *ndev)
+ {
+ struct xgene_enet_pdata *pdata = netdev_priv(ndev);
++ struct xgene_mac_ops *mac_ops = pdata->mac_ops;
+ int ret;
+
+- xgene_gmac_tx_enable(pdata);
+- xgene_gmac_rx_enable(pdata);
++ mac_ops->tx_enable(pdata);
++ mac_ops->rx_enable(pdata);
+
+ ret = xgene_enet_register_irq(ndev);
+ if (ret)
+@@ -466,6 +467,7 @@ static int xgene_enet_open(struct net_device *ndev)
+ static int xgene_enet_close(struct net_device *ndev)
+ {
+ struct xgene_enet_pdata *pdata = netdev_priv(ndev);
++ struct xgene_mac_ops *mac_ops = pdata->mac_ops;
+
+ netif_stop_queue(ndev);
+
+@@ -476,8 +478,8 @@ static int xgene_enet_close(struct net_device *ndev)
+ xgene_enet_free_irq(ndev);
+ xgene_enet_process_ring(pdata->rx_ring, -1);
+
+- xgene_gmac_tx_disable(pdata);
+- xgene_gmac_rx_disable(pdata);
++ mac_ops->tx_disable(pdata);
++ mac_ops->rx_disable(pdata);
+
+ return 0;
+ }
+@@ -724,7 +726,7 @@ static int xgene_enet_set_mac_address(struct net_device *ndev, void *addr)
+ ret = eth_mac_addr(ndev, addr);
+ if (ret)
+ return ret;
+- xgene_gmac_set_mac_addr(pdata);
++ pdata->mac_ops->set_mac_addr(pdata);
+
+ return ret;
+ }
+@@ -834,8 +836,8 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+ u16 dst_ring_num;
+ int ret;
+
+- xgene_gmac_tx_disable(pdata);
+- xgene_gmac_rx_disable(pdata);
++ pdata->mac_ops->tx_disable(pdata);
++ pdata->mac_ops->rx_disable(pdata);
+
+ ret = xgene_enet_create_desc_rings(ndev);
+ if (ret) {
+@@ -853,11 +855,17 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata)
+ }
+
+ dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring);
+- xgene_enet_cle_bypass(pdata, dst_ring_num, buf_pool->id);
++ pdata->port_ops->cle_bypass(pdata, dst_ring_num, buf_pool->id);
+
+ return ret;
+ }
+
++static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
++{
++ pdata->mac_ops = &xgene_gmac_ops;
++ pdata->port_ops = &xgene_gport_ops;
++}
++
+ static int xgene_enet_probe(struct platform_device *pdev)
+ {
+ struct net_device *ndev;
+@@ -886,8 +894,9 @@ static int xgene_enet_probe(struct platform_device *pdev)
+ if (ret)
+ goto err;
+
+- xgene_enet_reset(pdata);
+- xgene_gmac_init(pdata, SPEED_1000);
++ xgene_enet_setup_ops(pdata);
++ pdata->port_ops->reset(pdata);
++ pdata->mac_ops->init(pdata);
+
+ ret = register_netdev(ndev);
+ if (ret) {
+@@ -918,19 +927,21 @@ err:
+ static int xgene_enet_remove(struct platform_device *pdev)
+ {
+ struct xgene_enet_pdata *pdata;
++ struct xgene_mac_ops *mac_ops;
+ struct net_device *ndev;
+
+ pdata = platform_get_drvdata(pdev);
++ mac_ops = pdata->mac_ops;
+ ndev = pdata->ndev;
+
+- xgene_gmac_rx_disable(pdata);
+- xgene_gmac_tx_disable(pdata);
++ mac_ops->rx_disable(pdata);
++ mac_ops->tx_disable(pdata);
+
+ netif_napi_del(&pdata->rx_ring->napi);
+ xgene_enet_mdio_remove(pdata);
+ xgene_enet_delete_desc_rings(pdata);
+ unregister_netdev(ndev);
+- xgene_gport_shutdown(pdata);
++ pdata->port_ops->shutdown(pdata);
+ free_netdev(ndev);
+
+ return 0;
+@@ -956,5 +967,6 @@ module_platform_driver(xgene_enet_driver);
+
+ MODULE_DESCRIPTION("APM X-Gene SoC Ethernet driver");
+ MODULE_VERSION(XGENE_DRV_VERSION);
++MODULE_AUTHOR("Iyappan Subramanian <isubramanian at apm.com>");
+ MODULE_AUTHOR("Keyur Chudgar <kchudgar at apm.com>");
+ MODULE_LICENSE("GPL");
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index 0815866..ac180f9 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -68,6 +68,23 @@ struct xgene_enet_desc_ring {
+ };
+ };
+
++struct xgene_mac_ops {
++ void (*init)(struct xgene_enet_pdata *pdata);
++ void (*reset)(struct xgene_enet_pdata *pdata);
++ void (*tx_enable)(struct xgene_enet_pdata *pdata);
++ void (*rx_enable)(struct xgene_enet_pdata *pdata);
++ void (*tx_disable)(struct xgene_enet_pdata *pdata);
++ void (*rx_disable)(struct xgene_enet_pdata *pdata);
++ void (*set_mac_addr)(struct xgene_enet_pdata *pdata);
++};
++
++struct xgene_port_ops {
++ void (*reset)(struct xgene_enet_pdata *pdata);
++ void (*cle_bypass)(struct xgene_enet_pdata *pdata,
++ u32 dst_ring_num, u16 bufpool_id);
++ void (*shutdown)(struct xgene_enet_pdata *pdata);
++};
++
+ /* ethernet private data */
+ struct xgene_enet_pdata {
+ struct net_device *ndev;
+@@ -98,6 +115,8 @@ struct xgene_enet_pdata {
+ u32 speed;
+ u16 rm;
+ struct rtnl_link_stats64 stats;
++ struct xgene_mac_ops *mac_ops;
++ struct xgene_port_ops *port_ops;
+ };
+
+ /* Set the specified value into a bit-field defined by its starting position
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch)
@@ -0,0 +1,153 @@
+From 0d0393191a19911ef523a4cba10bedb10bbf07dd Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 13 Oct 2014 17:05:33 -0700
+Subject: [PATCH 04/11] drivers: net: xgene: Preparing for adding SGMII based
+ 1GbE
+Origin: https://git.kernel.org/linus/dc8385f0c0f46ca18c1c8ab59c9f565dc7cfa6bf
+
+- Added link_state function pointer to the xgene__mac_ops structure
+- Moved ring manager (pdata->rm) assignment to xgene_enet_setup_ops
+- Removed unused variable (pdata->phy_addr) and macro (FULL_DUPLEX)
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 1 -
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | 1 -
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 8 +++++---
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 3 ++-
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h | 1 -
+ 6 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+index c8f3824..63ea194 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+@@ -410,7 +410,6 @@ static void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata)
+ addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+ (dev_addr[1] << 8) | dev_addr[0];
+ addr1 = (dev_addr[5] << 24) | (dev_addr[4] << 16);
+- addr1 |= pdata->phy_addr & 0xFFFF;
+
+ xgene_enet_wr_mcx_mac(pdata, STATION_ADDR0_ADDR, addr0);
+ xgene_enet_wr_mcx_mac(pdata, STATION_ADDR1_ADDR, addr1);
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+index 15ec426..2efc4d9 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
+@@ -179,7 +179,6 @@ enum xgene_enet_rm {
+ #define TUND_ADDR 0x4a
+
+ #define TSO_IPPROTO_TCP 1
+-#define FULL_DUPLEX 2
+
+ #define USERINFO_POS 0
+ #define USERINFO_LEN 32
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index 9b85239..9e251ec 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -833,11 +833,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
+ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
+ pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET;
+ pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET;
+- pdata->rm = RM3;
+ } else {
+ pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET;
+ pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET;
+- pdata->rm = RM0;
+ }
+ pdata->rx_buff_cnt = NUM_PKT_BUF;
+
+@@ -881,10 +879,12 @@ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata)
+ case PHY_INTERFACE_MODE_RGMII:
+ pdata->mac_ops = &xgene_gmac_ops;
+ pdata->port_ops = &xgene_gport_ops;
++ pdata->rm = RM3;
+ break;
+ default:
+ pdata->mac_ops = &xgene_xgmac_ops;
+ pdata->port_ops = &xgene_xgport_ops;
++ pdata->rm = RM0;
+ break;
+ }
+ }
+@@ -895,6 +895,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
+ struct xgene_enet_pdata *pdata;
+ struct device *dev = &pdev->dev;
+ struct napi_struct *napi;
++ struct xgene_mac_ops *mac_ops;
+ int ret;
+
+ ndev = alloc_etherdev(sizeof(struct xgene_enet_pdata));
+@@ -937,10 +938,11 @@ static int xgene_enet_probe(struct platform_device *pdev)
+
+ napi = &pdata->rx_ring->napi;
+ netif_napi_add(ndev, napi, xgene_enet_napi, NAPI_POLL_WEIGHT);
++ mac_ops = pdata->mac_ops;
+ if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII)
+ ret = xgene_enet_mdio_config(pdata);
+ else
+- INIT_DELAYED_WORK(&pdata->link_work, xgene_enet_link_state);
++ INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state);
+
+ return ret;
+ err:
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index 86cf68b..10b03a1 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -76,6 +76,7 @@ struct xgene_mac_ops {
+ void (*tx_disable)(struct xgene_enet_pdata *pdata);
+ void (*rx_disable)(struct xgene_enet_pdata *pdata);
+ void (*set_mac_addr)(struct xgene_enet_pdata *pdata);
++ void (*link_state)(struct work_struct *work);
+ };
+
+ struct xgene_port_ops {
+@@ -109,7 +110,6 @@ struct xgene_enet_pdata {
+ void __iomem *base_addr;
+ void __iomem *ring_csr_addr;
+ void __iomem *ring_cmd_addr;
+- u32 phy_addr;
+ int phy_mode;
+ enum xgene_enet_rm rm;
+ struct rtnl_link_stats64 stats;
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+index cd64b9f..67d0720 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+@@ -284,7 +284,7 @@ static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
+ clk_disable_unprepare(pdata->clk);
+ }
+
+-void xgene_enet_link_state(struct work_struct *work)
++static void xgene_enet_link_state(struct work_struct *work)
+ {
+ struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work),
+ struct xgene_enet_pdata, link_work);
+@@ -322,6 +322,7 @@ struct xgene_mac_ops xgene_xgmac_ops = {
+ .rx_disable = xgene_xgmac_rx_disable,
+ .tx_disable = xgene_xgmac_tx_disable,
+ .set_mac_addr = xgene_xgmac_set_mac_addr,
++ .link_state = xgene_enet_link_state
+ };
+
+ struct xgene_port_ops xgene_xgport_ops = {
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+index d2d59e7..dcb2087 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
+@@ -50,7 +50,6 @@
+ #define PHY_POLL_LINK_ON (10 * HZ)
+ #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
+
+-void xgene_enet_link_state(struct work_struct *work);
+ extern struct xgene_mac_ops xgene_xgmac_ops;
+ extern struct xgene_port_ops xgene_xgport_ops;
+
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch)
@@ -0,0 +1,54 @@
+From 9f2bc2c30d24987cff5edc43a3d8f89bef6ce12a Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert at linux-m68k.org>
+Date: Thu, 23 Oct 2014 10:25:53 +0200
+Subject: [PATCH 07/11] drivers: net: xgene: Rewrite buggy loop in
+ xgene_enet_ecc_init()
+Origin: https://git.kernel.org/linus/b71e821de50f0ff92f10f33064ee1713e9014158
+
+drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c: In function ‘xgene_enet_ecc_init’:
+drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c:126: warning: ‘data’ may be used uninitialized in this function
+
+Depending on the arbitrary value on the stack, the loop may terminate
+too early, and cause a bogus -ENODEV failure.
+
+Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+index e6d24c2..c22f326 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+@@ -124,20 +124,18 @@ static int xgene_enet_ecc_init(struct xgene_enet_pdata *p)
+ {
+ struct net_device *ndev = p->ndev;
+ u32 data;
+- int i;
++ int i = 0;
+
+ xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0);
+- for (i = 0; i < 10 && data != ~0U ; i++) {
++ do {
+ usleep_range(100, 110);
+ data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR);
+- }
++ if (data == ~0U)
++ return 0;
++ } while (++i < 10);
+
+- if (data != ~0U) {
+- netdev_err(ndev, "Failed to release memory from shutdown\n");
+- return -ENODEV;
+- }
+-
+- return 0;
++ netdev_err(ndev, "Failed to release memory from shutdown\n");
++ return -ENODEV;
+ }
+
+ static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p)
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch)
@@ -0,0 +1,78 @@
+From 33b54088743086cd6fdce269486e0bf27ed24155 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 3 Nov 2014 11:59:56 -0800
+Subject: [PATCH 09/11] drivers: net: xgene: fix: Use separate resources
+Origin: https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=bdd330f0506b2c4d02d5453fa32e785f0c348388
+
+This patch fixes the following kernel crash during SGMII based 1GbE probe.
+
+ BUG: Bad page state in process swapper/0 pfn:40fe6ad
+ page:ffffffbee37a75d8 count:-1 mapcount:0 mapping: (null) index:0x0
+ flags: 0x0()
+ page dumped because: nonzero _count
+ Modules linked in:
+ CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.17.0+ #7
+ Call trace:
+ [<ffffffc000087fa0>] dump_backtrace+0x0/0x12c
+ [<ffffffc0000880dc>] show_stack+0x10/0x1c
+ [<ffffffc0004d981c>] dump_stack+0x74/0xc4
+ [<ffffffc00012fe70>] bad_page+0xd8/0x128
+ [<ffffffc000133000>] get_page_from_freelist+0x4b8/0x640
+ [<ffffffc000133260>] __alloc_pages_nodemask+0xd8/0x834
+ [<ffffffc0004194f8>] __netdev_alloc_frag+0x124/0x1b8
+ [<ffffffc00041bfdc>] __netdev_alloc_skb+0x90/0x10c
+ [<ffffffc00039ff30>] xgene_enet_refill_bufpool+0x11c/0x280
+ [<ffffffc0003a11a4>] xgene_enet_process_ring+0x168/0x340
+ [<ffffffc0003a1498>] xgene_enet_napi+0x1c/0x50
+ [<ffffffc00042b454>] net_rx_action+0xc8/0x18c
+ [<ffffffc0000b0880>] __do_softirq+0x114/0x24c
+ [<ffffffc0000b0c34>] irq_exit+0x94/0xc8
+ [<ffffffc0000e68a0>] __handle_domain_irq+0x8c/0xf4
+ [<ffffffc000081288>] gic_handle_irq+0x30/0x7c
+
+This was due to hardware resource sharing conflict with the firmware. This
+patch fixes this crash by using resources (descriptor ring, prefetch buffer)
+that are not shared.
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +++---
+ drivers/net/ethernet/apm/xgene/xgene_enet_main.h | 3 +++
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+index cc3f955..1236696 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+@@ -639,9 +639,9 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev)
+ struct device *dev = ndev_to_dev(ndev);
+ struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring;
+ struct xgene_enet_desc_ring *buf_pool = NULL;
+- u8 cpu_bufnum = 0, eth_bufnum = 0;
+- u8 bp_bufnum = 0x20;
+- u16 ring_id, ring_num = 0;
++ u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM;
++ u8 bp_bufnum = START_BP_BUFNUM;
++ u16 ring_id, ring_num = START_RING_NUM;
+ int ret;
+
+ /* allocate rx descriptor ring */
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+index dba647d..f9958fa 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h
+@@ -38,6 +38,9 @@
+ #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN)
+ #define NUM_PKT_BUF 64
+ #define NUM_BUFPOOL 32
++#define START_ETH_BUFNUM 2
++#define START_BP_BUFNUM 0x22
++#define START_RING_NUM 8
+
+ #define PHY_POLL_LINK_ON (10 * HZ)
+ #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5)
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch)
@@ -0,0 +1,84 @@
+From fe64571ba6b03ee505c4b384da1b335729b36db3 Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Thu, 9 Oct 2014 18:32:04 -0700
+Subject: [PATCH 10/11] dtb: Add 10GbE node to APM X-Gene SoC device tree
+Origin: https://git.kernel.org/linus/5fb32417b7e52d2e6d5f5c64d277a03e5c998a02
+
+Added 10GbE interface and clock nodes.
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ arch/arm64/boot/dts/apm-mustang.dts | 4 ++++
+ arch/arm64/boot/dts/apm-storm.dtsi | 29 ++++++++++++++++++++++++++++-
+ 2 files changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
+index b2f5622..2ae782b 100644
+--- a/arch/arm64/boot/dts/apm-mustang.dts
++++ b/arch/arm64/boot/dts/apm-mustang.dts
+@@ -32,3 +32,7 @@
+ &menet {
+ status = "ok";
+ };
++
++&xgenet {
++ status = "ok";
++};
+diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
+index c0aceef..4d762a3 100644
+--- a/arch/arm64/boot/dts/apm-storm.dtsi
++++ b/arch/arm64/boot/dts/apm-storm.dtsi
+@@ -176,6 +176,16 @@
+ clock-output-names = "menetclk";
+ };
+
++ xge0clk: xge0clk at 1f61c000 {
++ compatible = "apm,xgene-device-clock";
++ #clock-cells = <1>;
++ clocks = <&socplldiv2 0>;
++ reg = <0x0 0x1f61c000 0x0 0x1000>;
++ reg-names = "csr-reg";
++ csr-mask = <0x3>;
++ clock-output-names = "xge0clk";
++ };
++
+ sataphy1clk: sataphy1clk at 1f21c000 {
+ compatible = "apm,xgene-device-clock";
+ #clock-cells = <1>;
+@@ -407,7 +417,8 @@
+ interrupts = <0x0 0x3c 0x4>;
+ dma-coherent;
+ clocks = <&menetclk 0>;
+- local-mac-address = [00 01 73 00 00 01];
++ /* mac address will be overwritten by the bootloader */
++ local-mac-address = [00 00 00 00 00 00];
+ phy-connection-type = "rgmii";
+ phy-handle = <&menetphy>;
+ mdio {
+@@ -421,5 +432,21 @@
+
+ };
+ };
++
++ xgenet: ethernet at 1f610000 {
++ compatible = "apm,xgene-enet";
++ status = "disabled";
++ reg = <0x0 0x1f610000 0x0 0xd100>,
++ <0x0 0x1f600000 0x0 0X400>,
++ <0x0 0x18000000 0x0 0X200>;
++ reg-names = "enet_csr", "ring_csr", "ring_cmd";
++ interrupts = <0x0 0x60 0x4>;
++ dma-coherent;
++ clocks = <&xge0clk 0>;
++ /* mac address will be overwritten by the bootloader */
++ local-mac-address = [00 00 00 00 00 00];
++ phy-connection-type = "xgmii";
++ };
++
+ };
+ };
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch)
@@ -0,0 +1,75 @@
+From 8e17e86dde4b417cdbe8ee9073b8ffc10a1f5afb Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 13 Oct 2014 17:05:32 -0700
+Subject: [PATCH 11/11] dtb: Add SGMII based 1GbE node to APM X-Gene SoC device
+ tree
+Origin: https://git.kernel.org/linus/4c2e7f0954dcd9fbb47d065c654d44608dad38e0
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ arch/arm64/boot/dts/apm-mustang.dts | 4 ++++
+ arch/arm64/boot/dts/apm-storm.dtsi | 24 ++++++++++++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
+index 2ae782b..71a1489 100644
+--- a/arch/arm64/boot/dts/apm-mustang.dts
++++ b/arch/arm64/boot/dts/apm-mustang.dts
+@@ -33,6 +33,10 @@
+ status = "ok";
+ };
+
++&sgenet0 {
++ status = "ok";
++};
++
+ &xgenet {
+ status = "ok";
+ };
+diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
+index d16cc03..f45bbfe 100644
+--- a/arch/arm64/boot/dts/apm-storm.dtsi
++++ b/arch/arm64/boot/dts/apm-storm.dtsi
+@@ -176,6 +176,16 @@
+ clock-output-names = "menetclk";
+ };
+
++ sge0clk: sge0clk at 1f21c000 {
++ compatible = "apm,xgene-device-clock";
++ #clock-cells = <1>;
++ clocks = <&socplldiv2 0>;
++ reg = <0x0 0x1f21c000 0x0 0x1000>;
++ reg-names = "csr-reg";
++ csr-mask = <0x3>;
++ clock-output-names = "sge0clk";
++ };
++
+ xge0clk: xge0clk at 1f61c000 {
+ compatible = "apm,xgene-device-clock";
+ #clock-cells = <1>;
+@@ -446,6 +456,20 @@
+ };
+ };
+
++ sgenet0: ethernet at 1f210000 {
++ compatible = "apm,xgene-enet";
++ status = "disabled";
++ reg = <0x0 0x1f210000 0x0 0x10000>,
++ <0x0 0x1f200000 0x0 0X10000>,
++ <0x0 0x1B000000 0x0 0X20000>;
++ reg-names = "enet_csr", "ring_csr", "ring_cmd";
++ interrupts = <0x0 0xA0 0x4>;
++ dma-coherent;
++ clocks = <&sge0clk 0>;
++ local-mac-address = [00 00 00 00 00 00];
++ phy-connection-type = "sgmii";
++ };
++
+ xgenet: ethernet at 1f610000 {
+ compatible = "apm,xgene-enet";
+ status = "disabled";
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch (from r22142, dists/sid/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch)
@@ -0,0 +1,86 @@
+From 09c9e0593d7215c809a4a47659b0e760112d656e Mon Sep 17 00:00:00 2001
+From: Iyappan Subramanian <isubramanian at apm.com>
+Date: Mon, 3 Nov 2014 11:59:54 -0800
+Subject: [PATCH] dtb: xgene: fix: Backward compatibility with older firmware
+Origin: https://git.kernel.org/linus/09c9e0593d7215c809a4a47659b0e760112d656e
+
+The following kernel crash was reported when using older firmware (<= 1.13.28).
+
+[ 0.980000] libphy: APM X-Gene MDIO bus: probed
+[ 1.130000] Unhandled fault: synchronous external abort (0x96000010) at 0xffffff800009a17c
+[ 1.140000] Internal error: : 96000010 [#1] SMP
+[ 1.140000] Modules linked in:
+[ 1.140000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0+ #21
+[ 1.140000] task: ffffffc3f0110000 ti: ffffffc3f0064000 task.ti: ffffffc3f0064000
+[ 1.140000] PC is at ioread32+0x58/0x68
+[ 1.140000] LR is at xgene_enet_setup_ring+0x18c/0x1cc
+[ 1.140000] pc : [<ffffffc0003cec68>] lr : [<ffffffc00053dad8>] pstate: a0000045
+[ 1.140000] sp : ffffffc3f0067b20
+[ 1.140000] x29: ffffffc3f0067b20 x28: ffffffc000aa8ea0
+[ 1.140000] x27: ffffffc000bb2000 x26: ffffffc000a64270
+[ 1.140000] x25: ffffffc000b05ad8 x24: ffffffc0ff99ba58
+[ 1.140000] x23: 0000000000004000 x22: 0000000000004000
+[ 1.140000] x21: 0000000000000200 x20: 0000000000200000
+[ 1.140000] x19: ffffffc0ff99ba18 x18: ffffffc0007a6000
+[ 1.140000] x17: 0000000000000007 x16: 000000000000000e
+[ 1.140000] x15: 0000000000000001 x14: 0000000000000000
+[ 1.140000] x13: ffffffbeedb71320 x12: 00000000ffffff80
+[ 1.140000] x11: 0000000000000002 x10: 0000000000000000
+[ 1.140000] x9 : 0000000000000000 x8 : ffffffc3eb2a4000
+[ 1.140000] x7 : 0000000000000000 x6 : 0000000000000000
+[ 1.140000] x5 : 0000000001080000 x4 : 000000007d654010
+[ 1.140000] x3 : ffffffffffffffff x2 : 000000000003ffff
+[ 1.140000] x1 : ffffff800009a17c x0 : ffffff800009a17c
+
+The issue was that the older firmware does not support 10GbE and
+SGMII based 1GBE interfaces.
+
+This patch changes the address length of the reg property of sgmii0 and xgmii
+nodes and serves as preparatory patch for the fix.
+
+Signed-off-by: Iyappan Subramanian <isubramanian at apm.com>
+Signed-off-by: Keyur Chudgar <kchudgar at apm.com>
+Reported-by: Dann Frazier <dann.frazier at canonical.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ arch/arm64/boot/dts/apm-storm.dtsi | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
+index 295c72d..f1ad9c2 100644
+--- a/arch/arm64/boot/dts/apm-storm.dtsi
++++ b/arch/arm64/boot/dts/apm-storm.dtsi
+@@ -599,7 +599,7 @@
+ compatible = "apm,xgene-enet";
+ status = "disabled";
+ reg = <0x0 0x17020000 0x0 0xd100>,
+- <0x0 0X17030000 0x0 0X400>,
++ <0x0 0X17030000 0x0 0Xc300>,
+ <0x0 0X10000000 0x0 0X200>;
+ reg-names = "enet_csr", "ring_csr", "ring_cmd";
+ interrupts = <0x0 0x3c 0x4>;
+@@ -624,9 +624,9 @@
+ sgenet0: ethernet at 1f210000 {
+ compatible = "apm,xgene-enet";
+ status = "disabled";
+- reg = <0x0 0x1f210000 0x0 0x10000>,
+- <0x0 0x1f200000 0x0 0X10000>,
+- <0x0 0x1B000000 0x0 0X20000>;
++ reg = <0x0 0x1f210000 0x0 0xd100>,
++ <0x0 0x1f200000 0x0 0Xc300>,
++ <0x0 0x1B000000 0x0 0X200>;
+ reg-names = "enet_csr", "ring_csr", "ring_cmd";
+ interrupts = <0x0 0xA0 0x4>;
+ dma-coherent;
+@@ -639,7 +639,7 @@
+ compatible = "apm,xgene-enet";
+ status = "disabled";
+ reg = <0x0 0x1f610000 0x0 0xd100>,
+- <0x0 0x1f600000 0x0 0X400>,
++ <0x0 0x1f600000 0x0 0Xc300>,
+ <0x0 0x18000000 0x0 0X200>;
+ reg-names = "enet_csr", "ring_csr", "ring_cmd";
+ interrupts = <0x0 0x60 0x4>;
+--
+2.1.0
+
Copied: dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch (from r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch)
@@ -0,0 +1,164 @@
+From: Andreas Noever <andreas.noever at gmail.com>
+Date: Tue, 3 Jun 2014 22:04:09 +0200
+Subject: [1/2] PCI: Add pci_fixup_suspend_late quirk pass
+Origin: https://git.kernel.org/linus/7d2a01b87f1682fde87461864e6682031bfaa0a9
+
+Add pci_fixup_suspend_late as a new pci_fixup_pass. The pass is called
+from suspend_noirq and poweroff_noirq. Using the same pass for suspend
+and hibernate is consistent with resume_early which is called by
+resume_noirq and restore_noirq.
+
+The new quirk pass is required for Thunderbolt support on Apple
+hardware.
+
+Signed-off-by: Andreas Noever <andreas.noever at gmail.com>
+Acked-by: Bjorn Helgaas <bhelgaas at google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ drivers/pci/pci-driver.c | 18 ++++++++++++++----
+ drivers/pci/quirks.c | 7 +++++++
+ include/asm-generic/vmlinux.lds.h | 3 +++
+ include/linux/pci.h | 12 +++++++++++-
+ 4 files changed, 35 insertions(+), 5 deletions(-)
+
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -582,7 +582,7 @@ static int pci_legacy_suspend_late(struc
+ WARN_ONCE(pci_dev->current_state != prev,
+ "PCI PM: Device state not saved by %pF\n",
+ drv->suspend_late);
+- return 0;
++ goto Fixup;
+ }
+ }
+
+@@ -591,6 +591,9 @@ static int pci_legacy_suspend_late(struc
+
+ pci_pm_set_unknown_state(pci_dev);
+
++Fixup:
++ pci_fixup_device(pci_fixup_suspend_late, pci_dev);
++
+ return 0;
+ }
+
+@@ -734,7 +737,7 @@ static int pci_pm_suspend_noirq(struct d
+
+ if (!pm) {
+ pci_save_state(pci_dev);
+- return 0;
++ goto Fixup;
+ }
+
+ if (pm->suspend_noirq) {
+@@ -751,7 +754,7 @@ static int pci_pm_suspend_noirq(struct d
+ WARN_ONCE(pci_dev->current_state != prev,
+ "PCI PM: State of device not saved by %pF\n",
+ pm->suspend_noirq);
+- return 0;
++ goto Fixup;
+ }
+ }
+
+@@ -775,6 +778,9 @@ static int pci_pm_suspend_noirq(struct d
+ if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI)
+ pci_write_config_word(pci_dev, PCI_COMMAND, 0);
+
++Fixup:
++ pci_fixup_device(pci_fixup_suspend_late, pci_dev);
++
+ return 0;
+ }
+
+@@ -999,8 +1005,10 @@ static int pci_pm_poweroff_noirq(struct
+ if (pci_has_legacy_pm_support(to_pci_dev(dev)))
+ return pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
+
+- if (!drv || !drv->pm)
++ if (!drv || !drv->pm) {
++ pci_fixup_device(pci_fixup_suspend_late, pci_dev);
+ return 0;
++ }
+
+ if (drv->pm->poweroff_noirq) {
+ int error;
+@@ -1021,6 +1029,8 @@ static int pci_pm_poweroff_noirq(struct
+ if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI)
+ pci_write_config_word(pci_dev, PCI_COMMAND, 0);
+
++ pci_fixup_device(pci_fixup_suspend_late, pci_dev);
++
+ if (pcibios_pm_ops.poweroff_noirq)
+ return pcibios_pm_ops.poweroff_noirq(dev);
+
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -3038,6 +3038,8 @@ extern struct pci_fixup __start_pci_fixu
+ extern struct pci_fixup __end_pci_fixups_resume_early[];
+ extern struct pci_fixup __start_pci_fixups_suspend[];
+ extern struct pci_fixup __end_pci_fixups_suspend[];
++extern struct pci_fixup __start_pci_fixups_suspend_late[];
++extern struct pci_fixup __end_pci_fixups_suspend_late[];
+
+ static bool pci_apply_fixup_final_quirks;
+
+@@ -3083,6 +3085,11 @@ void pci_fixup_device(enum pci_fixup_pas
+ end = __end_pci_fixups_suspend;
+ break;
+
++ case pci_fixup_suspend_late:
++ start = __start_pci_fixups_suspend_late;
++ end = __end_pci_fixups_suspend_late;
++ break;
++
+ default:
+ /* stupid compiler warning, you would think with an enum... */
+ return;
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -268,6 +268,9 @@
+ VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
+ *(.pci_fixup_suspend) \
+ VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
++ VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
++ *(.pci_fixup_suspend_late) \
++ VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
+ } \
+ \
+ /* Built-in firmware blobs */ \
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -1483,8 +1483,9 @@ enum pci_fixup_pass {
+ pci_fixup_final, /* Final phase of device fixups */
+ pci_fixup_enable, /* pci_enable_device() time */
+ pci_fixup_resume, /* pci_device_resume() */
+- pci_fixup_suspend, /* pci_device_suspend */
++ pci_fixup_suspend, /* pci_device_suspend() */
+ pci_fixup_resume_early, /* pci_device_resume_early() */
++ pci_fixup_suspend_late, /* pci_device_suspend_late() */
+ };
+
+ /* Anonymous variables would be nice... */
+@@ -1525,6 +1526,11 @@ enum pci_fixup_pass {
+ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
+ suspend##hook, vendor, device, class, \
+ class_shift, hook)
++#define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \
++ class_shift, hook) \
++ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
++ suspend_late##hook, vendor, device, \
++ class, class_shift, hook)
+
+ #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
+ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
+@@ -1550,6 +1556,10 @@ enum pci_fixup_pass {
+ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
+ suspend##hook, vendor, device, \
+ PCI_ANY_ID, 0, hook)
++#define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \
++ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \
++ suspend_late##hook, vendor, device, \
++ PCI_ANY_ID, 0, hook)
+
+ #ifdef CONFIG_PCI_QUIRKS
+ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
Copied: dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch (from r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/wheezy-backports/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch Mon Dec 8 23:02:20 2014 (r22145, copy of r22142, dists/sid/linux/debian/patches/features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch)
@@ -0,0 +1,148 @@
+From: Andreas Noever <andreas.noever at gmail.com>
+Date: Tue, 3 Jun 2014 22:04:10 +0200
+Subject: [2/2] PCI: Suspend/resume quirks for Apple thunderbolt
+Origin: https://git.kernel.org/linus/1df5172c5c251ec24a1bd0f44fe38c841f384330
+
+Add two quirks to support thunderbolt suspend/resume on Apple systems.
+We need to perform two different actions during suspend and resume:
+
+The whole controller has to be powered down before suspend. If this is
+not done then the native host interface device will be gone after resume
+if a thunderbolt device was plugged in before suspending. The controller
+represents itself as multiple PCI devices/bridges. To power it down we
+hook into the upstream bridge of the controller and call the magic ACPI
+methods. Power will be restored automatically during resume (by the
+firmware presumably).
+
+During resume we have to wait for the native host interface to
+reestablish all pci tunnels. Since there is no parent-child relationship
+between the NHI and the bridges we have to explicitly wait for them
+using device_pm_wait_for_dev. We do this in the resume_noirq phase of
+the downstream bridges of the controller (which lead into the
+thunderbolt tunnels).
+
+Signed-off-by: Andreas Noever <andreas.noever at gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+[bwh: Avoid ABI change]
+---
+ drivers/pci/quirks.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 97 insertions(+)
+
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -3006,6 +3006,103 @@ DECLARE_PCI_FIXUP_HEADER(0x1814, 0x0601,
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x8169,
+ quirk_broken_intx_masking);
+
++#ifdef CONFIG_ACPI
++/*
++ * Apple: Shutdown Cactus Ridge Thunderbolt controller.
++ *
++ * On Apple hardware the Cactus Ridge Thunderbolt controller needs to be
++ * shutdown before suspend. Otherwise the native host interface (NHI) will not
++ * be present after resume if a device was plugged in before suspend.
++ *
++ * The thunderbolt controller consists of a pcie switch with downstream
++ * bridges leading to the NHI and to the tunnel pci bridges.
++ *
++ * This quirk cuts power to the whole chip. Therefore we have to apply it
++ * during suspend_noirq of the upstream bridge.
++ *
++ * Power is automagically restored before resume. No action is needed.
++ */
++static void quirk_apple_poweroff_thunderbolt(struct pci_dev *dev)
++{
++ acpi_handle bridge, SXIO, SXFP, SXLV;
++
++ if (!dmi_match(DMI_BOARD_VENDOR, "Apple Inc."))
++ return;
++ if (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM)
++ return;
++ bridge = ACPI_HANDLE(&dev->dev);
++ if (!bridge)
++ return;
++ /*
++ * SXIO and SXLV are present only on machines requiring this quirk.
++ * TB bridges in external devices might have the same device id as those
++ * on the host, but they will not have the associated ACPI methods. This
++ * implicitly checks that we are at the right bridge.
++ */
++ if (ACPI_FAILURE(acpi_get_handle(bridge, "DSB0.NHI0.SXIO", &SXIO))
++ || ACPI_FAILURE(acpi_get_handle(bridge, "DSB0.NHI0.SXFP", &SXFP))
++ || ACPI_FAILURE(acpi_get_handle(bridge, "DSB0.NHI0.SXLV", &SXLV)))
++ return;
++ dev_info(&dev->dev, "quirk: cutting power to thunderbolt controller...\n");
++
++ /* magic sequence */
++ acpi_execute_simple_method(SXIO, NULL, 1);
++ acpi_execute_simple_method(SXFP, NULL, 0);
++ msleep(300);
++ acpi_execute_simple_method(SXLV, NULL, 0);
++ acpi_execute_simple_method(SXIO, NULL, 0);
++ acpi_execute_simple_method(SXLV, NULL, 0);
++}
++DECLARE_PCI_FIXUP_SUSPEND_LATE(PCI_VENDOR_ID_INTEL, 0x1547,
++ quirk_apple_poweroff_thunderbolt);
++
++/*
++ * Apple: Wait for the thunderbolt controller to reestablish pci tunnels.
++ *
++ * During suspend the thunderbolt controller is reset and all pci
++ * tunnels are lost. The NHI driver will try to reestablish all tunnels
++ * during resume. We have to manually wait for the NHI since there is
++ * no parent child relationship between the NHI and the tunneled
++ * bridges.
++ */
++static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev)
++{
++ struct pci_dev *sibling = NULL;
++ struct pci_dev *nhi = NULL;
++
++ if (!dmi_match(DMI_BOARD_VENDOR, "Apple Inc."))
++ return;
++ if (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM)
++ return;
++ /*
++ * Find the NHI and confirm that we are a bridge on the tb host
++ * controller and not on a tb endpoint.
++ */
++ sibling = pci_get_slot(dev->bus, 0x0);
++ if (sibling == dev)
++ goto out; /* we are the downstream bridge to the NHI */
++ if (!sibling || !sibling->subordinate)
++ goto out;
++ nhi = pci_get_slot(sibling->subordinate, 0x0);
++ if (!nhi)
++ goto out;
++ if (nhi->vendor != PCI_VENDOR_ID_INTEL
++ || (nhi->device != 0x1547 && nhi->device != 0x156c)
++ || nhi->subsystem_vendor != 0x2222
++ || nhi->subsystem_device != 0x1111)
++ goto out;
++ dev_info(&dev->dev, "quirk: wating for thunderbolt to reestablish pci tunnels...\n");
++ device_pm_wait_for_dev(&dev->dev, &nhi->dev);
++out:
++ pci_dev_put(nhi);
++ pci_dev_put(sibling);
++}
++DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, 0x1547,
++ quirk_apple_wait_for_thunderbolt);
++DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, 0x156d,
++ quirk_apple_wait_for_thunderbolt);
++#endif
++
+ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
+ struct pci_fixup *end)
+ {
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -1485,7 +1485,9 @@ enum pci_fixup_pass {
+ pci_fixup_resume, /* pci_device_resume() */
+ pci_fixup_suspend, /* pci_device_suspend() */
+ pci_fixup_resume_early, /* pci_device_resume_early() */
++#ifndef __GENKSYMS__
+ pci_fixup_suspend_late, /* pci_device_suspend_late() */
++#endif
+ };
+
+ /* Anonymous variables would be nice... */
Modified: dists/wheezy-backports/linux/debian/patches/series
==============================================================================
--- dists/wheezy-backports/linux/debian/patches/series Mon Dec 8 22:57:25 2014 (r22144)
+++ dists/wheezy-backports/linux/debian/patches/series Mon Dec 8 23:02:20 2014 (r22145)
@@ -51,24 +51,19 @@
bugfix/mips/disable-advansys.patch
bugfix/arm/ixp4xx_iobe.patch
bugfix/m68k/ethernat-kconfig.patch
-bugfix/x86/x86-reject-x32-executables-if-x32-abi-not-supported.patch
bugfix/s390/s390-3215-fix-hanging-console-issue.patch
bugfix/arm64/arm64-crypto-fix-makefile-rule-for-aes-glue-.o.patch
debian/btrfs-work-around-compiler-bug-on-arm.patch
-bugfix/mips/MIPS-cp1emu-Fix-ISA-restrictions-for-cop1x_op-instru.patch
-bugfix/mips/MIPS-tlbex-Properly-fix-HUGE-TLB-Refill-exception-ha.patch
bugfix/s390/s390-3215-fix-tty-output-containing-tabs.patch
bugfix/x86/drm-i915-initialise-userptr-mmu_notifier-serial-to-1.patch
bugfix/x86/drm-i915-Add-some-L3-registers-to-the-parser-whiteli.patch
-bugfix/x86/KVM-x86-Check-non-canonical-addresses-upon-WRMSR.patch
-bugfix/x86/KVM-x86-Prevent-host-from-panicking-on-shared-MSR-wr.patch
-bugfix/x86/KVM-x86-Improve-thread-safety-in-pit.patch
-bugfix/x86/KVM-x86-Fix-wrong-masking-on-relative-jump-call.patch
-bugfix/x86/kvm-vmx-handle-invvpid-vm-exit-gracefully.patch
-bugfix/x86/KVM-x86-Emulator-fixes-for-eip-canonical-checks-on-n.patch
-bugfix/x86/KVM-x86-Handle-errors-when-RIP-is-set-during-far-jum.patch
-bugfix/x86/kvm-x86-fix-far-jump-to-non-canonical-check.patch
bugfix/parisc/parisc-reduce-sigrtmin-from-37-to-32-to-behave-like-.patch
+bugfix/arm64/arm64-add-missing-dts-entry-for-X-Gene-platform.patch
+bugfix/arm64/arm64-removed-using-of-the-mask-attribute-in-the-dts.patch
+bugfix/x86/x86_64-traps-Stop-using-IST-for-SS.patch
+bugfix/x86/x86_64-traps-Fix-the-espfix64-DF-fixup-and-rewrite-i.patch
+bugfix/x86/x86_64-traps-Rework-bad_iret.patch
+bugfix/x86/x86-asm-traps-Disable-tracing-and-kprobes-in-fixup_b.patch
# Arch features
features/mips/MIPS-Support-hard-limit-of-cpu-count-nr_cpu_ids.patch
@@ -114,12 +109,25 @@
features/arm/dts-sun7i-Add-spi0_pins_a-pinctrl-setting.patch
features/arm/dts-sun7i-Add-uart3_pins_b-pinctrl-setting.patch
features/arm/dts-sun7i-Add-Banana-Pi-board.patch
+features/arm/dts-sunxi-Banana-Pi-increase-startup-delay-for-the-GMAC-PHY-regulator.patch
features/arm/dts-sun7i-Add-support-for-Olimex-A20-OLinuXino-LIME.patch
features/arm64/drivers-net-Add-APM-X-Gene-SoC-ethernet-driver-suppo.patch
features/arm64/drivers-net-NET_XGENE-should-depend-on-HAS_DMA.patch
features/arm64/net-xgene-Check-negative-return-value-of-xgene_enet_.patch
features/arm64/net-xgene-fix-possible-NULL-dereference-in-xgene_ene.patch
features/arm64/dts-Add-bindings-for-APM-X-Gene-SoC-ethernet-driver.patch
+features/arm64/drivers-net-xgene-Preparing-for-adding-10GbE-support.patch
+features/arm64/drivers-net-xgene-Add-10GbE-support.patch
+features/arm64/drivers-net-xgene-Add-10GbE-ethtool-support.patch
+features/arm64/drivers-net-xgene-Preparing-for-adding-SGMII-based-1.patch
+features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-support.patch
+features/arm64/drivers-net-xgene-Add-SGMII-based-1GbE-ethtool-suppo.patch
+features/arm64/drivers-net-xgene-Rewrite-buggy-loop-in-xgene_enet_e.patch
+features/arm64/drivers-net-xgene-Backward-compatibility-with-older-.patch
+features/arm64/drivers-net-xgene-fix-Use-separate-resources.patch
+features/arm64/dtb-Add-10GbE-node-to-APM-X-Gene-SoC-device-tree.patch
+features/arm64/dtb-Add-SGMII-based-1GbE-node-to-APM-X-Gene-SoC-devi.patch
+features/arm64/dtb-xgene-fix-Backward-compatibility-with-older-firm.patch
# Miscellaneous bug fixes
bugfix/all/misc-bmp085-Enable-building-as-a-module.patch
@@ -127,26 +135,28 @@
bugfix/all/disable-some-marvell-phys.patch
debian/i2o-disable-i2o_ext_adaptec-on-64bit.patch
bugfix/all/aic94xx-remove-broken-fallback-for-missing-ctrl-a.patch
-bugfix/all/builddeb-put-the-dbg-files-into-the-correct-director.patch
bugfix/all/fold-swapping-d_name.hash-into-switch_names.patch
bugfix/all/vfs-Don-t-exchange-short-filenames-unconditionally.patch
bugfix/all/rtsx_usb_ms-use-msleep_interruptible-in-polling-loop.patch
-bugfix/all/switch-iov_iter_get_pages-to-passing-maximal-number-.patch
-bugfix/all/fuse-honour-max_read-and-max_write-in-direct_io-mode.patch
-bugfix/all/SUNRPC-Don-t-wake-tasks-during-connection-abort.patch
-bugfix/all/lockd-Try-to-reconnect-if-statd-has-moved.patch
-bugfix/all/mtd-move-support-for-struct-flash_platform_data-into.patch
-bugfix/all/mtd-m25p80-get-rid-of-spi_get_device_id.patch
-bugfix/all/mtd-spi-nor-make-spi_nor_scan-take-a-chip-type-name-.patch
-bugfix/all/mtd-m25p80-spi-nor-Fix-module-aliases-for-m25p80.patch
bugfix/all/HID-i2c-hid-call-the-hid-driver-s-suspend-and-resume.patch
bugfix/all/drivers-net-Disable-UFO-through-virtio.patch
bugfix/all/drivers-net-ipv6-Select-IPv6-fragment-idents-for-vir.patch
-bugfix/all/net-sctp-fix-skb_over_panic-when-receiving-malformed.patch
-bugfix/all/net-sctp-fix-panic-on-duplicate-ASCONF-chunks.patch
-bugfix/all/net-sctp-fix-remote-memory-pressure-from-excessive-q.patch
-bugfix/all/mnt-Prevent-pivot_root-from-creating-a-loop-in-the-m.patch
-bugfix/all/net-mv643xx-disable-tso-by-default.patch
+bugfix/all/revert-drivers-net-disable-ufo-through-virtio-in-macvtap-and-tun.patch
+bugfix/all/xen-netback-Adding-debugfs-io_ring_qX-files.patch
+bugfix/all/xen-netback-Using-a-new-state-bit-instead-of-carrier.patch
+bugfix/all/xen-netback-Turn-off-the-carrier-if-the-guest-is-not.patch
+bugfix/all/xen-netback-Fix-vif-disable-handling.patch
+bugfix/all/xen-netback-Don-t-deschedule-NAPI-when-carrier-off.patch
+bugfix/all/xen-netback-fix-debugfs-write-length-check.patch
+bugfix/all/xen-netback-fix-debugfs-entry-creation.patch
+bugfix/all/xen-netback-move-NAPI-add-remove-calls.patch
+bugfix/all/xen-netback-don-t-stop-dealloc-kthread-too-early.patch
+bugfix/all/xen-netback-remove-loop-waiting-function.patch
+bugfix/all/xen-netback-move-netif_napi_add-before-binding-inter.patch
+bugfix/all/xen-netback-make-feature-rx-notify-mandatory.patch
+bugfix/all/xen-netback-fix-unlimited-guest-Rx-internal-queue-an.patch
+bugfix/all/xen-netback-reintroduce-guest-Rx-stall-detection.patch
+bugfix/all/of-fdt-memblock_reserve-memreserve-regions-in-the-ca.patch
# memfd_create() & kdbus backport
features/all/kdbus/mm-allow-drivers-to-prevent-new-writable-mappings.patch
@@ -172,7 +182,11 @@
features/all/sfc-Adding-PCI-ID-for-Solarflare-7000-series-40G-net.patch
features/all/sfc-Add-40G-link-capability-decoding.patch
features/all/mmc_block-increase-max_devices.patch
-features/all/wireless-rt2x00-add-new-rt2800usb-device.patch
+features/all/of-Create-of_console_check-for-selecting-a-console-s.patch
+features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch
+features/all/of-correct-of_console_check-s-return-value.patch
+features/all/of-add-optional-options-parameter-to-of_find_node_by.patch
+features/all/of-support-passing-console-options-with-stdout-path.patch
# Update r8723au to 3.17
features/all/r8723au/0001-staging-rtl8723au-rtw_get_wps_ie23a-Remove-unused-de.patch
@@ -454,6 +468,8 @@
features/x86/apple-tb/0029-thunderbolt-Correct-the-size-argument-to-devm_kzallo.patch
features/x86/apple-tb/0030-thunderbolt-Use-kcalloc.patch
features/x86/apple-tb/0031-thunderbolt-Clear-hops-before-overwriting.patch
+features/x86/apple-tb/pci-add-pci_fixup_suspend_late-quirk-pass.patch
+features/x86/apple-tb/pci-suspend-resume-quirks-for-apple-thunderbolt.patch
# Add iwlwifi firmware monitor from 3.17
features/all/iwlwifi-debug/iwlwifi-add-device-firmware-to-fw-error-dump-file.patch
@@ -463,3 +479,9 @@
features/all/iwlwifi-debug/iwlwifi-mvm-don-t-collect-logs-in-the-interrupt-thread.patch
features/all/iwlwifi-debug/iwlwifi-mvm-kill-iwl_mvm_fw_error_rxf_dump.patch
features/all/iwlwifi-debug/iwlwifi-mvm-update-layout-of-firmware-error-dump.patch
+
+# Fix ABI changes
+debian/of-fix-abi-changes.patch
+debian/iovec-fix-abi-change-in-3.16.7-ckt1.patch
+debian/truncate-fix-abi-change-in-3.16.7-ckt1.patch
+debian/perf-fix-abi-change-in-3.16.7-ckt2.patch
More information about the Kernel-svn-changes
mailing list