Skip to content

Commit 3664ce2

Browse files
committed
Merge tag 'powerpc-4.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Add handling for a missing instruction in our 32-bit BPF JIT so that it can be used for seccomp filtering. - Add a missing NULL pointer check before a function call in new EEH code. - Fix an error path in the new ocxl driver to correctly return EFAULT. - The support for the new ibm,drc-info device tree property turns out to need several fixes, so for now we just stop advertising to firmware that we support it until the bugs can be ironed out. - One fix for the new drmem code which was incorrectly modifying the device tree in place. - Finally two fixes for the RFI flush support, so that firmware can advertise to us that it should be disabled entirely so as not to affect performance. Thanks to: Bharata B Rao, Frederic Barrat, Juan J. Alvarez, Mark Lord, Michael Bringmann. * tag 'powerpc-4.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/powernv: Support firmware disable of RFI flush powerpc/pseries: Support firmware disable of RFI flush powerpc/mm/drmem: Fix unexpected flag value in ibm,dynamic-memory-v2 powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access powerpc/pseries: Revert support for ibm,drc-info devtree property powerpc/pseries: Fix duplicate firmware feature for DRC_INFO ocxl: Fix potential bad errno on irq allocation powerpc/eeh: Fix crashes in eeh_report_resume()
2 parents 9cb9c07 + eb0a2d2 commit 3664ce2

File tree

8 files changed

+20
-9
lines changed

8 files changed

+20
-9
lines changed

arch/powerpc/include/asm/firmware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
5353
#define FW_FEATURE_PRRN ASM_CONST(0x0000000200000000)
5454
#define FW_FEATURE_DRMEM_V2 ASM_CONST(0x0000000400000000)
55-
#define FW_FEATURE_DRC_INFO ASM_CONST(0x0000000400000000)
55+
#define FW_FEATURE_DRC_INFO ASM_CONST(0x0000000800000000)
5656

5757
#ifndef __ASSEMBLY__
5858

arch/powerpc/kernel/eeh_driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ static void *eeh_report_resume(void *data, void *userdata)
384384
eeh_pcid_put(dev);
385385
pci_uevent_ers(dev, PCI_ERS_RESULT_RECOVERED);
386386
#ifdef CONFIG_PCI_IOV
387-
eeh_ops->notify_resume(eeh_dev_to_pdn(edev));
387+
if (eeh_ops->notify_resume && eeh_dev_to_pdn(edev))
388+
eeh_ops->notify_resume(eeh_dev_to_pdn(edev));
388389
#endif
389390
return NULL;
390391
}

arch/powerpc/kernel/prom_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = {
874874
.mmu = 0,
875875
.hash_ext = 0,
876876
.radix_ext = 0,
877-
.byte22 = OV5_FEAT(OV5_DRC_INFO),
877+
.byte22 = 0,
878878
},
879879

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

arch/powerpc/mm/drmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void init_drconf_v2_cell(struct of_drconf_cell_v2 *dr_cell,
9898
dr_cell->base_addr = cpu_to_be64(lmb->base_addr);
9999
dr_cell->drc_index = cpu_to_be32(lmb->drc_index);
100100
dr_cell->aa_index = cpu_to_be32(lmb->aa_index);
101-
dr_cell->flags = cpu_to_be32(lmb->flags);
101+
dr_cell->flags = cpu_to_be32(drmem_lmb_flags(lmb));
102102
}
103103

104104
static int drmem_update_dt_v2(struct device_node *memory,
@@ -121,7 +121,7 @@ static int drmem_update_dt_v2(struct device_node *memory,
121121
}
122122

123123
if (prev_lmb->aa_index != lmb->aa_index ||
124-
prev_lmb->flags != lmb->flags)
124+
drmem_lmb_flags(prev_lmb) != drmem_lmb_flags(lmb))
125125
lmb_sets++;
126126

127127
prev_lmb = lmb;
@@ -150,7 +150,7 @@ static int drmem_update_dt_v2(struct device_node *memory,
150150
}
151151

152152
if (prev_lmb->aa_index != lmb->aa_index ||
153-
prev_lmb->flags != lmb->flags) {
153+
drmem_lmb_flags(prev_lmb) != drmem_lmb_flags(lmb)) {
154154
/* end of one set, start of another */
155155
dr_cell->seq_lmbs = cpu_to_be32(seq_lmbs);
156156
dr_cell++;

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
327327
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
328328
PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, len));
329329
break;
330+
case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */
331+
PPC_LWZ_OFFS(r_A, r_skb, K);
332+
break;
330333
case BPF_LDX | BPF_W | BPF_LEN: /* X = skb->len; */
331334
PPC_LWZ_OFFS(r_X, r_skb, offsetof(struct sk_buff, len));
332335
break;

arch/powerpc/platforms/powernv/setup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ static void pnv_setup_rfi_flush(void)
8080
if (np && of_property_read_bool(np, "disabled"))
8181
enable--;
8282

83+
np = of_get_child_by_name(fw_features, "speculation-policy-favor-security");
84+
if (np && of_property_read_bool(np, "disabled"))
85+
enable = 0;
86+
8387
of_node_put(np);
8488
of_node_put(fw_features);
8589
}

arch/powerpc/platforms/pseries/setup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ static void pseries_setup_rfi_flush(void)
482482
if (types == L1D_FLUSH_NONE)
483483
types = L1D_FLUSH_FALLBACK;
484484

485-
if (!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
485+
if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
486+
(!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
486487
enable = false;
487488
} else {
488489
/* Default to fallback if case hcall is not available */

drivers/misc/ocxl/file.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
133133
if (!rc) {
134134
rc = copy_to_user((u64 __user *) args, &irq_offset,
135135
sizeof(irq_offset));
136-
if (rc)
136+
if (rc) {
137137
ocxl_afu_irq_free(ctx, irq_offset);
138+
return -EFAULT;
139+
}
138140
}
139141
break;
140142

@@ -329,7 +331,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
329331

330332
used += sizeof(header);
331333

332-
rc = (ssize_t) used;
334+
rc = used;
333335
return rc;
334336
}
335337

0 commit comments

Comments
 (0)