OpenRISC fixes for 5.9-rc4

Fixes for compile issues pointed out by kbuild and one bug I found in
 interd with the 5.9 patches.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAl9ciNAACgkQw7McLV5m
 J+SevxAAlOsiXRX+FqRfplmaLUbcyksdQejmkVzvBqfJhsvtFos4nCbp3UaG2NOc
 D+MBIdviSn86gNi2qplF3lhgMlhkOCczGxVobCpg0CZXyOGVMnyz6vIYp6qxSunx
 9UkeDCnxsTqhBHaC9XdVbGW5xFnj6vKyDTQIZ6dudLj/euMdsq044r0sRA30ZIKS
 2tTBfYjDd8fL+E+dExk9SziE36oD2oSDN35zYsCQ1mbiNySeJ0nCJkUUH0T6mgAP
 jJWQCh7dCF43fCRy7M92Y7B2k+VbQYsvPZHhfBnHb5SAkMlB5gl2suiw+C0oDJ8x
 U8bTD274B2lJbNVh+h/dPoZVXhyzdgimaMPo5H74RJ0OhFr8v/ZPaA302BbRxwdJ
 Xx0gyMyly4d/G62IRWyngQZZjGFTP8lLLaXHs300t0Ej5Ahr1/6jpnTteWi+QBiO
 HlUcn3oHbYkjI3UVJyOrifSe8/5PlqFYVpAUFDIGXsh194KFZ3nlvPNCvDcp1EVM
 xMz6e7p+TpXmlY26PI71EMaLDTwt/K6rDsBOPgpsGFe9jG6fETRdGMuRT2m5vIW0
 oV2xgCa9mQPx7EOmUdUleMlUEAYfnFBU3UTwKtOH+yHm4dbi5Nub+igtEtsY5iO8
 DJSZAURZoqA4z2sf233b414FWHjRklUbqaNvZH85msBTzarbQMM=
 =MJ0P
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://github.com/openrisc/linux

Pull OpenRISC fixes from Stafford Horne:
 "Fixes for compile issues pointed out by kbuild and one bug I found in
  initrd with the 5.9 patches"

* tag 'for-linus' of git://github.com/openrisc/linux:
  openrisc: Fix issue with get_user for 64-bit values
  openrisc: Fix cache API compile issue when not inlining
  openrisc: Reserve memblock for initrd
This commit is contained in:
Linus Torvalds 2020-09-12 13:03:49 -07:00
commit b952e97430
3 changed files with 32 additions and 13 deletions

View File

@ -165,19 +165,19 @@ struct __large_struct {
#define __get_user_nocheck(x, ptr, size) \
({ \
long __gu_err, __gu_val; \
__get_user_size(__gu_val, (ptr), (size), __gu_err); \
(x) = (__force __typeof__(*(ptr)))__gu_val; \
long __gu_err; \
__get_user_size((x), (ptr), (size), __gu_err); \
__gu_err; \
})
#define __get_user_check(x, ptr, size) \
({ \
long __gu_err = -EFAULT, __gu_val = 0; \
long __gu_err = -EFAULT; \
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
if (access_ok(__gu_addr, size)) \
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
(x) = (__force __typeof__(*(ptr)))__gu_val; \
if (access_ok(__gu_addr, size)) \
__get_user_size((x), __gu_addr, (size), __gu_err); \
else \
(x) = (__typeof__(*(ptr))) 0; \
__gu_err; \
})
@ -191,11 +191,13 @@ do { \
case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \
case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \
case 8: __get_user_asm2(x, ptr, retval); break; \
default: (x) = __get_user_bad(); \
default: (x) = (__typeof__(*(ptr)))__get_user_bad(); \
} \
} while (0)
#define __get_user_asm(x, addr, err, op) \
{ \
unsigned long __gu_tmp; \
__asm__ __volatile__( \
"1: "op" %1,0(%2)\n" \
"2:\n" \
@ -209,10 +211,14 @@ do { \
" .align 2\n" \
" .long 1b,3b\n" \
".previous" \
: "=r"(err), "=r"(x) \
: "r"(addr), "i"(-EFAULT), "0"(err))
: "=r"(err), "=r"(__gu_tmp) \
: "r"(addr), "i"(-EFAULT), "0"(err)); \
(x) = (__typeof__(*(addr)))__gu_tmp; \
}
#define __get_user_asm2(x, addr, err) \
{ \
unsigned long long __gu_tmp; \
__asm__ __volatile__( \
"1: l.lwz %1,0(%2)\n" \
"2: l.lwz %H1,4(%2)\n" \
@ -229,8 +235,11 @@ do { \
" .long 1b,4b\n" \
" .long 2b,4b\n" \
".previous" \
: "=r"(err), "=&r"(x) \
: "r"(addr), "i"(-EFAULT), "0"(err))
: "=r"(err), "=&r"(__gu_tmp) \
: "r"(addr), "i"(-EFAULT), "0"(err)); \
(x) = (__typeof__(*(addr)))( \
(__typeof__((x)-(x)))__gu_tmp); \
}
/* more complex routines */

View File

@ -80,6 +80,16 @@ static void __init setup_memory(void)
*/
memblock_reserve(__pa(_stext), _end - _stext);
#ifdef CONFIG_BLK_DEV_INITRD
/* Then reserve the initrd, if any */
if (initrd_start && (initrd_end > initrd_start)) {
unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
}
#endif /* CONFIG_BLK_DEV_INITRD */
early_init_fdt_reserve_self();
early_init_fdt_scan_reserved_mem();

View File

@ -16,7 +16,7 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
static void cache_loop(struct page *page, const unsigned int reg)
static __always_inline void cache_loop(struct page *page, const unsigned int reg)
{
unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT;
unsigned long line = paddr & ~(L1_CACHE_BYTES - 1);