]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
7 years agoUBUNTU: SAUCE: Add '-fno-ie -no-pie' to cflags for powerpc ptrace tests
Seth Forshee [Mon, 13 Mar 2017 20:59:01 +0000 (15:59 -0500)]
UBUNTU: SAUCE: Add '-fno-ie -no-pie' to cflags for powerpc ptrace tests

BugLink: http://bugs.launchpad.net/bugs/1672510
Fixes a FTBFS caused due to gcc in Ubuntu generating position-
independent code by default.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoirqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
Shanker Donthineni [Tue, 7 Mar 2017 14:20:38 +0000 (08:20 -0600)]
irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065

BugLink: http://bugs.launchpad.net/bugs/1672486
On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware
implementation uses 16Bytes for Interrupt Translation Entry (ITE),
but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.

It might cause kernel memory corruption depending on the number
of MSI(x) that are configured and the amount of memory that has
been allocated for ITEs in its_create_device().

This patch fixes the potential memory corruption by setting the
correct ITE size to 16Bytes.

Cc: stable@vger.kernel.org
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 90922a2d03d84de36bf8a9979d62580102f31a92)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: [Config] CONFIG_QCOM_QDF2400_ERRATUM_0065=y
dann frazier [Mon, 13 Mar 2017 18:41:05 +0000 (12:41 -0600)]
UBUNTU: [Config] CONFIG_QCOM_QDF2400_ERRATUM_0065=y

BugLink: http://bugs.launchpad.net/bugs/1672486
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoirqdomain: Add empty irq_domain_check_msi_remap
Mian Yousaf Kaukab [Thu, 2 Mar 2017 15:11:47 +0000 (16:11 +0100)]
irqdomain: Add empty irq_domain_check_msi_remap

BugLink: http://bugs.launchpad.net/bugs/1672502
Fix following build error for s390:
drivers/vfio/vfio_iommu_type1.c: In function 'vfio_iommu_type1_attach_group':
drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration of function 'irq_domain_check_msi_remap'

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit b3e228473e6cec7cf83b4025b4570c8066ab2dd8)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopinctrl: qcom: add get_direction function
Timur Tabi [Fri, 10 Feb 2017 23:21:00 +0000 (17:21 -0600)]
pinctrl: qcom: add get_direction function

BugLink: http://bugs.launchpad.net/bugs/1672504
The get_direction callback function allows gpiolib to know the current
direction (input vs output) for a given GPIO.

This is particularly useful on ACPI systems, where the GPIOs are
configured only by firmware (typically UEFI), so the only way to
know the initial values to query the hardware directly.  Without
this function, gpiolib thinks that all GPIOs are configured for
input.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 8e51533780ba223a3562ff4382c6b6f350c7e9a4)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoperf probe: Fix wrong register name for arm64
He Kuang [Tue, 24 Jan 2017 10:30:14 +0000 (10:30 +0000)]
perf probe: Fix wrong register name for arm64

BugLink: http://bugs.launchpad.net/bugs/1671917
The register name of arm64 architecture is x0-x31 not r0-r31, this patch
changes this typo.

Before this patch:

  # perf probe --definition 'sys_write count'
  p:probe/sys_write _text+1502872 count=%r2:s64

  # echo 'p:probe/sys_write _text+1502872 count=%r2:s64' > \
    /sys/kernel/debug/tracing/kprobe_events
  Parse error at argument[0]. (-22)

After this patch:

  # perf probe --definition 'sys_write count'
  p:probe/sys_write _text+1502872 count=%x2:s64

  # echo 'p:probe/sys_write _text+1502872 count=%x2:s64' > \
    /sys/kernel/debug/tracing/kprobe_events
  # echo 1 >/sys/kernel/debug/tracing/events/probe/enable
  # cat /sys/kernel/debug/tracing/trace
  ...
  sh-422   [000] d... 650.495930: sys_write: (SyS_write+0x0/0xc8) count=22
  sh-422   [000] d... 651.102389: sys_write: (SyS_write+0x0/0xc8) count=26
  sh-422   [000] d... 651.358653: sys_write: (SyS_write+0x0/0xc8) count=86

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Bintian Wang <bintian.wang@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170124103015.1936-2-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 1b29dfbba124be5077a24996a272205baec1c008)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] linux-source-* is in the primary linux namespace
Andy Whitcroft [Fri, 4 Nov 2016 14:51:23 +0000 (14:51 +0000)]
UBUNTU: [Config] linux-source-* is in the primary linux namespace

BugLink: http://bugs.launchpad.net/bugs/1637473
Signed-off-by: Andy Whitcroft <apw@canonical.com>
7 years agoUBUNTU: hv_set_ifconfig -- ensure we include the last stanza
Andy Whitcroft [Wed, 9 Nov 2016 10:23:37 +0000 (10:23 +0000)]
UBUNTU: hv_set_ifconfig -- ensure we include the last stanza

BugLink: http://bugs.launchpad.net/bugs/1640109
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
7 years agoUBUNTU: hv_set_ifconfig -- handle DHCP interfaces correctly
Andy Whitcroft [Wed, 9 Nov 2016 10:23:36 +0000 (10:23 +0000)]
UBUNTU: hv_set_ifconfig -- handle DHCP interfaces correctly

BugLink: http://bugs.launchpad.net/bugs/1640109
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
7 years agoUBUNTU: [Debian] consider renames in gen-auto-reconstruct
Thadeu Lima de Souza Cascardo [Wed, 21 Dec 2016 11:16:33 +0000 (09:16 -0200)]
UBUNTU: [Debian] consider renames in gen-auto-reconstruct

Recent git versions have changed the rename detection to default when
using git-diff. Previous behavior would allow the reconstruct script to
remove the renamed files, which are added in the diff, but not removed.

Using --no-renames option will revert to the previous behavior when
using those recent git versions.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: Disable timers selftest for now"
Seth Forshee [Mon, 13 Mar 2017 13:02:14 +0000 (08:02 -0500)]
Revert "UBUNTU: SAUCE: Disable timers selftest for now"

BugLink: http://bugs.launchpad.net/bugs/1672372
This patch was never effective in its intended purpose due to the
way the kernel self tests are invoked in autotest.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/64: Fix checksum folding in csum_add()
Shile Zhang [Sat, 4 Feb 2017 09:03:40 +0000 (17:03 +0800)]
powerpc/64: Fix checksum folding in csum_add()

BugLink: http://bugs.launchpad.net/bugs/1670247
Paul's patch to fix checksum folding, commit b492f7e4e07a ("powerpc/64:
Fix checksum folding in csum_tcpudp_nofold and ip_fast_csum_nofold")
missed a case in csum_add(). Fix it.

Signed-off-by: Shile Zhang <shile.zhang@nokia.com>
Acked-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 6ad966d7303b70165228dba1ee8da1a05c10eefe)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm/ksm: handle protnone saved writes when making page write protect
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:19 +0000 (14:59 -0800)]
mm/ksm: handle protnone saved writes when making page write protect

BugLink: http://bugs.launchpad.net/bugs/1671613
Without this KSM will consider the page write protected, but a numa
fault can later mark the page writable.  This can result in memory
corruption.

Link: http://lkml.kernel.org/r/1487498625-10891-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 595cd8f256d24face93b2722927ec9c980419c26)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm, ksm: convert write_protect_page() to use page_vma_mapped_walk()
Kirill A. Shutemov [Fri, 24 Feb 2017 22:58:04 +0000 (14:58 -0800)]
mm, ksm: convert write_protect_page() to use page_vma_mapped_walk()

BugLink: http://bugs.launchpad.net/bugs/1671613
For consistency, it worth converting all page_check_address() to
page_vma_mapped_walk(), so we could drop the former.

Link: http://lkml.kernel.org/r/20170129173858.45174-9-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 36eaff3364e8cd35552a77ee426a8170f4f5fde9)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm: introduce page_vma_mapped_walk()
Kirill A. Shutemov [Fri, 24 Feb 2017 22:57:45 +0000 (14:57 -0800)]
mm: introduce page_vma_mapped_walk()

BugLink: http://bugs.launchpad.net/bugs/1671613
Introduce a new interface to check if a page is mapped into a vma.  It
aims to address shortcomings of page_check_address{,_transhuge}.

Existing interface is not able to handle PTE-mapped THPs: it only finds
the first PTE.  The rest lefted unnoticed.

page_vma_mapped_walk() iterates over all possible mapping of the page in
the vma.

Link: http://lkml.kernel.org/r/20170129173858.45174-3-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ace71a19cec5eb430207c3269d8a2683f0574306)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm/ksm: improve deduplication of zero pages with colouring
Claudio Imbrenda [Fri, 24 Feb 2017 22:55:39 +0000 (14:55 -0800)]
mm/ksm: improve deduplication of zero pages with colouring

BugLink: http://bugs.launchpad.net/bugs/1671613
Some architectures have a set of zero pages (coloured zero pages)
instead of only one zero page, in order to improve the cache
performance.  In those cases, the kernel samepage merger (KSM) would
merge all the allocated pages that happen to be filled with zeroes to
the same deduplicated page, thus losing all the advantages of coloured
zero pages.

