Skip to content

Commit fbb462b

Browse files
Automatic merge of 'next-test' into merge-test (2025-09-15 16:42)
2 parents 5df49b8 + b137312 commit fbb462b

File tree

16 files changed

+962
-31
lines changed

16 files changed

+962
-31
lines changed

Documentation/userspace-api/ioctl/ioctl-number.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ Code Seq# Include File Comments
374374
375375
0xB2 08 arch/powerpc/include/uapi/asm/papr-physical-attestation.h powerpc/pseries Physical Attestation API
376376
377+
0xB2 09 arch/powerpc/include/uapi/asm/papr-hvpipe.h powerpc/pseries HVPIPE API
378+
377379
0xB3 00 linux/mmc/ioctl.h
378380
0xB4 00-0F linux/gpio.h <mailto:[email protected]>
379381
0xB5 00-0F uapi/linux/rpmsg.h <mailto:[email protected]>

arch/powerpc/include/asm/book3s/32/pgalloc.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77

88
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
99
{
10-
return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
11-
pgtable_gfp_flags(mm, GFP_KERNEL));
10+
pgd_t *pgd = kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
11+
pgtable_gfp_flags(mm, GFP_KERNEL));
12+
13+
#ifdef CONFIG_PPC_BOOK3S_603
14+
memcpy(pgd + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD,
15+
(MAX_PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
16+
#endif
17+
return pgd;
1218
}
1319

1420
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)

