Skip to content

Commit a525df0

Browse files
committed
Merge tag 'powerpc-4.16-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "One notable fix to properly advertise our support for a new firmware feature, caused by two series conflicting semantically but not textually. There's a new ioctl for the new ocxl driver, which is not a fix, but needed to complete the userspace API and good to have before the driver is in a released kernel. Finally three minor selftest fixes, and a fix for intermittent build failures for some obscure platforms, caused by a missing make dependency. Thanks to: Alastair D'Silva, Bharata B Rao, Guenter Roeck" * tag 'powerpc-4.16-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/pseries: Fix vector5 in ibm architecture vector table ocxl: Document the OCXL_IOCTL_GET_METADATA IOCTL ocxl: Add get_metadata IOCTL to share OCXL information to userspace selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable selftests/powerpc: Fix missing clean of pmu/lib.o powerpc/boot: Fix random libfdt related build errors selftests/powerpc: Skip tm-trap if transactional memory is not enabled
2 parents e675482 + b0c41b8 commit a525df0

File tree

8 files changed

+68
-3
lines changed

8 files changed

+68
-3
lines changed

Documentation/accelerators/ocxl.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ OCXL_IOCTL_IRQ_SET_FD:
152152
Associate an event fd to an AFU interrupt so that the user process
153153
can be notified when the AFU sends an interrupt.
154154

155+
OCXL_IOCTL_GET_METADATA:
156+
157+
Obtains configuration information from the card, such at the size of
158+
MMIO areas, the AFU version, and the PASID for the current context.
159+
155160

156161
mmap
157162
----

arch/powerpc/boot/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ $(addprefix $(obj)/,$(zlib-y)): \
101101
libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
102102
libfdtheader := fdt.h libfdt.h libfdt_internal.h
103103

104-
$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o): \
104+
$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \
105+
treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \
105106
$(addprefix $(obj)/,$(libfdtheader))
106107

107108
src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \

arch/powerpc/kernel/prom_init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = {
874874
.mmu = 0,
875875
.hash_ext = 0,
876876
.radix_ext = 0,
877-
.byte22 = 0,
878877
},
879878

880879
/* option vector 6: IBM PAPR hints */

drivers/misc/ocxl/file.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,32 @@ static long afu_ioctl_attach(struct ocxl_context *ctx,
102102
return rc;
103103
}
104104

105+
static long afu_ioctl_get_metadata(struct ocxl_context *ctx,
106+
struct ocxl_ioctl_metadata __user *uarg)
107+
{
108+
struct ocxl_ioctl_metadata arg;
109+
110+
memset(&arg, 0, sizeof(arg));
111+
112+
arg.version = 0;
113+
114+
arg.afu_version_major = ctx->afu->config.version_major;
115+
arg.afu_version_minor = ctx->afu->config.version_minor;
116+
arg.pasid = ctx->pasid;
117+
arg.pp_mmio_size = ctx->afu->config.pp_mmio_stride;
118+
arg.global_mmio_size = ctx->afu->config.global_mmio_size;
119+
120+
if (copy_to_user(uarg, &arg, sizeof(arg)))
121+
return -EFAULT;
122+
123+
return 0;
124+
}
125+
105126
#define CMD_STR(x) (x == OCXL_IOCTL_ATTACH ? "ATTACH" : \
106127
x == OCXL_IOCTL_IRQ_ALLOC ? "IRQ_ALLOC" : \
107128
x == OCXL_IOCTL_IRQ_FREE ? "IRQ_FREE" : \
108129
x == OCXL_IOCTL_IRQ_SET_FD ? "IRQ_SET_FD" : \
130+
x == OCXL_IOCTL_GET_METADATA ? "GET_METADATA" : \
109131
"UNKNOWN")
110132

111133
static long afu_ioctl(struct file *file, unsigned int cmd,
@@ -159,6 +181,11 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
159181
irq_fd.eventfd);
160182
break;
161183

184+
case OCXL_IOCTL_GET_METADATA:
185+
rc = afu_ioctl_get_metadata(ctx,
186+
(struct ocxl_ioctl_metadata __user *) args);
187+
break;
188+
162189
default:
163190
rc = -EINVAL;
164191
}

include/uapi/misc/ocxl.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ struct ocxl_ioctl_attach {
3232
__u64 reserved3;
3333
};
3434

35+
struct ocxl_ioctl_metadata {
36+
__u16 version; // struct version, always backwards compatible
37+
38+
// Version 0 fields
39+
__u8 afu_version_major;
40+
__u8 afu_version_minor;
41+
__u32 pasid; // PASID assigned to the current context
42+
43+
__u64 pp_mmio_size; // Per PASID MMIO size
44+
__u64 global_mmio_size;
45+
46+
// End version 0 fields
47+
48+
__u64 reserved[13]; // Total of 16*u64
49+
};
50+
3551
struct ocxl_ioctl_irq_fd {
3652
__u64 irq_offset;
3753
__s32 eventfd;
@@ -45,5 +61,6 @@ struct ocxl_ioctl_irq_fd {
4561
#define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64)
4662
#define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64)
4763
#define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd)
64+
#define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata)
4865

4966
#endif /* _UAPI_MISC_OCXL_H */

tools/testing/selftests/powerpc/mm/subpage_prot.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ static int run_test(void *addr, unsigned long size)
135135
return 0;
136136
}
137137

138+
static int syscall_available(void)
139+
{
140+
int rc;
141+
142+
errno = 0;
143+
rc = syscall(__NR_subpage_prot, 0, 0, 0);
144+
145+
return rc == 0 || (errno != ENOENT && errno != ENOSYS);
146+
}
147+
138148
int test_anon(void)
139149
{
140150
unsigned long align;
@@ -145,6 +155,8 @@ int test_anon(void)
145155
void *mallocblock;
146156
unsigned long mallocsize;
147157

158+
SKIP_IF(!syscall_available());
159+
148160
if (getpagesize() != 0x10000) {
149161
fprintf(stderr, "Kernel page size must be 64K!\n");
150162
return 1;
@@ -180,6 +192,8 @@ int test_file(void)
180192
off_t filesize;
181193
int fd;
182194

195+
SKIP_IF(!syscall_available());
196+
183197
fd = open(file_name, O_RDWR);
184198
if (fd == -1) {
185199
perror("failed to open file");

tools/testing/selftests/powerpc/tm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $(OUTPUT)/tm-syscall: tm-syscall-asm.S
1616
$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
1717
$(OUTPUT)/tm-tmspr: CFLAGS += -pthread
1818
$(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
19-
$(OUTPUT)/tm-resched-dscr: ../pmu/lib.o
19+
$(OUTPUT)/tm-resched-dscr: ../pmu/lib.c
2020
$(OUTPUT)/tm-unavailable: CFLAGS += -O0 -pthread -m64 -Wno-error=uninitialized -mvsx
2121
$(OUTPUT)/tm-trap: CFLAGS += -O0 -pthread -m64
2222

tools/testing/selftests/powerpc/tm/tm-trap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ int tm_trap_test(void)
255255

256256
struct sigaction trap_sa;
257257

258+
SKIP_IF(!have_htm());
259+
258260
trap_sa.sa_flags = SA_SIGINFO;
259261
trap_sa.sa_sigaction = trap_signal_handler;
260262
sigaction(SIGTRAP, &trap_sa, NULL);

0 commit comments

Comments
 (0)