This behaviour is noticeable when a process accesses large arrays of
allocated pages containing zeroes.  A test I conducted on s390 shows
that there is a speed penalty when KSM merges such pages, compared to
not merging them or using actual zero pages from the start without
breaking the COW.

This patch fixes this behaviour.  When coloured zero pages are present,
the checksum of a zero page is calculated during initialisation, and
compared with the checksum of the current canditate during merging.  In
case of a match, the normal merging routine is used to merge the page
with the correct coloured zero page, which ensures the candidate page is
checked to be equal to the target zero page.

A sysfs entry is also added to toggle this behaviour, since it can
potentially introduce performance regressions, especially on
architectures without coloured zero pages.  The default value is
disabled, for backwards compatibility.

With this patch, the performance with KSM is the same as with non
COW-broken actual zero pages, which is also the same as without KSM.

[akpm@linux-foundation.org: make zero_checksum and ksm_use_zero_pages __read_mostly, per Andrea]
[imbrenda@linux.vnet.ibm.com: documentation for coloured zero pages deduplication]
Link: http://lkml.kernel.org/r/1484927522-1964-1-git-send-email-imbrenda@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1484850953-23941-1-git-send-email-imbrenda@linux.vnet.ibm.com
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit e86c59b1b12d0db1c97eb5bec7586a691685c6cc)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: SAUCE: power/mm: update pte_write and pte_wrprotect to handle savedwrite
Aneesh Kumar K.V [Thu, 9 Mar 2017 21:00:44 +0000 (14:00 -0700)]
UBUNTU: SAUCE: power/mm: update pte_write and pte_wrprotect to handle savedwrite

BugLink: http://bugs.launchpad.net/bugs/1671613
http://ozlabs.org/~akpm/mmots/broken-out/power-mm-update-pte_write-and-pte_wrprotect-to-handle-savedwrite.patch

We use pte_write() to check whethwer the pte entry is writable.  This is
mostly used to later mark the pte read only if it is writable.  The other
use of pte_write() is to check whether the pte_entry is writable so that
hardware page table entry can be marked accordingly.  This is used in kvm
where we look at qemu page table entry and update hardware hash page table
for the guest with correct write enable bit.

With the above, for the first usage we should also check the savedwrite
bit so that we can correctly clear the savedwite bit.  For the later, we
add a new variant __pte_write().

With this we can revert write_protect_page part of 595cd8f256d2 ("mm/ksm:
handle protnone saved writes when making page write protect").  But I left
it as it is as an example code for savedwrite check.

Fixes: c137a2757b886 ("powerpc/mm/autonuma: switch ppc64 to its own implementation of saved write")
Link: http://lkml.kernel.org/r/1488203787-17849-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
7 years agoUBUNTU: SAUCE: powerpc/mm: handle protnone ptes on fork
Aneesh Kumar K.V [Thu, 9 Mar 2017 20:59:50 +0000 (13:59 -0700)]
UBUNTU: SAUCE: powerpc/mm: handle protnone ptes on fork

BugLink: http://bugs.launchpad.net/bugs/1671613
http://ozlabs.org/~akpm/mmots/broken-out/powerpc-mm-handle-protnone-ptes-on-fork.patch

We need to mark pages of parent process read only on fork.  Numa fault pte
needs a protnone ptes variant with saved write flag set.  On fork we need
to make sure we remove the saved write bit.  Instead of adding the
protnone check in the caller update ptep_set_wrprotect variants to clear
savedwrite bit.

Without this we see random segfaults in application on fork.

Fixes: c137a2757b886 ("powerpc/mm/autonuma: switch ppc64 to its own implementation of saved write")
Link: http://lkml.kernel.org/r/1488203787-17849-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
7 years agomm/thp/autonuma: use TNF flag instead of vm fault
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:56 +0000 (14:59 -0800)]
mm/thp/autonuma: use TNF flag instead of vm fault

BugLink: http://bugs.launchpad.net/bugs/1671613
We are using the wrong flag value in task_numa_falt function.  This can
result in us doing wrong numa fault statistics update, because we update
num_pages_migrate and numa_fault_locality etc based on the flag argument
passed.

Fixes: bae473a423 ("mm: introduce fault_env")
Link: http://lkml.kernel.org/r/1487498395-9544-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 9a8b300f2f7812ebf4630b8b40499da38b38e882)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm/gup: check for protnone only if it is a PTE entry
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:53 +0000 (14:59 -0800)]
mm/gup: check for protnone only if it is a PTE entry

BugLink: http://bugs.launchpad.net/bugs/1671613
Do the prot_none/FOLL_NUMA check after we are sure this is a THP pte.
Archs can implement prot_none such that it can return true for regular
pmd entries.

Link: http://lkml.kernel.org/r/1487498326-8734-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit db08f2030a173fdb95b2e8e28d82c4e8c04df2ac)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/mm/autonuma: switch ppc64 to its own implementation of saved write
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:21 +0000 (14:59 -0800)]
powerpc/mm/autonuma: switch ppc64 to its own implementation of saved write

BugLink: http://bugs.launchpad.net/bugs/1671613
With this our protnone becomes a present pte with READ/WRITE/EXEC bit
cleared.  By default we also set _PAGE_PRIVILEGED on such pte.  This is
now used to help us identify a protnone pte that as saved write bit.
For such pte, we will clear the _PAGE_PRIVILEGED bit.  The pte still
remain non-accessible from both user and kernel.

[aneesh.kumar@linux.vnet.ibm.com: v3]
Link: http://lkml.kernel.org/r/1487498625-10891-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1487050314-3892-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <michaele@au1.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c137a2757b88658ce61c74b25ff650ecda7f09d8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm/autonuma: let architecture override how the write bit should be stashed in a protn...
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:16 +0000 (14:59 -0800)]
mm/autonuma: let architecture override how the write bit should be stashed in a protnone pte.

BugLink: http://bugs.launchpad.net/bugs/1671613
Patch series "Numabalancing preserve write fix", v2.

This patch series address an issue w.r.t THP migration and autonuma
preserve write feature.  migrate_misplaced_transhuge_page() cannot deal
with concurrent modification of the page.  It does a page copy without
following the migration pte sequence.  IIUC, this was done to keep the
migration simpler and at the time of implemenation we didn't had THP
page cache which would have required a more elaborate migration scheme.
That means thp autonuma migration expect the protnone with saved write
to be done such that both kernel and user cannot update the page
content.  This patch series enables archs like ppc64 to do that.  We are
good with the hash translation mode with the current code, because we
never create a hardware page table entry for a protnone pte.

This patch (of 2):

