powerpc fixes for 7.3 #2

- Clear TIF_SYSCALL_RET before syscall error return
 
  - Don't drop _TIF_RESTOREALL on syscall restart
 
  - Do not restore KUAP in arch_exit_to_user_mode_prepare()
 
  - pci-ioda: Fix the stale irq chip reference
 
  - Use inclusive range checks in add_usable_mem() and excluded memory
 
  - Fix irq_soft_mask corruption on replayed interrupt exit
 
  - MAINTAINERS: powerpc: Add Ritesh and Shrikanth
 
  - misc fixes and cleanups
 
 Thanks to: Amit Machhiwal, Christophe Leroy (CS GROUP), Gautam Menghani, Harsh
 Prateek Bora, Jiangshan Yi, Mukesh Kumar Chaurasiya (IBM), Ritesh Harjani
 (IBM), Shivaprasad G Bhat, Shrikanth Hegde, Sourabh Jain, Tasmiya Nalatwad,
 Thorsten Blum, Venkat Rao Bagalkote,
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqX2DNAOgU8sBX3pRpnEsdPSHZJQFAmqfqh8ACgkQpnEsdPSH
 ZJQphRAAqAdxLBPdVvJ4vFko4ogdhaPj60eq4XwYnBo9Uez+15ITveRn0DjDEa32
 kzOZBJNtX8iccDSfomIxkGZUm7b4NjopwM/AAMs7+8yFzXhfJ6xsywZIuz95srBm
 0cVhWeiugjDX1tVY87vbuq4ohzb+JOXaESp8nipygjyGkvC95tOV7zE4PAmoy4iR
 lL230p6G/lrj0ilodLlwTtuuJhQ/p4EFeqWoD/EVcLWcTOmd2VxHW9yzE6RjVKXJ
 AMui916B6bel9E7a4c2y0Ldj3iaEsD17bMtuoQTcGlN0l/6fsbWTxKWi1nhkiX8O
 m30s/1nWNqH7t3V9VckubN8FTG9MjgKLy4t9oyXtgAF6/ooCT3y0heLf2znnQp/Z
 n6VswS3bDePlOFkG4c0U19ZXAbhuuQ//fMqT6isV/nlj2Uxs6Nn67tXuAwiOMKH/
 NWzdymsfWiaa4K5ELUtJxzpHltzAFgf5YDb5bIeF32nSmXkDPwztoww6O+t0QaSn
 cNWs7Csi2zezy9nU8QE5ONoWtJam1ZFrztGFX0MV94Wu+WyoATrbF8kHicYMSh2o
 WX0iILEAHPu8YcnLmSIOCwkflIzPryZjrY4jd0dkOvCgnI2THimz0TdKAnGbUxYt
 8yhmEEfat8l0dBKV06HozlNo7ERTSMliR9OpXw8m9KkA0IwcgrE=
 =JN/f
 -----END PGP SIGNATURE-----

Merge tag 'powerpc-7.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Madhavan Srinivasan:

 - Clear TIF_SYSCALL_RET before syscall error return

 - Don't drop _TIF_RESTOREALL on syscall restart

 - Do not restore KUAP in arch_exit_to_user_mode_prepare()

 - pci-ioda: Fix the stale irq chip reference

 - Use inclusive range checks in add_usable_mem() and excluded memory

 - Fix irq_soft_mask corruption on replayed interrupt exit

 - MAINTAINERS: powerpc: Add Ritesh and Shrikanth

 - Misc fixes and cleanups

Thanks to Amit Machhiwal, Christophe Leroy (CS GROUP), Gautam Menghani,
Harsh Prateek Bora, Jiangshan Yi, Mukesh Kumar Chaurasiya (IBM), Ritesh
Harjani (IBM), Shivaprasad G Bhat, Shrikanth Hegde, Sourabh Jain,
Tasmiya Nalatwad, Thorsten Blum, and Venkat Rao Bagalkote.

