mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
Merge tag 'powerpc-5.8-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux into master
Pull powerpc fixes from Michael Ellerman:
"Some more powerpc fixes for 5.8:
- A fix to the VAS code we merged this cycle, to report the proper
error code to userspace for address translation failures. And a
selftest update to match.
- Another fix for our pkey handling of PROT_EXEC mappings.
- A fix for a crash when booting a "secure VM" under an ultravisor
with certain numbers of CPUs.
Thanks to: Aneesh Kumar K.V, Haren Myneni, Laurent Dufour, Sandipan
Das, Satheesh Rajendran, Thiago Jung Bauermann"
* tag 'powerpc-5.8-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
selftests/powerpc: Use proper error code to check fault address
powerpc/vas: Report proper error code for address translation failure
powerpc/pseries/svm: Fix incorrect check for shared_lppaca_size
powerpc/book3s64/pkeys: Fix pkey_access_permitted() for execute disable pkey
This commit is contained in:
@@ -213,7 +213,7 @@ request buffers are not in memory. The operating system handles the fault by
|
||||
updating CSB with the following data:
|
||||
|
||||
csb.flags = CSB_V;
|
||||
csb.cc = CSB_CC_TRANSLATION;
|
||||
csb.cc = CSB_CC_FAULT_ADDRESS;
|
||||
csb.ce = CSB_CE_TERMINATION;
|
||||
csb.address = fault_address;
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ struct coprocessor_completion_block {
|
||||
#define CSB_CC_CHAIN (37)
|
||||
#define CSB_CC_SEQUENCE (38)
|
||||
#define CSB_CC_HW (39)
|
||||
/* P9 DD2 NX Workbook 3.2 (Table 4-36): Address translation fault */
|
||||
#define CSB_CC_FAULT_ADDRESS (250)
|
||||
|
||||
#define CSB_SIZE (0x10)
|
||||
#define CSB_ALIGN CSB_SIZE
|
||||
|
||||
@@ -87,7 +87,7 @@ static void *__init alloc_shared_lppaca(unsigned long size, unsigned long align,
|
||||
* This is very early in boot, so no harm done if the kernel crashes at
|
||||
* this point.
|
||||
*/
|
||||
BUG_ON(shared_lppaca_size >= shared_lppaca_total_size);
|
||||
BUG_ON(shared_lppaca_size > shared_lppaca_total_size);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -354,12 +354,14 @@ static bool pkey_access_permitted(int pkey, bool write, bool execute)
|
||||
u64 amr;
|
||||
|
||||
pkey_shift = pkeyshift(pkey);
|
||||
if (execute && !(read_iamr() & (IAMR_EX_BIT << pkey_shift)))
|
||||
return true;
|
||||
if (execute)
|
||||
return !(read_iamr() & (IAMR_EX_BIT << pkey_shift));
|
||||
|
||||
amr = read_amr(); /* Delay reading amr until absolutely needed */
|
||||
return ((!write && !(amr & (AMR_RD_BIT << pkey_shift))) ||
|
||||
(write && !(amr & (AMR_WR_BIT << pkey_shift))));
|
||||
amr = read_amr();
|
||||
if (write)
|
||||
return !(amr & (AMR_WR_BIT << pkey_shift));
|
||||
|
||||
return !(amr & (AMR_RD_BIT << pkey_shift));
|
||||
}
|
||||
|
||||
bool arch_pte_access_permitted(u64 pte, bool write, bool execute)
|
||||
|
||||
@@ -79,7 +79,7 @@ static void update_csb(struct vas_window *window,
|
||||
csb_addr = (void __user *)be64_to_cpu(crb->csb_addr);
|
||||
|
||||
memset(&csb, 0, sizeof(csb));
|
||||
csb.cc = CSB_CC_TRANSLATION;
|
||||
csb.cc = CSB_CC_FAULT_ADDRESS;
|
||||
csb.ce = CSB_CE_TERMINATION;
|
||||
csb.cs = 0;
|
||||
csb.count = 0;
|
||||
|
||||
@@ -698,13 +698,13 @@ restart_nx:
|
||||
|
||||
switch (cc) {
|
||||
|
||||
case ERR_NX_TRANSLATION:
|
||||
case ERR_NX_AT_FAULT:
|
||||
|
||||
/* We touched the pages ahead of time. In the most common case
|
||||
* we shouldn't be here. But may be some pages were paged out.
|
||||
* Kernel should have placed the faulting address to fsaddr.
|
||||
*/
|
||||
NXPRT(fprintf(stderr, "ERR_NX_TRANSLATION %p\n",
|
||||
NXPRT(fprintf(stderr, "ERR_NX_AT_FAULT %p\n",
|
||||
(void *)cmdp->crb.csb.fsaddr));
|
||||
|
||||
if (pgfault_retries == NX_MAX_FAULTS) {
|
||||
|
||||
@@ -306,13 +306,13 @@ int compress_file(int argc, char **argv, void *handle)
|
||||
lzcounts, cmdp, handle);
|
||||
|
||||
if (cc != ERR_NX_OK && cc != ERR_NX_TPBC_GT_SPBC &&
|
||||
cc != ERR_NX_TRANSLATION) {
|
||||
cc != ERR_NX_AT_FAULT) {
|
||||
fprintf(stderr, "nx error: cc= %d\n", cc);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Page faults are handled by the user code */
|
||||
if (cc == ERR_NX_TRANSLATION) {
|
||||
if (cc == ERR_NX_AT_FAULT) {
|
||||
NXPRT(fprintf(stderr, "page fault: cc= %d, ", cc));
|
||||
NXPRT(fprintf(stderr, "try= %d, fsa= %08llx\n",
|
||||
fault_tries,
|
||||
|
||||
Reference in New Issue
Block a user