Autonuma preserves the write permission across numa fault to avoid
taking a writefault after a numa fault (Commit: b191f9b106ea " mm: numa:
preserve PTE write permissions across a NUMA hinting fault").
Architecture can implement protnone in different ways and some may
choose to implement that by clearing Read/ Write/Exec bit of pte.
Setting the write bit on such pte can result in wrong behaviour.  Fix
this up by allowing arch to override how to save the write bit on a
protnone pte.

[aneesh.kumar@linux.vnet.ibm.com: don't mark pte saved write in case of dirty_accountable]
Link: http://lkml.kernel.org/r/1487942884-16517-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
[aneesh.kumar@linux.vnet.ibm.com: v3]
Link: http://lkml.kernel.org/r/1487498625-10891-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1487050314-3892-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <michaele@au1.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 288bc54949fc2625a4fd811a188fb200cc498946)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agomm/autonuma: don't use set_pte_at when updating protnone ptes
Aneesh Kumar K.V [Fri, 24 Feb 2017 22:59:13 +0000 (14:59 -0800)]
mm/autonuma: don't use set_pte_at when updating protnone ptes

BugLink: http://bugs.launchpad.net/bugs/1671613
Architectures like ppc64, use privilege access bit to mark pte non
accessible.  This implies that kernel can do a copy_to_user to an
address marked for numa fault.  This also implies that there can be a
parallel hardware update for the pte.  set_pte_at cannot be used in such
scenarios.  Hence switch the pte update to use ptep_get_and_clear and
set_pte_at combination.

[akpm@linux-foundation.org: remove unwanted ppc change, per Aneesh]
Link: http://lkml.kernel.org/r/1486400776-28114-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(back ported from commit cee216a696b2004017a5ecb583366093d90b1568)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
mm/memory.c

7 years agopowerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop
Gautham R. Shenoy [Mon, 27 Feb 2017 05:40:07 +0000 (11:10 +0530)]
powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop

BugLink: http://bugs.launchpad.net/bugs/1666197
Commit 09206b600c76 ("powernv: Pass PSSCR value and mask to
power9_idle_stop") added additional code in power_enter_stop() to
distinguish between stop requests whose PSSCR had ESL=EC=1 from those
which did not. When ESL=EC=1, we do a forward-jump to a location
labelled by "1", which had the code to handle the ESL=EC=1 case.

Unfortunately just a couple of instructions before this label, is the
macro IDLE_STATE_ENTER_SEQ() which also has a label "1" in its
expansion.

As a result, the current code can result in directly executing stop
instruction for deep stop requests with PSSCR ESL=EC=1, without saving
the hypervisor state.

Fix this BUG by labeling the location that handles ESL=EC=1 case with
a more descriptive label ".Lhandle_esl_ec_set" (local label suggestion
a la .Lxx from Anton Blanchard).

While at it, rename the label "2" labelling the location of the code
handling entry into deep stop states with ".Lhandle_deep_stop".

For a good measure, change the label in IDLE_STATE_ENTER_SEQ() macro
to an not-so commonly used value in order to avoid similar mishaps in
the future.

Fixes: 09206b600c76 ("powernv: Pass PSSCR value and mask to power9_idle_stop")
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 424f8acd328a111319ae30bf384e5dfb9bc8f8cb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: Start new release
Tim Gardner [Thu, 9 Mar 2017 20:31:22 +0000 (13:31 -0700)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: Ubuntu-4.10.0-13.15 Ubuntu-4.10.0-13.15
Tim Gardner [Thu, 9 Mar 2017 19:32:13 +0000 (12:32 -0700)]
UBUNTU: Ubuntu-4.10.0-13.15

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: d-i: add ehci-platform to usb-modules
dann frazier [Thu, 9 Mar 2017 02:19:38 +0000 (19:19 -0700)]
UBUNTU: d-i: add ehci-platform to usb-modules

BugLink: http://bugs.launchpad.net/bugs/1671589
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoirqchip/gic-v3-its: Enable cacheable attribute Read-allocate hints
Shanker Donthineni [Thu, 26 Jan 2017 03:51:41 +0000 (21:51 -0600)]
irqchip/gic-v3-its: Enable cacheable attribute Read-allocate hints

BugLink: http://bugs.launchpad.net/bugs/1671598
Read-allocation hints are not enabled for both the GIC-ITS and GICR
tables. This forces the hardware to always read the table contents
from an external memory (DDR) which is slow compared to cache memory.
Most of the tables are often read by hardware. So, it's better to
enable Read-allocate hints in addition to Write-allocate hints in
order to improve the GICR_PEND, GICR_PROP, Collection, Device, and
vCPU tables lookup time.

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 2fd632a00383e812db7186f903ebed808d9951bd)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoiommu: Fix static checker warning in iommu_insert_device_resv_regions
Eric Auger [Mon, 6 Feb 2017 09:11:38 +0000 (10:11 +0100)]
iommu: Fix static checker warning in iommu_insert_device_resv_regions

BugLink: http://bugs.launchpad.net/bugs/1671599
In case the device reserved region list is void, the returned value
of iommu_insert_device_resv_regions is uninitialized. Let's return 0
in that case.

This fixes commit 6c65fb318e8b ("iommu: iommu_get_group_resv_regions").

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
(cherry picked from commit a514a6e241f051dd8a4a00a456382dec0b1af21b)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoarm64: Avoid clobbering mm in erratum workaround on QDF2400
Shanker Donthineni [Thu, 23 Feb 2017 03:10:48 +0000 (21:10 -0600)]
arm64: Avoid clobbering mm in erratum workaround on QDF2400

BugLink: http://bugs.launchpad.net/bugs/1671602
Commit 38fd94b0275c ("arm64: Work around Falkor erratum 1003") tried to
work around a hardware erratum, but actually caused a system crash of
its own during switch_mm:

 cpu_do_switch_mm+0x20/0x40
 efi_virtmap_load+0x34/0x40
 virt_efi_get_next_variable+0x64/0xc8
 efivar_init+0x8c/0x348
 efisubsys_init+0xd4/0x270
 do_one_initcall+0x80/0x110
 kernel_init_freeable+0x19c/0x240
 kernel_init+0x10/0x100
 ret_from_fork+0x10/0x50

 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

In cpu_do_switch_mm, x1 contains the mm_struct pointer, which needs to
be preserved by the pre_ttbr0_update_workaround macro rather than passed
as a temporary.

This patch clobbers x2 and x3 instead, keeping the mm_struct intact
after the workaround has run.

Fixes: 38fd94b0275c ("arm64: Work around Falkor erratum 1003")
Tested-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit ea6eac904f0a5a0c223bcfb133ec880ba9c70ae3)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoPCI: Add ACS quirk for Qualcomm QDF2400 and QDF2432
Sinan Kaya [Thu, 16 Feb 2017 22:01:45 +0000 (17:01 -0500)]
PCI: Add ACS quirk for Qualcomm QDF2400 and QDF2432

BugLink: http://bugs.launchpad.net/bugs/1671601
The Qualcomm QDF2xxx root ports don't advertise an ACS capability, but they
do provide ACS-like features to disable peer transactions and validate bus
numbers in requests.

To be specific:
* Hardware supports source validation but it will report the issue as
Completer Abort instead of ACS Violation.

* Hardware doesn't support peer-to-peer and each root port is a root
complex with unique segment numbers.

* It is not possible for one root port to pass traffic to the other root
port.  All PCIe transactions are terminated inside the root port.

Add an ACS quirk for the QDF2400 and QDF2432 products.

[bhelgaas: changelog]
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit 33be632b8443b6ac74aa293504f430604fb9abeb)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agotty: pl011: Work around QDF2400 E44 stuck BUSY bit
Sudeep Holla [Wed, 1 Feb 2017 15:46:38 +0000 (15:46 +0000)]
tty: pl011: Work around QDF2400 E44 stuck BUSY bit

BugLink: http://bugs.launchpad.net/bugs/1671600
The Qualcomm Datacenter Technologies QDF2400 family of SoCs contains a
custom (non-PrimeCell) implementation of the SBSA UART. Occasionally the
BUSY bit in the Flag Register gets stuck as 1, erratum 44 for both 2432v1
and 2400v1 SoCs.Checking that the Transmit FIFO Empty (TXFE) bit is 0,
instead of checking that the BUSY bit is 1, works around the issue.

To facilitate this substitution of flags and values, introduce
vendor-specific inversion of Feature Register bits when UART AMBA Port
(UAP) data is available. For the earlycon case, prior to UAP availability,
implement alternative putc and early_write functions.

Similar to what how ARMv8 ACPI PCI quirks are detected during MCFG parsing,
check the OEM fields of the Serial Port Console Redirection (SPCR) ACPI
table to determine if the current platform is known to be affected by the
erratum.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(backported from commit d8a4995bcea168dfac8ee41c28c79109907e4fba)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agotty: n_hdlc: get rid of racy n_hdlc.tbuf
Alexander Popov [Wed, 1 Mar 2017 21:31:58 +0000 (13:31 -0800)]
tty: n_hdlc: get rid of racy n_hdlc.tbuf

Currently N_HDLC line discipline uses a self-made singly linked list for
data buffers and has n_hdlc.tbuf pointer for buffer retransmitting after
an error.

The commit be10eb7589337e5defbe214dae038a53dd21add8
("tty: n_hdlc add buffer flushing") introduced racy access to n_hdlc.tbuf.
After tx error concurrent flush_tx_queue() and n_hdlc_send_frames() can put
one data buffer to tx_free_buf_list twice. That causes double free in
n_hdlc_release().

Let's use standard kernel linked list and get rid of n_hdlc.tbuf:
in case of tx error put current data buffer after the head of tx_buf_list.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
CVE-2017-2636

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: ubuntu: vbox -- Update to 5.1.16-dfsg-1
Seth Forshee [Thu, 9 Mar 2017 13:24:31 +0000 (07:24 -0600)]
UBUNTU: ubuntu: vbox -- Update to 5.1.16-dfsg-1

BugLink: http://bugs.launchpad.net/bugs/1671470
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: Start new release
Tim Gardner [Thu, 9 Mar 2017 13:16:55 +0000 (06:16 -0700)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: Ubuntu-4.10.0-12.14 Ubuntu-4.10.0-12.14
Tim Gardner [Wed, 8 Mar 2017 20:12:59 +0000 (13:12 -0700)]
UBUNTU: Ubuntu-4.10.0-12.14

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc: Update to new option-vector-5 format for CAS
Suraj Jitindar Singh [Tue, 28 Feb 2017 06:03:48 +0000 (17:03 +1100)]
powerpc: Update to new option-vector-5 format for CAS

BugLink: http://bugs.launchpad.net/bugs/1671169
On POWER9 the ibm,client-architecture-support (CAS) negotiation process
has been updated to change how the host to guest negotiation is done for
the new hash/radix mmu as well as the nest mmu, process tables and guest
translation shootdown (GTSE).

This is documented in the unreleased PAPR ACR "CAS option vector
additions for P9".

The host tells the guest which options it supports in
ibm,arch-vec-5-platform-support. The guest then chooses a subset of these
to request in the CAS call and these are agreed to in the
ibm,architecture-vec-5 property of the chosen node.

Thus we read ibm,arch-vec-5-platform-support and make our selection before
calling CAS. We then parse the ibm,architecture-vec-5 property of the
chosen node to check whether we should run as hash or radix.

ibm,arch-vec-5-platform-support format:

index value pairs: <index, val> ... <index, val>

index: Option vector 5 byte number
val:   Some representation of supported values

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Acked-by: Paul Mackerras <paulus@ozlabs.org>
[mpe: Don't print about unknown options, be consistent with OV5_FEAT]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 014d02cbf16b3106dc8e93281d2a9c189751ed5e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc: Parse the command line before calling CAS
Suraj Jitindar Singh [Tue, 28 Feb 2017 06:03:47 +0000 (17:03 +1100)]
powerpc: Parse the command line before calling CAS

BugLink: http://bugs.launchpad.net/bugs/1671169
On POWER9 the hypervisor requires the guest to decide whether it would
like to use a hash or radix mmu model at the time it calls
ibm,client-architecture-support (CAS) based on what the hypervisor has
said it's allowed to do. It is possible to disable radix by passing
"disable_radix" on the command line. The next patch will add support for
the new CAS format, thus we need to parse the command line before calling
CAS so we can correctly select which mmu we would like to use.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Paul Mackerras <paulus@ozlabs.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 12cc9fd6b2d8ee307a735b3b9faed0d17b719463)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: [Config] CONFIG_LATENCYTOP=y for amd64 lowlatency
Tim Gardner [Wed, 8 Mar 2017 14:37:43 +0000 (07:37 -0700)]
UBUNTU: [Config] CONFIG_LATENCYTOP=y for amd64 lowlatency

BugLink: http://bugs.launchpad.net/bugs/1655986
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc: Add POWER9 architected mode to cputable
Russell Currey [Fri, 17 Feb 2017 02:01:35 +0000 (13:01 +1100)]
powerpc: Add POWER9 architected mode to cputable

BugLink: http://bugs.launchpad.net/bugs/1670800
PVR value of 0x0F000005 means we are arch v3.00 compliant (i.e. POWER9).

Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Russell Currey <ruscur@russell.cc>
[mpe: Don't set num_pmcs, so we keep the PMU fields from the raw entry]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 6ae3f8ad2017079292cb49c8959b527bcbcbefed)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoKVM: PPC: Book3S HV: Fix H_PROD to actually wake the target vcpu
Paul Mackerras [Tue, 6 Dec 2016 09:42:05 +0000 (20:42 +1100)]
KVM: PPC: Book3S HV: Fix H_PROD to actually wake the target vcpu

BugLink: http://bugs.launchpad.net/bugs/1670726
The H_PROD hypercall is supposed to wake up an idle vcpu.  We have
an implementation, but because Linux doesn't use it except when
doing cpu hotplug, it was never tested properly.  AIX does use it,
and reported it broken.  It turns out we were waking the wrong
vcpu (the one doing H_PROD, not the target of the prod) and we
weren't handling the case where the target needs an IPI to wake
it.  Fix it by using the existing kvmppc_fast_vcpu_kick_hv()
function, which is intended for this kind of thing, and by using
the target vcpu not the current vcpu.

We were also not looking at the prodded flag when checking whether a
ceded vcpu should wake up, so this adds checks for the prodded flag
alongside the checks for pending exceptions.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
(cherry picked from commit 8464c8842de2249061d3c5abc2ccce1bbbd10e7a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Fix possible use after free in demultiplex thread
Pavel Shilovsky [Wed, 1 Mar 2017 00:05:19 +0000 (16:05 -0800)]
CIFS: Fix possible use after free in demultiplex thread

BugLink: http://bugs.launchpad.net/bugs/1670508
The recent changes that added SMB3 encryption support introduced
a possible use after free in the demultiplex thread. When we
process an encrypted packed we obtain a pointer to SMB session
but do not obtain a reference. This can possibly lead to a situation
when this session was freed before we copy a decryption key from
there. Fix this by obtaining a copy of the key rather than a pointer
to the session under a spinlock.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
(cherry picked from commit 61cfac6f267dabcf2740a7ec8a0295833b28b5f5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Allow to switch on encryption with seal mount option
Pavel Shilovsky [Thu, 17 Nov 2016 21:59:23 +0000 (13:59 -0800)]
CIFS: Allow to switch on encryption with seal mount option

BugLink: http://bugs.launchpad.net/bugs/1670508
This allows users to inforce encryption for SMB3 shares if a server
supports it.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit ae6f8dd4d0c87bfb72da9d9b56342adf53e69c31)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Add capability to decrypt big read responses
Pavel Shilovsky [Fri, 18 Nov 2016 00:20:23 +0000 (16:20 -0800)]
CIFS: Add capability to decrypt big read responses

BugLink: http://bugs.launchpad.net/bugs/1670508
Allow to decrypt transformed packets that are bigger than the big
buffer size. In particular it is used for read responses that can
only exceed the big buffer size.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit c42a6abe3012832a68a371dabe17c2ced97e62ad)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Decrypt and process small encrypted packets
Pavel Shilovsky [Thu, 17 Nov 2016 23:24:46 +0000 (15:24 -0800)]
CIFS: Decrypt and process small encrypted packets

BugLink: http://bugs.launchpad.net/bugs/1670508
Allow to decrypt transformed packets, find a corresponding mid
and process as usual further.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 4326ed2f6a16ae9d33e4209b540dc9a371aba840)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Add copy into pages callback for a read operation
Pavel Shilovsky [Fri, 18 Nov 2016 00:20:18 +0000 (16:20 -0800)]
CIFS: Add copy into pages callback for a read operation

BugLink: http://bugs.launchpad.net/bugs/1670508
Since we have two different types of reads (pagecache and direct)
we need to process such responses differently after decryption of
a packet. The change allows to specify a callback that copies a read
payload data into preallocated pages.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit d70b9104b1ca586f73aaf59426756cec3325a40e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Add mid handle callback
Pavel Shilovsky [Wed, 16 Nov 2016 22:06:17 +0000 (14:06 -0800)]
CIFS: Add mid handle callback

BugLink: http://bugs.launchpad.net/bugs/1670508
We need to process read responses differently because the data
should go directly into preallocated pages. This can be done
by specifying a mid handle callback.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 9b7c18a2d4b798963ea80f6769701dcc4c24b55e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Add transform header handling callbacks
Pavel Shilovsky [Thu, 17 Nov 2016 23:24:34 +0000 (15:24 -0800)]
CIFS: Add transform header handling callbacks

BugLink: http://bugs.launchpad.net/bugs/1670508
We need to recognize and parse transformed packets in demultiplex
thread to find a corresponsing mid and process it further.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 9bb17e0916a03ab901fb684e874d77a1e96b3d1e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Encrypt SMB3 requests before sending
Pavel Shilovsky [Thu, 3 Nov 2016 23:47:37 +0000 (16:47 -0700)]
CIFS: Encrypt SMB3 requests before sending

BugLink: http://bugs.launchpad.net/bugs/1670508
This change allows to encrypt packets if it is required by a server
for SMB sessions or tree connections.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 026e93dc0a3eefb0be060bcb9ecd8d7a7fd5c398)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Enable encryption during session setup phase
Pavel Shilovsky [Tue, 8 Nov 2016 02:20:50 +0000 (18:20 -0800)]
CIFS: Enable encryption during session setup phase

BugLink: http://bugs.launchpad.net/bugs/1670508
In order to allow encryption on SMB connection we need to exchange
a session key and generate encryption and decryption keys.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit cabfb3680f78981d26c078a26e5c748531257ebb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Add capability to transform requests before sending
Pavel Shilovsky [Mon, 31 Oct 2016 20:49:30 +0000 (13:49 -0700)]
CIFS: Add capability to transform requests before sending

BugLink: http://bugs.launchpad.net/bugs/1670508
This will allow us to do protocol specific tranformations of packets
before sending to the server. For SMB3 it can be used to support
encryption.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 7fb8986e7449d0a5cebd84d059927afa423fbf85)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Separate RFC1001 length processing for SMB2 read
Pavel Shilovsky [Wed, 23 Nov 2016 23:31:54 +0000 (15:31 -0800)]
CIFS: Separate RFC1001 length processing for SMB2 read