* tag 'powerpc-7.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  MAINTAINERS: powerpc: Add Ritesh and Shrikanth
  powerpc/ps3: Fix repository.c build failure
  powerpc/entry: Fix irq_soft_mask corruption on replayed interrupt exit
  powerpc/pseries/pci: Fix misleading VF limit error message
  powerpc/kexec_file: Use inclusive range checks for excluded memory
  powerpc/kexec: Simplify kdump_extra_elfcorehdr_size()
  powerpc/kexec_file: Use inclusive range checks in add_usable_mem()
  powerpc/rtas_pci: No hotplug on permanently removed device on pSeries
  powerpc/eeh: Fix recursive locking on devices without EEH sensitive driver
  powerpc: pci-ioda: Fix the stale irq chip reference
  powerpc: Do not restore KUAP in arch_exit_to_user_mode_prepare()
  powerpc: Don't drop _TIF_RESTOREALL on syscall restart
  powerpc/entry: Clear TIF_SYSCALL_RET before syscall error return
This commit is contained in:
Linus Torvalds 2026-09-08 07:59:12 -07:00
commit 5acbae5f7e
10 changed files with 40 additions and 24 deletions

View File

@ -15020,6 +15020,8 @@ M: Madhavan Srinivasan <maddy@linux.ibm.com>
R: Michael Ellerman <mpe@ellerman.id.au>
R: Nicholas Piggin <npiggin@gmail.com>
R: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
R: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
R: Shrikanth Hegde <sshegde@linux.ibm.com>
L: linuxppc-dev@lists.ozlabs.org
S: Supported
W: https://github.com/linuxppc/wiki/wiki

View File

@ -270,7 +270,7 @@ static inline void arch_interrupt_exit_prepare(struct pt_regs *regs)
}
/* irqentry_exit expects to be called with interrupts disabled */
local_irq_disable();
hard_irq_disable();
}
static inline void arch_interrupt_async_enter_prepare(struct pt_regs *regs)
@ -515,8 +515,14 @@ static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
local_paca->tm_scratch = regs->msr;
#endif
/* Restore user access locks last */
kuap_user_restore(regs);
/*
* Do not restore KUAP here. Generic entry might treat this as the last
* arch step before userspace but PowerPC still has kernel work after
* irqentry_exit()/syscall_exit_to_user_mode() i.e. in
* interrupt_exit_user_prepare() / syscall_exit_prepare() may enable
* IRQs and retry. Those functions restore KUAP immediately before rfi,
* which is where it should belong.
*/
}
#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare

View File

@ -533,9 +533,7 @@ static void eeh_rmv_device(struct eeh_dev *edev, void *userdata)
if (rmv_data)
list_add(&edev->rmv_entry, &rmv_data->removed_vf_list);
} else {
pci_lock_rescan_remove();
pci_stop_and_remove_bus_device(dev);
pci_unlock_rescan_remove();
}
}

View File

@ -175,7 +175,7 @@ notrace unsigned long syscall_exit_restart(unsigned long r3, struct pt_regs *reg
current_thread_info()->exit_flags &= ~_TIF_RESTOREALL;
regs->exit_result |= ret;
return ret;
return regs->exit_result;
}
#endif

View File

@ -54,6 +54,10 @@ int rtas_pci_dn_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
if (!config_access_valid(pdn, where))
return PCIBIOS_BAD_REGISTER_NUMBER;
#ifdef CONFIG_EEH
if (pdn->edev &&
(pdn->edev->mode & EEH_DEV_REMOVED))
return PCIBIOS_DEVICE_NOT_FOUND;
if (pdn->edev && pdn->edev->pe &&
(pdn->edev->pe->state & EEH_PE_CFG_BLOCKED))
return PCIBIOS_SET_FAILED;
@ -105,6 +109,10 @@ int rtas_pci_dn_write_config(struct pci_dn *pdn, int where, int size, u32 val)
if (!config_access_valid(pdn, where))
return PCIBIOS_BAD_REGISTER_NUMBER;
#ifdef CONFIG_EEH
if (pdn->edev &&
(pdn->edev->mode & EEH_DEV_REMOVED))
return PCIBIOS_DEVICE_NOT_FOUND;
if (pdn->edev && pdn->edev->pe &&
(pdn->edev->pe->state & EEH_PE_CFG_BLOCKED))
return PCIBIOS_SET_FAILED;

View File

@ -18,8 +18,10 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
long ret;
syscall_fn f;
if (unlikely(!syscall_enter_from_user_mode_randomize_stack(regs, &r0)))
if (unlikely(!syscall_enter_from_user_mode_randomize_stack(regs, &r0))) {
clear_thread_flag(TIF_SYSCALL_RET);
return syscall_get_error(current, regs);
}
if (unlikely(test_and_clear_thread_flag(TIF_SYSCALL_RET)))
return syscall_get_error(current, regs);

