mirror of
https://github.com/torvalds/linux.git
synced 2025-11-06 19:50:24 +02:00
Highlights include:
- Support for the kexec_file_load() syscall, which is a prereq for secure and
trusted boot.
- Prevent kernel execution of userspace on P9 Radix (similar to SMEP/PXN).
- Sort the exception tables at build time, to save time at boot, and store
them as relative offsets to save space in the kernel image & memory.
- Allow building the kernel with thin archives, which should allow us to build
an allyesconfig once some other fixes land.
- Build fixes to allow us to correctly rebuild when changing the kernel endian
from big to little or vice versa.
- Plumbing so that we can avoid doing a full mm TLB flush on P9 Radix.
- Initial stack protector support (-fstack-protector).
- Support for dumping the radix (aka. Linux) and hash page tables via debugfs.
- Fix an oops in cxl coredump generation when cxl_get_fd() is used.
- Freescale updates from Scott: "Highlights include 8xx hugepage support,
qbman fixes/cleanup, device tree updates, and some misc cleanup."
- Many and varied fixes and minor enhancements as always.
Thanks to:
Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Anshuman Khandual,
Anton Blanchard, Balbir Singh, Bartlomiej Zolnierkiewicz, Christophe Jaillet,
Christophe Leroy, Denis Kirjanov, Elimar Riesebieter, Frederic Barrat,
Gautham R. Shenoy, Geliang Tang, Geoff Levand, Jack Miller, Johan Hovold,
Lars-Peter Clausen, Libin, Madhavan Srinivasan, Michael Neuling, Nathan
Fontenot, Naveen N. Rao, Nicholas Piggin, Pan Xinhui, Peter Senna Tschudin,
Rashmica Gupta, Rui Teng, Russell Currey, Scott Wood, Simon Guo, Suraj
Jitindar Singh, Thiago Jung Bauermann, Tobias Klauser, Vaibhav Jain.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJYU4YSAAoJEFHr6jzI4aWAC4gQALtIAqqPon0Cd5b/FVVcMbW7
mMqB2b/0FGEl5GoRTzGUDaQqElilm6AEVfHO86C7DFji/a6olneFfw87iz+mtWuZ
JvrNq68ZiSnoeszdUy4MgtXFLb5sTzNMev4skaHfjI9E5CepWBoR0zH4G+kNVnd5
WSgudv8Cq4Px+MEuTOigt3QYjHzZ3cw/XNOOm9c+oGj+PDW4O9UItVI+S1WLoey4
rAB2nRcLMDPuwfRQC9XsF3zEbkv4h1dEXo/EBRuRpcF+0lLTzFw1lv1WE8OxlUmS
kAXbty3dIytBfSbtJT0c0Ps6sfQ4HFhu6ZV2fjnxNTz2KDkBIN7LBYHmBYiqY9oZ
9zvbUWtfiTu5ocfRtTq7rC/Hcj4Kbr9S9F/FvXR0WyDsKgu4xxAovqC3gcn6YjYK
Rr1tcCI4nUzyhVJVmd+OEhUvc5JbFy9aGage+YeOyejfvvSbXIunaxWlPjoDkvim
Vjl+UKU8gw51XFssqY5ZBi/HNlMFKYedLpMFp/fItnLglhj50V0eFWkpDgdSCYom
vo9ifPLZx8n8m8De3H7TV4E0F4gCHcTeqZdu7tW9AAUVM6iLJcDLm3asGmtNh21t
snOHNOJ5QSIno6ezUUg29T6VBjbPh46fdJJSlIZrEe8OzLZ1haGyttf0tD00PQvY
Z2W/m3gxafnOeGgBqvyv
=xOzf
-----END PGP SIGNATURE-----
Merge tag 'powerpc-4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman:
"Highlights include:
- Support for the kexec_file_load() syscall, which is a prereq for
secure and trusted boot.
- Prevent kernel execution of userspace on P9 Radix (similar to
SMEP/PXN).
- Sort the exception tables at build time, to save time at boot, and
store them as relative offsets to save space in the kernel image &
memory.
- Allow building the kernel with thin archives, which should allow us
to build an allyesconfig once some other fixes land.
- Build fixes to allow us to correctly rebuild when changing the
kernel endian from big to little or vice versa.
- Plumbing so that we can avoid doing a full mm TLB flush on P9
Radix.
- Initial stack protector support (-fstack-protector).
- Support for dumping the radix (aka. Linux) and hash page tables via
debugfs.
- Fix an oops in cxl coredump generation when cxl_get_fd() is used.
- Freescale updates from Scott: "Highlights include 8xx hugepage
support, qbman fixes/cleanup, device tree updates, and some misc
cleanup."
- Many and varied fixes and minor enhancements as always.
Thanks to:
Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Anshuman
Khandual, Anton Blanchard, Balbir Singh, Bartlomiej Zolnierkiewicz,
Christophe Jaillet, Christophe Leroy, Denis Kirjanov, Elimar
Riesebieter, Frederic Barrat, Gautham R. Shenoy, Geliang Tang, Geoff
Levand, Jack Miller, Johan Hovold, Lars-Peter Clausen, Libin,
Madhavan Srinivasan, Michael Neuling, Nathan Fontenot, Naveen N.
Rao, Nicholas Piggin, Pan Xinhui, Peter Senna Tschudin, Rashmica
Gupta, Rui Teng, Russell Currey, Scott Wood, Simon Guo, Suraj
Jitindar Singh, Thiago Jung Bauermann, Tobias Klauser, Vaibhav Jain"
[ And thanks to Michael, who took time off from a new baby to get this
pull request done. - Linus ]
* tag 'powerpc-4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (174 commits)
powerpc/fsl/dts: add FMan node for t1042d4rdb
powerpc/fsl/dts: add sg_2500_aqr105_phy4 alias on t1024rdb
powerpc/fsl/dts: add QMan and BMan nodes on t1024
powerpc/fsl/dts: add QMan and BMan nodes on t1023
soc/fsl/qman: test: use DEFINE_SPINLOCK()
powerpc/fsl-lbc: use DEFINE_SPINLOCK()
powerpc/8xx: Implement support of hugepages
powerpc: get hugetlbpage handling more generic
powerpc: port 64 bits pgtable_cache to 32 bits
powerpc/boot: Request no dynamic linker for boot wrapper
soc/fsl/bman: Use resource_size instead of computation
soc/fsl/qe: use builtin_platform_driver
powerpc/fsl_pmc: use builtin_platform_driver
powerpc/83xx/suspend: use builtin_platform_driver
powerpc/ftrace: Fix the comments for ftrace_modify_code
powerpc/perf: macros for power9 format encoding
powerpc/perf: power9 raw event format encoding
powerpc/perf: update attribute_group data structure
powerpc/perf: factor out the event format field
powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown
...
212 lines
5.6 KiB
C
212 lines
5.6 KiB
C
/* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* * Neither the name of Freescale Semiconductor nor the
|
|
* names of its contributors may be used to endorse or promote products
|
|
* derived from this software without specific prior written permission.
|
|
*
|
|
* ALTERNATIVELY, this software may be distributed under the terms of the
|
|
* GNU General Public License ("GPL") as published by the Free Software
|
|
* Foundation, either version 2 of that License or (at your option) any
|
|
* later version.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
#include "bman_priv.h"
|
|
|
|
static struct bman_portal *affine_bportals[NR_CPUS];
|
|
static struct cpumask portal_cpus;
|
|
/* protect bman global registers and global data shared among portals */
|
|
static DEFINE_SPINLOCK(bman_lock);
|
|
|
|
static struct bman_portal *init_pcfg(struct bm_portal_config *pcfg)
|
|
{
|
|
struct bman_portal *p = bman_create_affine_portal(pcfg);
|
|
|
|
if (!p) {
|
|
dev_crit(pcfg->dev, "%s: Portal failure on cpu %d\n",
|
|
__func__, pcfg->cpu);
|
|
return NULL;
|
|
}
|
|
|
|
bman_p_irqsource_add(p, BM_PIRQ_RCRI);
|
|
affine_bportals[pcfg->cpu] = p;
|
|
|
|
dev_info(pcfg->dev, "Portal initialised, cpu %d\n", pcfg->cpu);
|
|
|
|
return p;
|
|
}
|
|
|
|
static int bman_offline_cpu(unsigned int cpu)
|
|
{
|
|
struct bman_portal *p = affine_bportals[cpu];
|
|
const struct bm_portal_config *pcfg;
|
|
|
|
if (!p)
|
|
return 0;
|
|
|
|
pcfg = bman_get_bm_portal_config(p);
|
|
if (!pcfg)
|
|
return 0;
|
|
|
|
irq_set_affinity(pcfg->irq, cpumask_of(0));
|
|
return 0;
|
|
}
|
|
|
|
static int bman_online_cpu(unsigned int cpu)
|
|
{
|
|
struct bman_portal *p = affine_bportals[cpu];
|
|
const struct bm_portal_config *pcfg;
|
|
|
|
if (!p)
|
|
return 0;
|
|
|
|
pcfg = bman_get_bm_portal_config(p);
|
|
if (!pcfg)
|
|
return 0;
|
|
|
|
irq_set_affinity(pcfg->irq, cpumask_of(cpu));
|
|
return 0;
|
|
}
|
|
|
|
static int bman_portal_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct device_node *node = dev->of_node;
|
|
struct bm_portal_config *pcfg;
|
|
struct resource *addr_phys[2];
|
|
void __iomem *va;
|
|
int irq, cpu;
|
|
|
|
pcfg = devm_kmalloc(dev, sizeof(*pcfg), GFP_KERNEL);
|
|
if (!pcfg)
|
|
return -ENOMEM;
|
|
|
|
pcfg->dev = dev;
|
|
|
|
addr_phys[0] = platform_get_resource(pdev, IORESOURCE_MEM,
|
|
DPAA_PORTAL_CE);
|
|
if (!addr_phys[0]) {
|
|
dev_err(dev, "Can't get %s property 'reg::CE'\n",
|
|
node->full_name);
|
|
return -ENXIO;
|
|
}
|
|
|
|
addr_phys[1] = platform_get_resource(pdev, IORESOURCE_MEM,
|
|
DPAA_PORTAL_CI);
|
|
if (!addr_phys[1]) {
|
|
dev_err(dev, "Can't get %s property 'reg::CI'\n",
|
|
node->full_name);
|
|
return -ENXIO;
|
|
}
|
|
|
|
pcfg->cpu = -1;
|
|
|
|
irq = platform_get_irq(pdev, 0);
|
|
if (irq <= 0) {
|
|
dev_err(dev, "Can't get %s IRQ'\n", node->full_name);
|
|
return -ENXIO;
|
|
}
|
|
pcfg->irq = irq;
|
|
|
|
va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
|
|
if (!va) {
|
|
dev_err(dev, "ioremap::CE failed\n");
|
|
goto err_ioremap1;
|
|
}
|
|
|
|
pcfg->addr_virt[DPAA_PORTAL_CE] = va;
|
|
|
|
va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
|
|
_PAGE_GUARDED | _PAGE_NO_CACHE);
|
|
if (!va) {
|
|
dev_err(dev, "ioremap::CI failed\n");
|
|
goto err_ioremap2;
|
|
}
|
|
|
|
pcfg->addr_virt[DPAA_PORTAL_CI] = va;
|
|
|
|
spin_lock(&bman_lock);
|
|
cpu = cpumask_next_zero(-1, &portal_cpus);
|
|
if (cpu >= nr_cpu_ids) {
|
|
/* unassigned portal, skip init */
|
|
spin_unlock(&bman_lock);
|
|
return 0;
|
|
}
|
|
|
|
cpumask_set_cpu(cpu, &portal_cpus);
|
|
spin_unlock(&bman_lock);
|
|
pcfg->cpu = cpu;
|
|
|
|
if (!init_pcfg(pcfg)) {
|
|
dev_err(dev, "portal init failed\n");
|
|
goto err_portal_init;
|
|
}
|
|
|
|
/* clear irq affinity if assigned cpu is offline */
|
|
if (!cpu_online(cpu))
|
|
bman_offline_cpu(cpu);
|
|
|
|
return 0;
|
|
|
|
err_portal_init:
|
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CI]);
|
|
err_ioremap2:
|
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]);
|
|
err_ioremap1:
|
|
return -ENXIO;
|
|
}
|
|
|
|
static const struct of_device_id bman_portal_ids[] = {
|
|
{
|
|
.compatible = "fsl,bman-portal",
|
|
},
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(of, bman_portal_ids);
|
|
|
|
static struct platform_driver bman_portal_driver = {
|
|
.driver = {
|
|
.name = KBUILD_MODNAME,
|
|
.of_match_table = bman_portal_ids,
|
|
},
|
|
.probe = bman_portal_probe,
|
|
};
|
|
|
|
static int __init bman_portal_driver_register(struct platform_driver *drv)
|
|
{
|
|
int ret;
|
|
|
|
ret = platform_driver_register(drv);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
|
|
"soc/qbman_portal:online",
|
|
bman_online_cpu, bman_offline_cpu);
|
|
if (ret < 0) {
|
|
pr_err("bman: failed to register hotplug callbacks.\n");
|
|
platform_driver_unregister(drv);
|
|
return ret;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
module_driver(bman_portal_driver,
|
|
bman_portal_driver_register, platform_driver_unregister);
|