BugLink: http://bugs.launchpad.net/bugs/1670508
Allocate and initialize SMB2 read request without RFC1001 length
field to directly call cifs_send_recv() rather than SendReceive2()
in a read codepath.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit b8f57ee8aad414a3122bff72d7968a94baacb9b6)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Separate SMB2 sync header processing
Pavel Shilovsky [Mon, 24 Oct 2016 23:59:57 +0000 (16:59 -0700)]
CIFS: Separate SMB2 sync header processing

BugLink: http://bugs.launchpad.net/bugs/1670508
Do not process RFC1001 length in smb2_hdr_assemble() because
it is not a part of SMB2 header. This allows to cleanup the code
and adds a possibility combine several SMB2 packets into one
for compounding.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit cb200bd6264a80c04e09e8635fa4f3901cabdaef)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Send RFC1001 length in a separate iov
Pavel Shilovsky [Wed, 23 Nov 2016 23:14:57 +0000 (15:14 -0800)]
CIFS: Send RFC1001 length in a separate iov

BugLink: http://bugs.launchpad.net/bugs/1670508
In order to simplify further encryption support we need to separate
RFC1001 length and SMB2 header when sending a request. Put the length
field in iov[0] and the rest of the packet into following iovs.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 738f9de5cdb9175c19d24cfdf90b4543fc3b47bf)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Make send_cancel take rqst as argument
Pavel Shilovsky [Wed, 23 Nov 2016 23:08:14 +0000 (15:08 -0800)]
CIFS: Make send_cancel take rqst as argument