View File

@ -57,7 +57,7 @@ int arch_check_excluded_range(struct kimage *image, unsigned long start,
emem = image->arch.exclude_ranges;
for (i = 0; i < emem->nr_ranges; i++)
if (start < emem->ranges[i].end && end > emem->ranges[i].start)
if (start <= emem->ranges[i].end && end >= emem->ranges[i].start)
return 1;
return 0;
@ -113,7 +113,7 @@ static int add_usable_mem(struct umem_info *um_info, u64 base, u64 end)
loc_end = um_info->ranges[i].end;
if (loc_base >= base && loc_end <= end)
add = true;
else if (base < loc_end && end > loc_base) {
else if (base <= loc_end && end >= loc_base) {
if (loc_base < base)
loc_base = base;
if (loc_end > end)
@ -377,16 +377,12 @@ static int load_backup_segment(struct kimage *image, struct kexec_buf *kbuf)
static unsigned int kdump_extra_elfcorehdr_size(struct crash_mem *cmem)
{
#if defined(CONFIG_CRASH_HOTPLUG) && defined(CONFIG_MEMORY_HOTPLUG)
unsigned int extra_sz = 0;
if (CONFIG_CRASH_MAX_MEMORY_RANGES > (unsigned int)PN_XNUM)
pr_warn("Number of Phdrs %u exceeds max\n", CONFIG_CRASH_MAX_MEMORY_RANGES);
else if (cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES)
pr_warn("Configured crash mem ranges may not be enough\n");
else
extra_sz = (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr);
return extra_sz;
return (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr);
#endif
return 0;
}

View File

@ -1623,15 +1623,13 @@ int64_t pnv_opal_pci_msi_eoi(struct irq_data *d)
return opal_pci_msi_eoi(phb->opal_id, d->parent_data->hwirq);
}
static struct irq_chip pnv_pci_msi_irq_chip;
/*
* Returns true iff chip is something that we could call
* pnv_opal_pci_msi_eoi for.
*/
bool is_pnv_opal_msi(struct irq_chip *chip)
{
return chip == &pnv_pci_msi_irq_chip;
return chip && chip->name && str_has_prefix(chip->name, "PNV-");
}
EXPORT_SYMBOL_GPL(is_pnv_opal_msi);
@ -1728,7 +1726,7 @@ static const struct msi_parent_ops pnv_msi_parent_ops = {
.chip_flags = MSI_CHIP_FLAG_SET_EOI,
.bus_select_token = DOMAIN_BUS_NEXUS,
.bus_select_mask = MATCH_PCI_MSI,
.prefix = "PNV-",
.prefix = "PNV-", /* Note: is_pnv_opal_msi() uses this */
.init_dev_msi_info = pnv_init_dev_msi_info,
};

View File

@ -6,6 +6,8 @@
* Copyright 2006 Sony Corp.
*/
#include <linux/minmax.h>
#include <asm/lv1call.h>
#include "platform.h"
@ -74,8 +76,9 @@ static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4,
static u64 make_first_field(const char *text, u64 index)
{
u64 n = 0;
size_t len = min(strlen(text), sizeof(n));
memcpy((char *)&n, text, strnlen(text, sizeof(n)));
memcpy(&n, text, len);
return PS3_VENDOR_ID_NONE + (n >> 32) + index;
}

View File

@ -132,11 +132,14 @@ static int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
/* First integer stores max config */
max_config_vfs = of_read_number(&max_vfs[0], 1);
if (max_config_vfs < num_vfs || num_vfs > MAX_VFS_FOR_MAP_PE) {
dev_err(&pdev->dev,
"Num VFs %x > %x Configurable VFs\n",
num_vfs, (num_vfs > MAX_VFS_FOR_MAP_PE) ?
MAX_VFS_FOR_MAP_PE : max_config_vfs);
if (max_config_vfs < num_vfs) {
dev_err(&pdev->dev, "Num VFs %x > %x Configurable VFs\n",
num_vfs, max_config_vfs);
return -EINVAL;
}
if (num_vfs > MAX_VFS_FOR_MAP_PE) {
dev_err(&pdev->dev, "Num VFs %x > %x PE mapping limit\n",
num_vfs, MAX_VFS_FOR_MAP_PE);
return -EINVAL;
}