arch/powerpc/include/asm/module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct ppc_plt_entry {
2727
struct mod_arch_specific {
2828
#ifdef __powerpc64__
2929
unsigned int stubs_section; /* Index of stubs section in module */
30+
unsigned int stub_count; /* Number of stubs used */
3031
#ifdef CONFIG_PPC_KERNEL_PCREL
3132
unsigned int got_section; /* What section is the GOT? */
3233
unsigned int pcpu_section; /* .data..percpu section */

arch/powerpc/include/asm/nohash/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
2222
pgd_t *pgd = kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
2323
pgtable_gfp_flags(mm, GFP_KERNEL));
2424

25-
#if defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC_BOOK3S_603)
25+
#ifdef CONFIG_PPC_8xx
2626
memcpy(pgd + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD,
2727
(MAX_PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
2828
#endif

arch/powerpc/include/asm/papr-sysparm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef struct {
2121
#define PAPR_SYSPARM_COOP_MEM_OVERCOMMIT_ATTRS mk_papr_sysparm(44)
2222
#define PAPR_SYSPARM_TLB_BLOCK_INVALIDATE_ATTRS mk_papr_sysparm(50)
2323
#define PAPR_SYSPARM_LPAR_NAME mk_papr_sysparm(55)
24+
#define PAPR_SYSPARM_HVPIPE_ENABLE mk_papr_sysparm(64)
2425

2526
/**
2627
* struct papr_sysparm_buf - RTAS work area layout for system parameter functions.

arch/powerpc/include/asm/rtas.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ enum rtas_function_index {
6868
RTAS_FNIDX__IBM_READ_PCI_CONFIG,
6969
RTAS_FNIDX__IBM_READ_SLOT_RESET_STATE,
7070
RTAS_FNIDX__IBM_READ_SLOT_RESET_STATE2,
71+
RTAS_FNIDX__IBM_RECEIVE_HVPIPE_MSG,
7172
RTAS_FNIDX__IBM_REMOVE_PE_DMA_WINDOW,
7273
RTAS_FNIDX__IBM_RESET_PE_DMA_WINDOW,
7374
RTAS_FNIDX__IBM_SCAN_LOG_DUMP,
75+
RTAS_FNIDX__IBM_SEND_HVPIPE_MSG,
7476
RTAS_FNIDX__IBM_SET_DYNAMIC_INDICATOR,
7577
RTAS_FNIDX__IBM_SET_EEH_OPTION,
7678
RTAS_FNIDX__IBM_SET_SLOT_RESET,
@@ -163,9 +165,11 @@ typedef struct {
163165
#define RTAS_FN_IBM_READ_PCI_CONFIG rtas_fn_handle(RTAS_FNIDX__IBM_READ_PCI_CONFIG)
164166
#define RTAS_FN_IBM_READ_SLOT_RESET_STATE rtas_fn_handle(RTAS_FNIDX__IBM_READ_SLOT_RESET_STATE)
165167
#define RTAS_FN_IBM_READ_SLOT_RESET_STATE2 rtas_fn_handle(RTAS_FNIDX__IBM_READ_SLOT_RESET_STATE2)
168+
#define RTAS_FN_IBM_RECEIVE_HVPIPE_MSG rtas_fn_handle(RTAS_FNIDX__IBM_RECEIVE_HVPIPE_MSG)
166169
#define RTAS_FN_IBM_REMOVE_PE_DMA_WINDOW rtas_fn_handle(RTAS_FNIDX__IBM_REMOVE_PE_DMA_WINDOW)
167170
#define RTAS_FN_IBM_RESET_PE_DMA_WINDOW rtas_fn_handle(RTAS_FNIDX__IBM_RESET_PE_DMA_WINDOW)
168171
#define RTAS_FN_IBM_SCAN_LOG_DUMP rtas_fn_handle(RTAS_FNIDX__IBM_SCAN_LOG_DUMP)
172+
#define RTAS_FN_IBM_SEND_HVPIPE_MSG rtas_fn_handle(RTAS_FNIDX__IBM_SEND_HVPIPE_MSG)
169173
#define RTAS_FN_IBM_SET_DYNAMIC_INDICATOR rtas_fn_handle(RTAS_FNIDX__IBM_SET_DYNAMIC_INDICATOR)
170174
#define RTAS_FN_IBM_SET_EEH_OPTION rtas_fn_handle(RTAS_FNIDX__IBM_SET_EEH_OPTION)
171175
#define RTAS_FN_IBM_SET_SLOT_RESET rtas_fn_handle(RTAS_FNIDX__IBM_SET_SLOT_RESET)
@@ -217,6 +221,7 @@ typedef struct {
217221
#define RTAS_HARDWARE_ERROR -1 /* Hardware or other unspecified error. */
218222
#define RTAS_BUSY -2 /* Retry immediately. */
219223
#define RTAS_INVALID_PARAMETER -3 /* Invalid indicator/domain/sensor etc. */
224+
#define RTAS_FUNC_NOT_SUPPORTED -5 /* Function not supported */
220225
#define RTAS_UNEXPECTED_STATE_CHANGE -7 /* Seems limited to EEH and slot reset. */
221226
#define RTAS_EXTENDED_DELAY_MIN 9900 /* Retry after delaying for ~1ms. */
222227
#define RTAS_EXTENDED_DELAY_MAX 9905 /* Retry after delaying for ~100s. */
@@ -233,6 +238,7 @@ typedef struct {
233238
#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */
234239
#define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */
235240
#define RTAS_IO_EVENTS 0x08000000 /* set bit 4 */
241+
#define RTAS_HVPIPE_MSG_EVENTS 0x04000000 /* set bit 5 */
236242
#define RTAS_EVENT_SCAN_ALL_EVENTS 0xffffffff
237243

238244
/* RTAS event severity */
@@ -282,6 +288,7 @@ typedef struct {
282288
#define RTAS_TYPE_DEALLOC 0xE3
283289
#define RTAS_TYPE_DUMP 0xE4
284290
#define RTAS_TYPE_HOTPLUG 0xE5
291+
#define RTAS_TYPE_HVPIPE 0xE6
285292
/* I don't add PowerMGM events right now, this is a different topic */
286293
#define RTAS_TYPE_PMGM_POWER_SW_ON 0x60
287294
#define RTAS_TYPE_PMGM_POWER_SW_OFF 0x61
@@ -374,6 +381,7 @@ inline uint32_t rtas_ext_event_company_id(struct rtas_ext_event_log_v6 *ext_log)
374381
#define PSERIES_ELOG_SECT_ID_HMC_ID (('H' << 8) | 'M')
375382
#define PSERIES_ELOG_SECT_ID_EPOW (('E' << 8) | 'P')
376383
#define PSERIES_ELOG_SECT_ID_IO_EVENT (('I' << 8) | 'E')
384+
#define PSERIES_ELOG_SECT_ID_HVPIPE_EVENT (('P' << 8) | 'E')
377385
#define PSERIES_ELOG_SECT_ID_MANUFACT_INFO (('M' << 8) | 'I')
378386
#define PSERIES_ELOG_SECT_ID_CALL_HOME (('C' << 8) | 'H')
379387
#define PSERIES_ELOG_SECT_ID_USER_DEF (('U' << 8) | 'D')
@@ -519,6 +527,7 @@ extern struct mutex rtas_ibm_get_indices_lock;
519527
extern struct mutex rtas_ibm_set_dynamic_indicator_lock;
520528
extern struct mutex rtas_ibm_get_dynamic_sensor_state_lock;
521529
extern struct mutex rtas_ibm_physical_attestation_lock;
530+
extern struct mutex rtas_ibm_send_hvpipe_msg_lock;
522531

523532
#define GLOBAL_INTERRUPT_QUEUE 9005
524533

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _UAPI_PAPR_HVPIPE_H_
3+
#define _UAPI_PAPR_HVPIPE_H_
4+
5+
#include <linux/types.h>
6+
#include <asm/ioctl.h>
7+
#include <asm/papr-miscdev.h>
8+
9+
/*
10+
* This header is included in payload between OS and the user
11+
* space.
12+
* flags: OS notifies the user space whether the hvpipe is
13+
* closed or the buffer has the payload.
14+
*/
15+
struct papr_hvpipe_hdr {
16+
u8 version;
17+
u8 reserved[3];
18+
u32 flags;
19+
u8 reserved2[40];
20+
};
21+
22+
/*
23+
* ioctl for /dev/papr-hvpipe
24+
*/
25+
#define PAPR_HVPIPE_IOC_CREATE_HANDLE _IOW(PAPR_MISCDEV_IOC_ID, 9, __u32)
26+
27+
/*
28+
* hvpipe_hdr flags used for read()
29+
*/
30+
#define HVPIPE_MSG_AVAILABLE 0x01 /* Payload is available */
31+
#define HVPIPE_LOST_CONNECTION 0x02 /* Pipe connection is closed/unavailable */
32+
33+
#endif /* _UAPI_PAPR_HVPIPE_H_ */

arch/powerpc/kernel/head_8xx.S

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ instruction_counter:
162162
* For the MPC8xx, this is a software tablewalk to load the instruction
163163
* TLB. The task switch loads the M_TWB register with the pointer to the first
164164
* level table.
165-
* If we discover there is no second level table (value is zero) or if there
165+
* If there is no second level table (value is zero) or if there
166166
* is an invalid pte, we load that into the TLB, which causes another fault
167167
* into the TLB Error interrupt where we can handle such problems.
168168
* We have to use the MD_xxx registers for the tablewalk because the
@@ -183,9 +183,6 @@ instruction_counter:
183183
mtspr SPRN_SPRG_SCRATCH2, r10
184184
mtspr SPRN_M_TW, r11
185185

186-
/* If we are faulting a kernel address, we have to use the
187-
* kernel page tables.
188-
*/
189186
mfspr r10, SPRN_SRR0 /* Get effective address of fault */
190187
INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11)
191188
mtspr SPRN_MD_EPN, r10
@@ -228,10 +225,6 @@ instruction_counter:
228225
mtspr SPRN_SPRG_SCRATCH2, r10
229226
mtspr SPRN_M_TW, r11
230227

231-
/* If we are faulting a kernel address, we have to use the
232-
* kernel page tables.
233-
*/
234-
mfspr r10, SPRN_MD_EPN
235228
mfspr r10, SPRN_M_TWB /* Get level 1 table */
236229
lwz r11, 0(r10) /* Get level 1 entry */
237230

arch/powerpc/kernel/module_64.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,
209209
char *secstrings,
210210
struct module *me)
211211
{
212-
/* One extra reloc so it's always 0-addr terminated */
213-
unsigned long relocs = 1;
212+
unsigned long relocs = 0;
214213
unsigned i;
215214

216215
/* Every relocated section... */
@@ -705,7 +704,7 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs,
705704

706705
/* Find this stub, or if that fails, the next avail. entry */
707706
stubs = (void *)sechdrs[me->arch.stubs_section].sh_addr;
708-
for (i = 0; stub_func_addr(stubs[i].funcdata); i++) {
707+
for (i = 0; i < me->arch.stub_count; i++) {
709708
if (WARN_ON(i >= num_stubs))
710709
return 0;
711710

@@ -716,6 +715,7 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs,
716715
if (!create_stub(sechdrs, &stubs[i], addr, me, name))
717716
return 0;
718717

718+
me->arch.stub_count++;
719719
return (unsigned long)&stubs[i];
720720
}
721721

@@ -1118,29 +1118,19 @@ int module_trampoline_target(struct module *mod, unsigned long addr,
11181118
static int setup_ftrace_ool_stubs(const Elf64_Shdr *sechdrs, unsigned long addr, struct module *me)
11191119
{
11201120
#ifdef CONFIG_PPC_FTRACE_OUT_OF_LINE
1121-
unsigned int i, total_stubs, num_stubs;
1121+
unsigned int total_stubs, num_stubs;
11221122
struct ppc64_stub_entry *stub;
11231123

11241124
total_stubs = sechdrs[me->arch.stubs_section].sh_size / sizeof(*stub);
11251125
num_stubs = roundup(me->arch.ool_stub_count * sizeof(struct ftrace_ool_stub),
11261126
sizeof(struct ppc64_stub_entry)) / sizeof(struct ppc64_stub_entry);
11271127

1128-
/* Find the next available entry */
1129-
stub = (void *)sechdrs[me->arch.stubs_section].sh_addr;
1130-
for (i = 0; stub_func_addr(stub[i].funcdata); i++)
1131-
if (WARN_ON(i >= total_stubs))
1132-
return -1;
1133-
1134-
if (WARN_ON(i + num_stubs > total_stubs))
1128+
if (WARN_ON(me->arch.stub_count + num_stubs > total_stubs))
11351129
return -1;
11361130

1137-
stub += i;
1138-
me->arch.ool_stubs = (struct ftrace_ool_stub *)stub;
1139-
1140-
/* reserve stubs */
1141-
for (i = 0; i < num_stubs; i++)
1142-
if (patch_u32((void *)&stub->funcdata, PPC_RAW_NOP()))
1143-
return -1;
1131+
stub = (void *)sechdrs[me->arch.stubs_section].sh_addr;
1132+
me->arch.ool_stubs = (struct ftrace_ool_stub *)(stub + me->arch.stub_count);
1133+
me->arch.stub_count += num_stubs;
11441134
#endif
11451135

11461136
return 0;

arch/powerpc/kernel/rtas.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ DEFINE_MUTEX(rtas_ibm_get_vpd_lock);
9898
DEFINE_MUTEX(rtas_ibm_get_indices_lock);
9999
DEFINE_MUTEX(rtas_ibm_set_dynamic_indicator_lock);
100100
DEFINE_MUTEX(rtas_ibm_get_dynamic_sensor_state_lock);
101+
DEFINE_MUTEX(rtas_ibm_receive_hvpipe_msg_lock);
102+
DEFINE_MUTEX(rtas_ibm_send_hvpipe_msg_lock);
101103

102104
static struct rtas_function rtas_function_table[] __ro_after_init = {
103105
[RTAS_FNIDX__CHECK_EXCEPTION] = {
@@ -373,6 +375,17 @@ static struct rtas_function rtas_function_table[] __ro_after_init = {
373375
[RTAS_FNIDX__IBM_READ_SLOT_RESET_STATE2] = {
374376
.name = "ibm,read-slot-reset-state2",
375377
},
378+
[RTAS_FNIDX__IBM_RECEIVE_HVPIPE_MSG] {
379+
.name = "ibm,receive-hvpipe-msg",
380+
.filter = &(const struct rtas_filter) {
381+
.buf_idx1 = 0, .size_idx1 = 1,
382+
.buf_idx2 = -1, .size_idx2 = -1,
383+
},
384+
/*
385+
* PAPR+ v2.13 R1–7.3.32.1
386+
*/
387+
.lock = &rtas_ibm_receive_hvpipe_msg_lock,
388+
},
376389
[RTAS_FNIDX__IBM_REMOVE_PE_DMA_WINDOW] = {
377390
.name = "ibm,remove-pe-dma-window",
378391
},
@@ -391,6 +404,17 @@ static struct rtas_function rtas_function_table[] __ro_after_init = {
391404
.buf_idx2 = -1, .size_idx2 = -1,
392405
},
393406
},
407+
[RTAS_FNIDX__IBM_SEND_HVPIPE_MSG] {
408+
.name = "ibm,send-hvpipe-msg",
409+
.filter = &(const struct rtas_filter) {
410+
.buf_idx1 = 1, .size_idx1 = -1,
411+
.buf_idx2 = -1, .size_idx2 = -1,
412+
},
413+
/*
414+
* PAPR+ v2.13 R1–7.3.32.2
415+
*/
416+
.lock = &rtas_ibm_send_hvpipe_msg_lock,
417+
},
394418
[RTAS_FNIDX__IBM_SET_DYNAMIC_INDICATOR] = {
395419
.name = "ibm,set-dynamic-indicator",
396420
.filter = &(const struct rtas_filter) {

0 commit comments

Comments
 (0)