BugLink: http://bugs.launchpad.net/bugs/1670508
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit fb2036d817584df42504910fe104f68517e8990e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Make SendReceive2() takes resp iov
Pavel Shilovsky [Tue, 25 Oct 2016 18:38:47 +0000 (11:38 -0700)]
CIFS: Make SendReceive2() takes resp iov

BugLink: http://bugs.launchpad.net/bugs/1670508
Now SendReceive2 frees the first iov and returns a response buffer
in it that increases a code complexity. Simplify this by making
a caller responsible for freeing request buffer itself and returning
a response buffer in a separate iov.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit da502f7df03d2d0b416775f92ae022f3f82bedd5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoCIFS: Separate SMB2 header structure
Pavel Shilovsky [Mon, 24 Oct 2016 22:33:04 +0000 (15:33 -0700)]
CIFS: Separate SMB2 header structure

BugLink: http://bugs.launchpad.net/bugs/1670508
In order to support compounding and encryption we need to separate
RFC1001 length field and SMB2 header structure because the protocol
treats them differently. This change will allow to simplify parsing
of such complex SMB2 packets further.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
(cherry picked from commit 31473fc4f9653b73750d3792ffce6a6e1bdf0da7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agocifs: Add soft dependencies
Jean Delvare [Wed, 25 Jan 2017 15:09:10 +0000 (16:09 +0100)]
cifs: Add soft dependencies

BugLink: http://bugs.launchpad.net/bugs/1670508
List soft dependencies of cifs so that mkinitrd and dracut can include
the required helper modules.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Steve French <sfrench@samba.org>
(cherry picked from commit b9be76d585d48cb25af8db0d35e1ef9030fbe13a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agocifs: Only select the required crypto modules
Jean Delvare [Wed, 25 Jan 2017 15:08:17 +0000 (16:08 +0100)]
cifs: Only select the required crypto modules

BugLink: http://bugs.launchpad.net/bugs/1670508
The sha256 and cmac crypto modules are only needed for SMB2+, so move
the select statements to config CIFS_SMB2. Also select CRYPTO_AES
there as SMB2+ needs it.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Steve French <sfrench@samba.org>
(cherry picked from commit 3692304bba6164be3810afd41b84ecb0e1e41db1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agocifs: Simplify SMB2 and SMB311 dependencies
Jean Delvare [Wed, 25 Jan 2017 15:07:29 +0000 (16:07 +0100)]
cifs: Simplify SMB2 and SMB311 dependencies

BugLink: http://bugs.launchpad.net/bugs/1670508
* CIFS_SMB2 depends on CIFS, which depends on INET and selects NLS. So
  these dependencies do not need to be repeated for CIFS_SMB2.
* CIFS_SMB311 depends on CIFS_SMB2, which depends on INET. So this
  dependency doesn't need to be repeated for CIFS_SMB311.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Steve French <sfrench@samba.org>
(cherry picked from commit c1ecea87471bbb614f8121e00e5787f363140365)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoscsi: lpfc: Add missing memory barrier
James Smart [Mon, 19 Dec 2016 23:07:30 +0000 (15:07 -0800)]
scsi: lpfc: Add missing memory barrier

BugLink: http://bugs.launchpad.net/bugs/1670490
On loosely ordered memory systems (PPC for example), the WQE elements
were being updated in memory, but not necessarily flushed before the
separate doorbell was written to hw which would cause hw to dma the
WQE element. Thus, the hardware occasionally received partially
updated WQE data.

Add the memory barrier after updating the WQE memory.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6b3b3bdb83b4ad51252d21bb13596db879e51850)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoscsi: lpfc: Correct WQ creation for pagesize
James Smart [Sun, 12 Feb 2017 21:52:25 +0000 (13:52 -0800)]
scsi: lpfc: Correct WQ creation for pagesize

BugLink: http://bugs.launchpad.net/bugs/1670490
Correct WQ creation for pagesize

The driver was calculating the adapter command pagesize indicator from
the system pagesize. However, the buffers the driver allocates are only
one size (SLI4_PAGE_SIZE), so no calculation was necessary.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8ea73db486cda442f0671f4bc9c03a76be398a28)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Revert 'Auto-online hotplugged memory'
Nathan Fontenot [Wed, 15 Feb 2017 18:45:30 +0000 (13:45 -0500)]
powerpc/pseries: Revert 'Auto-online hotplugged memory'

BugLink: http://bugs.launchpad.net/bugs/1670315
This reverts commit ec999072442a ("powerpc/pseries: Auto-online
hotplugged memory"), and 9dc512819e4b ("powerpc: Fix unused function
warning 'lmb_to_memblock'").

Using the auto-online acpability does online added memory but does not
update the associated device struct to indicate that the memory is
online. This causes the pseries memory DLPAR code to fail when trying to
remove a LMB that was previously removed and added back. This happens
when validating that the LMB is removable.

This patch reverts to the previous behavior of calling device_online()
to online the LMB when it is DLPAR added and moves the lmb_to_memblock()
routine out of CONFIG_MEMORY_HOTREMOVE now that we call it for add.

Fixes: ec999072442a ("powerpc/pseries: Auto-online hotplugged memory")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 943db62c316c578f8e2cc6fb81a5f641096b29bf)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Implement indexed-count hotplug memory remove
Sahil Mehta [Wed, 15 Feb 2017 18:46:18 +0000 (13:46 -0500)]
powerpc/pseries: Implement indexed-count hotplug memory remove

BugLink: http://bugs.launchpad.net/bugs/1670315
Indexed-count remove for memory hotplug guarantees that a contiguous block
of <count> lmbs beginning at a specified <index> will be unassigned (NOT
that <count> lmbs will be removed). Because of Qemu's per-DIMM memory
management, the removal of a contiguous block of memory currently
requires a series of individual calls. Indexed-count remove reduces
this series into a single call.

Signed-off-by: Sahil Mehta <sahilmehta17@gmail.com>
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 753843471cbbaeca25a5cab51981ee721ad272f7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Implement indexed-count hotplug memory add
Sahil Mehta [Wed, 15 Feb 2017 18:45:56 +0000 (13:45 -0500)]
powerpc/pseries: Implement indexed-count hotplug memory add

BugLink: http://bugs.launchpad.net/bugs/1670315
Indexed-count add for memory hotplug guarantees that a contiguous block
of <count> lmbs beginning at a specified <drc index> will be assigned,
any LMBs in this range that are not already assigned will be DLPAR added.
Because of Qemu's per-DIMM memory management, the addition of a contiguous
block of memory currently requires a series of individual calls to add
each LMB in the block. Indexed-count add reduces this series of calls to
a single call for the entire block.

Signed-off-by: Sahil Mehta <sahilmehta17@gmail.com>
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 333f7b76865bec24c66710cf352f892d69e3ba0a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n
Michael Ellerman [Thu, 16 Feb 2017 00:27:00 +0000 (11:27 +1100)]
powerpc/pseries: Fix build break when MEMORY_HOTREMOVE=n

BugLink: http://bugs.launchpad.net/bugs/1670315
We broke the build when CONFIG_MEMORY_HOTREMOVE=n:

  arch/powerpc/platforms/pseries/hotplug-memory.c:821:8: error: implicit
  declaration of function 'dlpar_memory_readd_by_index'

Add a dummy to fix it.

Fixes: e70d59700fc3 ("powerpc/pseries: Introduce memory hotplug READD operation")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit f84775c2d5d92581f2df60d53b574b0405c85be3)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Introduce memory hotplug READD operation
John Allen [Fri, 6 Jan 2017 19:27:26 +0000 (13:27 -0600)]
powerpc/pseries: Introduce memory hotplug READD operation

BugLink: http://bugs.launchpad.net/bugs/1670315
Currently, memory must be hot removed and subsequently re-added in order
to dynamically update the affinity of LMBs specified by a PRRN event.
Earlier implementations of the PRRN event handler ran into issues in which
the hot remove would occur successfully, but a hotplug event would be
initiated from another source and grab the hotplug lock preventing the hot
add from occurring. To prevent this situation, this patch introduces the
notion of a hot "readd" action for memory which atomizes a hot remove and
a hot add into a single, serialized operation on the hotplug queue.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit e70d59700fc32c9249b26acd4120303c497e84f1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Make the acquire/release of the drc for memory a seperate step
John Allen [Fri, 6 Jan 2017 19:25:53 +0000 (13:25 -0600)]
powerpc/pseries: Make the acquire/release of the drc for memory a seperate step

BugLink: http://bugs.launchpad.net/bugs/1670315
When adding and removing LMBs we should make the acquire/release of
the DRC a separate step to allow for a few improvements. First
this will ensure that LMBs removed during a remove by count operation
are all available if a error occurs and we need to add them back. By
first removeing all the LMBs from the kernel before releasing their
DRCs the LMBs are available to add back should an error occur.

Also, this will allow for faster re-add operations of memory for
PRRN event handling since we can skip the unneeded step of having
to release the DRC and the acquire it back.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit c21f515c743687c6c2b3d38227e6ad8e6b733409)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Report DLPAR capabilities
Nathan Fontenot [Wed, 11 Jan 2017 17:00:58 +0000 (12:00 -0500)]
powerpc/pseries: Report DLPAR capabilities

