mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-10 19:47:12 +00:00
- Optimise radix KVM guest entry/exit by 2x on Power9/Power10.
- Allow firmware to tell us whether to disable the entry and uaccess flushes on Power10
or later CPUs.
- Add BPF_PROBE_MEM support for 32 and 64-bit BPF jits.
- Several fixes and improvements to our hard lockup watchdog.
- Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on 32-bit.
- Allow building the 64-bit Book3S kernel without hash MMU support, ie. Radix only.
- Add KUAP (SMAP) support for 40x, 44x, 8xx, Book3E (64-bit).
- Add new encodings for perf_mem_data_src.mem_hops field, and use them on Power10.
- A series of small performance improvements to 64-bit interrupt entry.
- Several commits fixing issues when building with the clang integrated assembler.
- Many other small features and fixes.
Thanks to: Alan Modra, Alexey Kardashevskiy, Ammar Faizi, Anders Roxell, Arnd Bergmann,
Athira Rajeev, Cédric Le Goater, Christophe JAILLET, Christophe Leroy, Christoph Hellwig,
Daniel Axtens, David Yang, Erhard Furtner, Fabiano Rosas, Greg Kroah-Hartman, Guo Ren,
Hari Bathini, Jason Wang, Joel Stanley, Julia Lawall, Kajol Jain, Kees Cook, Laurent
Dufour, Madhavan Srinivasan, Mark Brown, Minghao Chi, Nageswara R Sastry, Naresh Kamboju,
Nathan Chancellor, Nathan Lynch, Nicholas Piggin, Nick Child, Oliver O'Halloran, Peiwei
Hu, Randy Dunlap, Ravi Bangoria, Rob Herring, Russell Currey, Sachin Sant, Sean
Christopherson, Segher Boessenkool, Thadeu Lima de Souza Cascardo, Tyrel Datwyler, Xiang
wangx, Yang Guang.
-----BEGIN PGP SIGNATURE-----
iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmHhVFMTHG1wZUBlbGxl
cm1hbi5pZC5hdQAKCRBR6+o8yOGlgKwzD/9UUEZzWyzMVRJvP9FPZByN2M8czxHJ
tuqEuVqnfks8ad8tfm2ebng5t8ZuVASBQU2fpPA1+lpdvprgZN5RFGMRh729vskn
2aHQPmFvFObNbXOgCoXzk+C5xYi3zoRMVM968neSPBneYo+xDicn/zN5CHAgsjhX
+baemJQ7/xzwLiZgTHe8fWw3nTk3IbPBpha59SdTvR8Moy6I4O8CDPIYEm3U3/J3
x14ZRETqjksL7YOzEBk0avm1dDZRw/johz29oRYSmCj7dyy5OqrkPwokJiRY90eA
1lVdofDc0zElaSWkVGzKdSWRUIXjKIVdtejvDeEvl6H/mI6q4TVZE8rFmn+3Rvgf
9q0iKtmw5Kn11cqgY/pgEGmxnQtIdAodNfI/t939E7+O5LbcznuYUiy0J/kTD/vl
Xduotg2dsCI+5ukf1wrk2wt9LhqZL+ziOeaBhyDM4orV8T3HBYL6zWBptun//IGO
lK6TvvCHSYnGqY4bnrAmiOnbbEtnP6nN3zbcXgSvPM0wCRHPIEqd0NRXtfISo32d
vBPq1neXWo4wrRJj9X3yOuP+5fEA4I+hB3yrCJOkcEcz+8NhlboQXU7raVsJL+bd
kze75H8hwX7kE71oJFFl13LbSNABgiLFARTBXKfvdQA2iLdR0Snvm+OouvwWRPo/
Po7Nm3zqdLc/1A==
=BxhQ
-----END PGP SIGNATURE-----
Merge tag 'powerpc-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman:
- Optimise radix KVM guest entry/exit by 2x on Power9/Power10.
- Allow firmware to tell us whether to disable the entry and uaccess
flushes on Power10 or later CPUs.
- Add BPF_PROBE_MEM support for 32 and 64-bit BPF jits.
- Several fixes and improvements to our hard lockup watchdog.
- Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on 32-bit.
- Allow building the 64-bit Book3S kernel without hash MMU support, ie.
Radix only.
- Add KUAP (SMAP) support for 40x, 44x, 8xx, Book3E (64-bit).
- Add new encodings for perf_mem_data_src.mem_hops field, and use them
on Power10.
- A series of small performance improvements to 64-bit interrupt entry.
- Several commits fixing issues when building with the clang integrated
assembler.
- Many other small features and fixes.
Thanks to Alan Modra, Alexey Kardashevskiy, Ammar Faizi, Anders Roxell,
Arnd Bergmann, Athira Rajeev, Cédric Le Goater, Christophe JAILLET,
Christophe Leroy, Christoph Hellwig, Daniel Axtens, David Yang, Erhard
Furtner, Fabiano Rosas, Greg Kroah-Hartman, Guo Ren, Hari Bathini, Jason
Wang, Joel Stanley, Julia Lawall, Kajol Jain, Kees Cook, Laurent Dufour,
Madhavan Srinivasan, Mark Brown, Minghao Chi, Nageswara R Sastry, Naresh
Kamboju, Nathan Chancellor, Nathan Lynch, Nicholas Piggin, Nick Child,
Oliver O'Halloran, Peiwei Hu, Randy Dunlap, Ravi Bangoria, Rob Herring,
Russell Currey, Sachin Sant, Sean Christopherson, Segher Boessenkool,
Thadeu Lima de Souza Cascardo, Tyrel Datwyler, Xiang wangx, and Yang
Guang.
* tag 'powerpc-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (240 commits)
powerpc/xmon: Dump XIVE information for online-only processors.
powerpc/opal: use default_groups in kobj_type
powerpc/cacheinfo: use default_groups in kobj_type
powerpc/sched: Remove unused TASK_SIZE_OF
powerpc/xive: Add missing null check after calling kmalloc
powerpc/floppy: Remove usage of the deprecated "pci-dma-compat.h" API
selftests/powerpc: Add a test of sigreturning to an unaligned address
powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings
powerpc/64s: Mask NIP before checking against SRR0
powerpc/perf: Fix spelling of "its"
powerpc/32: Fix boot failure with GCC latent entropy plugin
powerpc/code-patching: Replace patch_instruction() by ppc_inst_write() in selftests
powerpc/code-patching: Move code patching selftests in its own file
powerpc/code-patching: Move instr_is_branch_{i/b}form() in code-patching.h
powerpc/code-patching: Move patch_exception() outside code-patching.c
powerpc/code-patching: Use test_trampoline for prefixed patch test
powerpc/code-patching: Fix patch_branch() return on out-of-range failure
powerpc/code-patching: Reorganise do_patch_instruction() to ease error handling
powerpc/code-patching: Fix unmap_patch_area() error handling
powerpc/code-patching: Fix error handling in do_patch_instruction()
...
162 lines
4.3 KiB
C
162 lines
4.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright 2007, Olof Johansson, PA Semi
|
|
*
|
|
* Based on arch/powerpc/sysdev/mpic_u3msi.c:
|
|
*
|
|
* Copyright 2006, Segher Boessenkool, IBM Corporation.
|
|
* Copyright 2006-2007, Michael Ellerman, IBM Corporation.
|
|
*/
|
|
|
|
#include <linux/irq.h>
|
|
#include <linux/msi.h>
|
|
#include <asm/mpic.h>
|
|
#include <asm/prom.h>
|
|
#include <asm/hw_irq.h>
|
|
#include <asm/ppc-pci.h>
|
|
#include <asm/msi_bitmap.h>
|
|
|
|
#include <sysdev/mpic.h>
|
|
|
|
/* Allocate 16 interrupts per device, to give an alignment of 16,
|
|
* since that's the size of the grouping w.r.t. affinity. If someone
|
|
* needs more than 32 MSI's down the road we'll have to rethink this,
|
|
* but it should be OK for now.
|
|
*/
|
|
#define ALLOC_CHUNK 16
|
|
|
|
#define PASEMI_MSI_ADDR 0xfc080000
|
|
|
|
/* A bit ugly, can we get this from the pci_dev somehow? */
|
|
static struct mpic *msi_mpic;
|
|
|
|
|
|
static void mpic_pasemi_msi_mask_irq(struct irq_data *data)
|
|
{
|
|
pr_debug("mpic_pasemi_msi_mask_irq %d\n", data->irq);
|
|
pci_msi_mask_irq(data);
|
|
mpic_mask_irq(data);
|
|
}
|
|
|
|
static void mpic_pasemi_msi_unmask_irq(struct irq_data *data)
|
|
{
|
|
pr_debug("mpic_pasemi_msi_unmask_irq %d\n", data->irq);
|
|
mpic_unmask_irq(data);
|
|
pci_msi_unmask_irq(data);
|
|
}
|
|
|
|
static struct irq_chip mpic_pasemi_msi_chip = {
|
|
.irq_shutdown = mpic_pasemi_msi_mask_irq,
|
|
.irq_mask = mpic_pasemi_msi_mask_irq,
|
|
.irq_unmask = mpic_pasemi_msi_unmask_irq,
|
|
.irq_eoi = mpic_end_irq,
|
|
.irq_set_type = mpic_set_irq_type,
|
|
.irq_set_affinity = mpic_set_affinity,
|
|
.name = "PASEMI-MSI",
|
|
};
|
|
|
|
static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
|
|
{
|
|
struct msi_desc *entry;
|
|
irq_hw_number_t hwirq;
|
|
|
|
pr_debug("pasemi_msi_teardown_msi_irqs, pdev %p\n", pdev);
|
|
|
|
msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) {
|
|
hwirq = virq_to_hw(entry->irq);
|
|
irq_set_msi_desc(entry->irq, NULL);
|
|
irq_dispose_mapping(entry->irq);
|
|
msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, ALLOC_CHUNK);
|
|
}
|
|
}
|
|
|
|
static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
|
|
{
|
|
unsigned int virq;
|
|
struct msi_desc *entry;
|
|
struct msi_msg msg;
|
|
int hwirq;
|
|
|
|
if (type == PCI_CAP_ID_MSIX)
|
|
pr_debug("pasemi_msi: MSI-X untested, trying anyway\n");
|
|
pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
|
|
pdev, nvec, type);
|
|
|
|
msg.address_hi = 0;
|
|
msg.address_lo = PASEMI_MSI_ADDR;
|
|
|
|
msi_for_each_desc(entry, &pdev->dev, MSI_DESC_NOTASSOCIATED) {
|
|
/* Allocate 16 interrupts for now, since that's the grouping for
|
|
* affinity. This can be changed later if it turns out 32 is too
|
|
* few MSIs for someone, but restrictions will apply to how the
|
|
* sources can be changed independently.
|
|
*/
|
|
hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap,
|
|
ALLOC_CHUNK);
|
|
if (hwirq < 0) {
|
|
pr_debug("pasemi_msi: failed allocating hwirq\n");
|
|
return hwirq;
|
|
}
|
|
|
|
virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
|
|
if (!virq) {
|
|
pr_debug("pasemi_msi: failed mapping hwirq 0x%x\n",
|
|
hwirq);
|
|
msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq,
|
|
ALLOC_CHUNK);
|
|
return -ENOSPC;
|
|
}
|
|
|
|
/* Vector on MSI is really an offset, the hardware adds
|
|
* it to the value written at the magic address. So set
|
|
* it to 0 to remain sane.
|
|
*/
|
|
mpic_set_vector(virq, 0);
|
|
|
|
irq_set_msi_desc(virq, entry);
|
|
irq_set_chip(virq, &mpic_pasemi_msi_chip);
|
|
irq_set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
|
|
|
|
pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%x) " \
|
|
"addr 0x%x\n", virq, hwirq, msg.address_lo);
|
|
|
|
/* Likewise, the device writes [0...511] into the target
|
|
* register to generate MSI [512...1023]
|
|
*/
|
|
msg.data = hwirq-0x200;
|
|
pci_write_msi_msg(virq, &msg);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int __init mpic_pasemi_msi_init(struct mpic *mpic)
|
|
{
|
|
int rc;
|
|
struct pci_controller *phb;
|
|
struct device_node *of_node;
|
|
|
|
of_node = irq_domain_get_of_node(mpic->irqhost);
|
|
if (!of_node ||
|
|
!of_device_is_compatible(of_node,
|
|
"pasemi,pwrficient-openpic"))
|
|
return -ENODEV;
|
|
|
|
rc = mpic_msi_init_allocator(mpic);
|
|
if (rc) {
|
|
pr_debug("pasemi_msi: Error allocating bitmap!\n");
|
|
return rc;
|
|
}
|
|
|
|
pr_debug("pasemi_msi: Registering PA Semi MPIC MSI callbacks\n");
|
|
|
|
msi_mpic = mpic;
|
|
list_for_each_entry(phb, &hose_list, list_node) {
|
|
WARN_ON(phb->controller_ops.setup_msi_irqs);
|
|
phb->controller_ops.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
|
|
phb->controller_ops.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
|
|
}
|
|
|
|
return 0;
|
|
}
|