BugLink: http://bugs.launchpad.net/bugs/1670315
As we add the ability to do DLPAR of additional devices through
the sysfs interface we need to know which devices are supported.
This adds the reporting of supported devices with a comma separated
list reported in the existing /sys/kernel/dlpar.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 673bc4354d42731018494bb69d63b6513f9ae2bb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Advertise Hot Plug Event support to firmware
Michael Roth [Tue, 21 Feb 2017 01:12:18 +0000 (19:12 -0600)]
powerpc/pseries: Advertise Hot Plug Event support to firmware

BugLink: http://bugs.launchpad.net/bugs/1670315
With the inclusion of commit 333f7b76865b ("powerpc/pseries: Implement
indexed-count hotplug memory add") and commit 753843471cbb
("powerpc/pseries: Implement indexed-count hotplug memory remove"), we
now have complete handling of the RTAS hotplug event format as described
by PAPR via ACR "PAPR Changes for Hotplug RTAS Events".

This capability is indicated by byte 6, bit 2 (5 in IBM numbering) of
architecture option vector 5, and allows for greater control over
cpu/memory/pci hot plug/unplug operations.

Existing pseries kernels will utilize this capability based on the
existence of the /event-sources/hot-plug-events DT property, so we
only need to advertise it via CAS and do not need a corresponding
FW_FEATURE_* value to test for.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 3dbbaf200f532e01e56168b8339f2981f2cb1d67)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Advertise HPT resizing support via CAS
David Gibson [Fri, 9 Dec 2016 00:07:37 +0000 (11:07 +1100)]
powerpc/pseries: Advertise HPT resizing support via CAS

BugLink: http://bugs.launchpad.net/bugs/1670315
The hypervisor needs to know a guest is capable of using the HPT resizing
PAPR extension in order to make full advantage of it for memory hotplug.

If the hypervisor knows the guest is HPT resize aware, it can size the
initial HPT based on the initial guest RAM size, relying on the guest to
resize the HPT when more memory is hot-added. Without this, the hypervisor
must size the HPT for the maximum possible guest RAM, which can lead to
a huge waste of space if the guest never actually expends to that maximum
size.

This patch advertises the guest's support for HPT resizing via the
ibm,client-architecture-support OF interface. We use bit 5 of byte 6 of
option vector 5 for this purpose, as defined in the PAPR ACR "HPT
resizing option".

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Reviewed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(back ported from commit 0de0fb09bbce1e1635a0d4c4781af6ec8cbfdb81)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
arch/powerpc/include/asm/prom.h

7 years agopowerpc/64: Enable use of radix MMU under hypervisor on POWER9
Paul Mackerras [Mon, 30 Jan 2017 10:21:36 +0000 (21:21 +1100)]
powerpc/64: Enable use of radix MMU under hypervisor on POWER9

BugLink: http://bugs.launchpad.net/bugs/1670315
To use radix as a guest, we first need to tell the hypervisor via
the ibm,client-architecture call first that we support POWER9 and
architecture v3.00, and that we can do either radix or hash and
that we would like to choose later using an hcall (the
H_REGISTER_PROC_TBL hcall).

Then we need to check whether the hypervisor agreed to us using
radix.  We need to do this very early on in the kernel boot process
before any of the MMU initialization is done.  If the hypervisor
doesn't agree, we can't use radix and therefore clear the radix
MMU feature bit.

Later, when we have set up our process table, which points to the
radix tree for each process, we need to install that using the
H_REGISTER_PROC_TBL hcall.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit cc3d2940133d24000e2866b21e03ce32adfead0a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/pseries: Fixes for the "ibm,architecture-vec-5" options
Paul Mackerras [Mon, 30 Jan 2017 10:21:35 +0000 (21:21 +1100)]
powerpc/pseries: Fixes for the "ibm,architecture-vec-5" options

BugLink: http://bugs.launchpad.net/bugs/1670315
This fixes the byte index values for some of the option bits in
the "ibm,architectur-vec-5" property. The "platform facilities options"
bits are in byte 17 not byte 14, so the upper 8 bits of their
definitions need to be 0x11 not 0x0E. The "sub processor support" option
is in byte 21 not byte 15.

Note none of these options are actually looked up in
"ibm,architecture-vec-5" at this time, so there is no bug.

When checking whether option bits are set, we should check that
the offset of the byte being checked is less than the vector
length that we got from the hypervisor.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 3f4ab2f83b4e443c66549206eb88a9fa5a85d647)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/64: Don't try to use radix MMU under a hypervisor
Paul Mackerras [Mon, 30 Jan 2017 10:21:34 +0000 (21:21 +1100)]
powerpc/64: Don't try to use radix MMU under a hypervisor

BugLink: http://bugs.launchpad.net/bugs/1670315
Currently, if the kernel is running on a POWER9 processor under a
hypervisor, it will try to use the radix MMU even though it doesn't have
the necessary code to use radix under a hypervisor (it doesn't negotiate
use of radix, and it doesn't do the H_REGISTER_PROC_TBL hcall). The
result is that the guest kernel will crash when it tries to turn on the
MMU.

This fixes it by looking for the /chosen/ibm,architecture-vec-5
property, and if it exists, clears the radix MMU feature bit, before we
decide whether to initialize for radix or HPT. This property is created
by the hypervisor as a result of the guest calling the
ibm,client-architecture-support method to indicate its capabilities, so
it will indicate whether the hypervisor agreed to us using radix.

Systems without a hypervisor may have this property also (for example,
skiboot creates it), so we check the HV bit in the MSR to see whether we
are running as a guest or not. If we are in hypervisor mode, then we can
do whatever we like including using the radix MMU.

The reason for using this property is that in future, when we have
support for using radix under a hypervisor, we will need to check this
property to see whether the hypervisor agreed to us using radix.

Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 18569c1f134e1c5c88228f043c09678ae6052b7c)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: [Debian] Don't attempt to sign files if CONFIG_MODULE_SIG=n
Tim Gardner [Mon, 6 Mar 2017 16:55:08 +0000 (09:55 -0700)]
UBUNTU: [Debian] Don't attempt to sign files if CONFIG_MODULE_SIG=n

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: ubuntu: vbox -- Update to 5.1.14-dfsg-3
Seth Forshee [Mon, 6 Mar 2017 15:59:29 +0000 (09:59 -0600)]
UBUNTU: ubuntu: vbox -- Update to 5.1.14-dfsg-3

BugLink: http://bugs.launchpad.net/bugs/1669807
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] CONFIG_CRYPTO_DEV_VMX=y
Seth Forshee [Mon, 6 Mar 2017 13:58:31 +0000 (07:58 -0600)]
UBUNTU: [Config] CONFIG_CRYPTO_DEV_VMX=y

BugLink: http://bugs.launchpad.net/bugs/1666483
We now have fixes for the regressions in 4.10 which necessitated
disabling of this option, so turn it back on.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agocrypto: vmx - Use skcipher for xts fallback
Paulo Flabiano Smorigo [Wed, 1 Mar 2017 14:00:00 +0000 (11:00 -0300)]
crypto: vmx - Use skcipher for xts fallback

BugLink: http://bugs.launchpad.net/bugs/1666483
Cc: stable@vger.kernel.org #4.10
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 5839f555fa576be57371686265206398d9ea1480)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agocrypto: vmx - Use skcipher for cbc fallback
Paulo Flabiano Smorigo [Wed, 1 Mar 2017 13:58:20 +0000 (10:58 -0300)]
crypto: vmx - Use skcipher for cbc fallback

BugLink: http://bugs.launchpad.net/bugs/1666483
Cc: stable@vger.kernel.org #4.10
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit c96d0a1c47abd5c4fa544dcedb5fac4d020ac58b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: apparmor: fix not handling error case when securityfs_pin_fs...
Tim Gardner [Mon, 6 Mar 2017 13:28:54 +0000 (06:28 -0700)]
Revert "UBUNTU: SAUCE: apparmor: fix not handling error case when securityfs_pin_fs() fails"

BugLink: http://bugs.launchpad.net/bugs/1669611
This reverts commit 806f146856b3281d9d92bdd707a1c5ef382f0661.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: apparmor: fix reference count leak when securityfs_setup_d_ino...
Tim Gardner [Mon, 6 Mar 2017 13:28:44 +0000 (06:28 -0700)]
Revert "UBUNTU: SAUCE: apparmor: fix reference count leak when securityfs_setup_d_inode() fails"

BugLink: http://bugs.launchpad.net/bugs/1669611
This reverts commit 090d374d7300e7d59fb32f1707a5622acad1ab80.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: apparmor: fix leak on securityfs pin count"
Tim Gardner [Mon, 6 Mar 2017 13:28:35 +0000 (06:28 -0700)]
Revert "UBUNTU: SAUCE: apparmor: fix leak on securityfs pin count"

BugLink: http://bugs.launchpad.net/bugs/1669611
This reverts commit 994ebf6f98a62b97bc0ff73969e801c01c8ca6b5.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: apparmor: fix lock ordering for mkdir"
Tim Gardner [Mon, 6 Mar 2017 13:28:22 +0000 (06:28 -0700)]
Revert "UBUNTU: SAUCE: apparmor: fix lock ordering for mkdir"

BugLink: http://bugs.launchpad.net/bugs/1669611
This reverts commit 21c9d3b055706c4b0240e2b9ad88629878e46c83.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopowerpc/optprobes: Fix TOC handling in optprobes trampoline
Naveen N. Rao [Tue, 21 Feb 2017 15:00:47 +0000 (20:30 +0530)]
powerpc/optprobes: Fix TOC handling in optprobes trampoline

BugLink: http://bugs.launchpad.net/bugs/1585741
Optprobes on powerpc are limited to kernel text area. We decided to also
optimize kretprobe_trampoline since that is also in kernel text area.
However,we failed to take into consideration the fact that the same
trampoline is also used to catch function returns from kernel modules.
As an example:

  $ sudo modprobe kobject-example
  $ sudo bash -c "echo 'r foo_show+8' > /sys/kernel/debug/tracing/kprobe_events"
  $ sudo bash -c "echo 1 > /sys/kernel/debug/tracing/events/kprobes/enable"
  $ sudo cat /sys/kernel/debug/kprobes/list
  c000000000041350  k  kretprobe_trampoline+0x0    [OPTIMIZED]
  d000000000e00200  r  foo_show+0x8  kobject_example
  $ cat /sys/kernel/kobject_example/foo
  Segmentation fault

With the below (trimmed) splat in dmesg:

  Unable to handle kernel paging request for data at address 0xfec40000
  Faulting instruction address: 0xc000000000041540
  Oops: Kernel access of bad area, sig: 11 [#1]
  ...
  NIP [c000000000041540] optimized_callback+0x70/0xe0
  LR [c000000000041e60] optinsn_slot+0xf8/0x10000
  Call Trace:
  [c0000000c7327850] [c000000000289af4] alloc_set_pte+0x1c4/0x860 (unreliable)
  [c0000000c7327890] [c000000000041e60] optinsn_slot+0xf8/0x10000
  --- interrupt: 700 at 0xc0000000c7327a80
       LR = kretprobe_trampoline+0x0/0x10
  [c0000000c7327ba0] [c0000000003a30d4] sysfs_kf_seq_show+0x104/0x1d0
  [c0000000c7327bf0] [c0000000003a0bb4] kernfs_seq_show+0x44/0x60
  [c0000000c7327c10] [c000000000330578] seq_read+0xf8/0x560
  [c0000000c7327cb0] [c0000000003a1e64] kernfs_fop_read+0x194/0x260
  [c0000000c7327d00] [c0000000002f9954] __vfs_read+0x44/0x1a0
  [c0000000c7327d90] [c0000000002fb4cc] vfs_read+0xbc/0x1b0
  [c0000000c7327de0] [c0000000002fd138] SyS_read+0x68/0x110
  [c0000000c7327e30] [c00000000000b8e0] system_call+0x38/0xfc

Fix this by loading up the kernel TOC before calling into the kernel.
The original TOC gets restored as part of the usual pt_regs restore.

Fixes: 762df10bad69 ("powerpc/kprobes: Optimize kprobe in kretprobe_trampoline()")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit f558b37bf4c35a54e1949f6533f39c64091bf60d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: SAUCE: mm/cgroup: avoid panic when init with low memory
Laurent Dufour [Thu, 23 Feb 2017 13:36:38 +0000 (14:36 +0100)]
UBUNTU: SAUCE: mm/cgroup: avoid panic when init with low memory

BugLink: http://bugs.launchpad.net/bugs/1665113
https://patchwork.kernel.org/patch/9588337/

The system may panic when initialisation is done when almost all the
memory is assigned to the huge pages using the kernel command line
parameter hugepage=xxxx. Panic may occur like this:

[    0.082289] Unable to handle kernel paging request for data at address 0x00000000
[    0.082338] Faulting instruction address: 0xc000000000302b88
[    0.082377] Oops: Kernel access of bad area, sig: 11 [#1]
[    0.082408] SMP NR_CPUS=2048 [    0.082424] NUMA
[    0.082440] pSeries
[    0.082457] Modules linked in:
[    0.082490] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-15-generic #16-Ubuntu
[    0.082536] task: c00000021ed01600 task.stack: c00000010d108000
[    0.082575] NIP: c000000000302b88 LR: c000000000270e04 CTR: c00000000016cfd0
[    0.082621] REGS: c00000010d10b2c0 TRAP: 0300   Not tainted (4.9.0-15-generic)
[    0.082666] MSR: 8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE>[ 0.082770]   CR: 28424422  XER: 00000000
[    0.082793] CFAR: c0000000003d28b8 DAR: 0000000000000000 DSISR: 40000000 SOFTE: 1
GPR00: c000000000270e04 c00000010d10b540 c00000000141a300 c00000010fff6300
GPR04: 0000000000000000 00000000026012c0 c00000010d10b630 0000000487ab0000
GPR08: 000000010ee90000 c000000001454fd8 0000000000000000 0000000000000000
GPR12: 0000000000004400 c00000000fb80000 00000000026012c0 00000000026012c0
GPR16: 00000000026012c0 0000000000000000 0000000000000000 0000000000000002
GPR20: 000000000000000c 0000000000000000 0000000000000000 00000000024200c0
GPR24: c0000000016eef48 0000000000000000 c00000010fff7d00 00000000026012c0
GPR28: 0000000000000000 c00000010fff7d00 c00000010fff6300 c00000010d10b6d0
NIP [c000000000302b88] mem_cgroup_soft_limit_reclaim+0xf8/0x4f0
[    0.083456] LR [c000000000270e04] do_try_to_free_pages+0x1b4/0x450
[    0.083494] Call Trace:
[    0.083511] [c00000010d10b540] [c00000010d10b640] 0xc00000010d10b640 (unreliable)
[    0.083567] [c00000010d10b610] [c000000000270e04] do_try_to_free_pages+0x1b4/0x450
[    0.083622] [c00000010d10b6b0] [c000000000271198] try_to_free_pages+0xf8/0x270
[    0.083676] [c00000010d10b740] [c000000000259dd8] __alloc_pages_nodemask+0x7a8/0xff0
[    0.083729] [c00000010d10b960] [c0000000002dd274] new_slab+0x104/0x8e0
[    0.083776] [c00000010d10ba40] [c0000000002e03d0] ___slab_alloc+0x620/0x700
[    0.083822] [c00000010d10bb70] [c0000000002e04e4] __slab_alloc+0x34/0x60
[    0.083868] [c00000010d10bba0] [c0000000002e101c] kmem_cache_alloc_node_trace+0xdc/0x310
[    0.083947] [c00000010d10bc00] [c000000000eb8120] mem_cgroup_init+0x158/0x1c8
[    0.083994] [c00000010d10bc40] [c00000000000dde8] do_one_initcall+0x68/0x1d0
[    0.084041] [c00000010d10bd00] [c000000000e84184] kernel_init_freeable+0x278/0x360
[    0.084094] [c00000010d10bdc0] [c00000000000e714] kernel_init+0x24/0x170
[    0.084143] [c00000010d10be30] [c00000000000c0e8] ret_from_kernel_thread+0x5c/0x74
[    0.084195] Instruction dump:
[    0.084220] eb81ffe0 eba1ffe8 ebc1fff0 ebe1fff8 4e800020 3d230001 e9499a42 3d220004
[    0.084300] 3929acd8 794a1f24 7d295214 eac90100 <e93600002fa90000 419eff74 3b200000
[    0.084382] ---[ end trace 342f5208b00d01b6 ]---

This is a chicken and egg issue where the kernel try to get free
memory when allocating per node data in mem_cgroup_init(), but in that
path mem_cgroup_soft_limit_reclaim() is called which assumes that
these data are allocated.

As mem_cgroup_soft_limit_reclaim() is best effort, it should return
when these data are not yet allocated.

This patch also fixes potential null pointer access in
mem_cgroup_remove_from_trees() and mem_cgroup_update_tree().

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: SAUCE: bcache: Fix bcache device names
Stefan Bader [Thu, 2 Mar 2017 14:38:24 +0000 (15:38 +0100)]
UBUNTU: SAUCE: bcache: Fix bcache device names

I have sent this to upstream (got an ack already) but might be good
to carry as SAUCE until it tickles back.

-Stefan

From 4a5ec18f2bec04cebb0cd5f7ab2a2999b86b7de5 Mon Sep 17 00:00:00 2001
From: Stefan Bader <stefan.bader@canonical.com>
Date: Wed, 1 Mar 2017 11:28:07 +0100
Subject: [PATCH] UBUNTU: SAUCE: bcache: Fix bcache device names

When adding partition support to bcache, the name assignment was not
updated, resulting in numbers jumping (bcache0, bcache16, bcache32...).
Fix this by taking BCACHE_MINORS into account when assigning the disk
name.

BugLink: https://bugs.launchpad.net/bugs/1667078
Fixes: b8c0d91 (bcache: partition support: add 16 minors per bcacheN device)
Cc: <stable@vger.kernel.org> # v4.10
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoperf/x86/intel/pt: Add format strings for PTWRITE and power event tracing
Alexander Shishkin [Fri, 27 Jan 2017 15:16:43 +0000 (17:16 +0200)]
perf/x86/intel/pt: Add format strings for PTWRITE and power event tracing

BugLink: http://bugs.launchpad.net/bugs/1645962
Commit:

  8ee83b2ab3 ("perf/x86/intel/pt: Add support for PTWRITE and power event tracing")

forgot to add format strings to the PT driver. So one could enable these features
by setting corresponding bits in the event config, but not by their mnemonic names.

This patch adds the format strings.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: vince@deater.net
Fixes: 8ee83b2ab3 ("perf/x86/intel/pt: Add support for PTWRITE...")
Link: http://lkml.kernel.org/r/20170127151644.8585-2-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 5443624bedd0d23e112d5f2a919435182875bce9)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: mbigen: Add ACPI support
Hanjun Guo [Wed, 18 Jan 2017 12:55:05 +0000 (20:55 +0800)]
UBUNTU: SAUCE: irqchip: mbigen: Add ACPI support

With the preparation of platform msi support and interrupt producer
in DSDT, we can add mbigen ACPI support now.

We are using Interrupt resource type in _CRS methd to indicate number
of irq pins instead of num_pins in DT to avoid _DSD usage in this case.

For mbigen,
    Device(MBI0) {
          Name(_HID, "HISI0152")
          Name(_UID, Zero)
          Name(_CRS, ResourceTemplate() {
                  Memory32Fixed(ReadWrite, 0xa0080000, 0x10000)
  Interrupt(ResourceProducer,...) {12,14,....}
          })
    }

For devices,
   Device(COM0) {
          Name(_HID, "ACPIIDxx")
          Name(_UID, Zero)
          Name(_CRS, ResourceTemplate() {
                 Memory32Fixed(ReadWrite, 0xb0030000, 0x10000)
 Interrupt(ResourceConsumer,..., "\_SB.MBI0") {12}
          })
    }

With the help of platform msi and interrupt producer, then devices
will get the virq from mbigen's irqdomain.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Ma Jun <majun258@huawei.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555496.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: mbigen: introduce mbigen_of_create_domain()
Kefeng Wang [Wed, 18 Jan 2017 12:55:04 +0000 (20:55 +0800)]
UBUNTU: SAUCE: irqchip: mbigen: introduce mbigen_of_create_domain()

Introduce mbigen_of_create_domain() to consolidate OF related
code and prepare for ACPI later, no funtional change.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Ma Jun <majun258@huawei.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555522.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: mbigen: drop module owner
Kefeng Wang [Wed, 18 Jan 2017 12:55:03 +0000 (20:55 +0800)]
UBUNTU: SAUCE: irqchip: mbigen: drop module owner

Module owner will be set by driver core, so drop it.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Ma Jun <majun258@huawei.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555497.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: msi: platform: make platform_msi_create_device_domain() ACPI aware
Hanjun Guo [Wed, 18 Jan 2017 12:55:02 +0000 (20:55 +0800)]
UBUNTU: SAUCE: msi: platform: make platform_msi_create_device_domain() ACPI aware

The irqdomain creation is carried out in:

platform_msi_create_device_domain()

relies on the fwnode_handle interrupt controller token to associate the
interrupt controller with a specific irqdomain. Current code relies on
the OF layer to retrieve a fwnode_handle for the device representing the
interrupt controller from its device->of_node pointer.  This makes
platform_msi_create_device_domain() DT specific whilst it really is not
because after the merge of commit f94277af03ea ("of/platform: Initialise
dev->fwnode appropriately") the fwnode_handle can easily be retrieved
from the dev->fwnode pointer in a firmware agnostic way.

Update platform_msi_create_device_domain() to retrieve the interrupt
controller fwnode_handle from the dev->fwnode pointer so that it can
be used seamlessly in ACPI and DT systems.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg KH <gregkh@linuxfoundation.org>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555489.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: ACPI: platform: setup MSI domain for ACPI based platform device
Hanjun Guo [Wed, 18 Jan 2017 12:55:01 +0000 (20:55 +0800)]
UBUNTU: SAUCE: ACPI: platform: setup MSI domain for ACPI based platform device

With the platform msi domain created, we can set up the msi domain
for a platform device when it's probed.

In order to do that, we need to get the domain that the platform
device connecting to, so the iort_get_platform_device_domain() is
introduced to retrieve the domain from iort.

After the domain is retrieved, we need a proper way to set the
domain to paltform device, as some platform devices such as an
irqchip needs the msi irqdomain to be the interrupt parent domain,
we need to get irqdomain before platform device is probed but after
the platform device is allocated (the time slot of setting the
msi domain also works for other cases). So simply call
acpi_configure_pmsi_domain() in acpi_platform_notify() for
platform devices will work.

Acked-by: Rafael J. Wysocki <rafael@kernel.org> [for glue.c]
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555559.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: ACPI: platform-msi: retrieve dev id from IORT
Hanjun Guo [Wed, 18 Jan 2017 12:55:00 +0000 (20:55 +0800)]
UBUNTU: SAUCE: ACPI: platform-msi: retrieve dev id from IORT

For devices connecting to ITS, it needs dev id to identify itself, and
this dev id is represented in the IORT table in named component node
[1] for platform devices, so in this patch we will scan the IORT to
retrieve device's dev id.

With the preparation of iort_node_map_platform_id(), a new API
iort_pmsi_get_dev_id() is introduced for that purpose, call it in
its_pmsi_prepare() to make retrieving dev id ACPI aware.

[1]: https://static.docs.arm.com/den0049/b/DEN0049B_IO_Remapping_Table.pdf

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555514.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: ACPI: IORT: introduce iort_node_map_platform_id() to retrieve dev id
Hanjun Guo [Wed, 18 Jan 2017 12:54:59 +0000 (20:54 +0800)]
UBUNTU: SAUCE: ACPI: IORT: introduce iort_node_map_platform_id() to retrieve dev id

For named components if we want to retrieve the dev id, we know that
there are always two steps involved (second is optional):

(1) Retrieve the initial id (this may well provide the final mapping)
(2) Map the id (optional if (1) represents the map type we need), this
    is needed for use cases such as NC (named component) -> SMMU -> ITS
    mappings.

we have API iort_node_get_id() for step (1) above and iort_node_map_rid()
for step (2), so create a wrapper iort_node_map_platform_id() to
retrieve the dev id.

iort_node_map_platform_id() will handle the parent type so type handing
in iort_node_get_id() is duplicate, remove it and update current
iort_node_get_id() users to move them over to iort_node_map_platform_id().

Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Suggested-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555513.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: ACPI: IORT: rename iort_node_map_rid() to make it generic
Hanjun Guo [Wed, 18 Jan 2017 12:54:58 +0000 (20:54 +0800)]
UBUNTU: SAUCE: ACPI: IORT: rename iort_node_map_rid() to make it generic

iort_node_map_rid() was designed to take an input id (that is not
necessarily a PCI requester id) and map it to an output id (eg an SMMU
streamid or an ITS deviceid) according to the mappings provided by an
IORT node mapping entries. This means that the iort_node_map_rid() input
id is not always a PCI requester id as its name, parameters and local
variables suggest, which is misleading.

Apply the s/rid/id substitution to the iort_node_map_rid() mapping
function and its users to make sure its intended usage is clearer.

Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555527.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: scan MADT to create platform msi...
Hanjun Guo [Wed, 18 Jan 2017 12:54:57 +0000 (20:54 +0800)]
UBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: scan MADT to create platform msi domain

With the introduction of its_pmsi_init_one(), we can add some code
on top for ACPI support of platform MSI.

We are scanning the MADT table to get the ITS entry(ies), then use
the information to create the platform msi domain for devices connect
to it, just like the PCI MSI for ITS did.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555500.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare...
Hanjun Guo [Wed, 18 Jan 2017 12:54:56 +0000 (20:54 +0800)]
UBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI

Introduce its_pmsi_init_one() to refactor the code to isolate
ACPI&DT common code to prepare for ACPI later.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555502.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare()
Hanjun Guo [Wed, 18 Jan 2017 12:54:55 +0000 (20:54 +0800)]
UBUNTU: SAUCE: irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare()

Adding ACPI support for platform MSI, we need to retrieve the
dev id in ACPI way instead of device tree, we already have
a well formed function its_pmsi_prepare() to get the dev id
but it's OF dependent, so collect OF related code and put them
into a single function to make its_pmsi_prepare() more friendly
to ACPI later.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555502.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: irqchip: gic-v3-its: keep the head file include in alphabetic order
Hanjun Guo [Wed, 18 Jan 2017 12:54:54 +0000 (20:54 +0800)]
UBUNTU: SAUCE: irqchip: gic-v3-its: keep the head file include in alphabetic order

Rearrange header file includes to alphabetic order. As acpi_iort.h
includes acpi.h so remove the duplidate acpi.h inclusion as well.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555494.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: ACPI: IORT: minor cleanup for iort_match_node_callback()
Hanjun Guo [Wed, 18 Jan 2017 12:54:53 +0000 (20:54 +0800)]
UBUNTU: SAUCE: ACPI: IORT: minor cleanup for iort_match_node_callback()

Cleanup iort_match_node_callback() a little bit to reduce
some lines of code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>
[v8 submission from:
 https://www.spinics.net/lists/arm-kernel/msg555499.html ]
BugLink: http://bugs.launchpad.net/bugs/1669061
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>