Commit 1904148a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'powerpc-4.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
 "Two regression fixes, and a new syscall wire-up:

   - A fix for the recent conversion to time64_t in the powermac RTC
     routines, which caused time to go backward.

   - Another fix for fallout from the split PMD PTL conversion.

   - Wire up the new io_pgetevents() syscall.

  Thanks to: Aneesh Kumar K.V, Arnd Bergmann, Breno Leitao, Mathieu
  Malaterre"

* tag 'powerpc-4.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/powermac: Fix rtc read/write functions
  powerpc/mm/32: Fix pgtable_page_dtor call
  powerpc: Wire up io_pgetevents
parents 0d55ec6f 22db552b
...@@ -138,7 +138,6 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb, ...@@ -138,7 +138,6 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb,
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address) unsigned long address)
{ {
pgtable_page_dtor(table);
pgtable_free_tlb(tlb, page_address(table), 0); pgtable_free_tlb(tlb, page_address(table), 0);
} }
#endif /* _ASM_POWERPC_BOOK3S_32_PGALLOC_H */ #endif /* _ASM_POWERPC_BOOK3S_32_PGALLOC_H */
...@@ -140,7 +140,6 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, ...@@ -140,7 +140,6 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address) unsigned long address)
{ {
tlb_flush_pgtable(tlb, address); tlb_flush_pgtable(tlb, address);
pgtable_page_dtor(table);
pgtable_free_tlb(tlb, page_address(table), 0); pgtable_free_tlb(tlb, page_address(table), 0);
} }
#endif /* _ASM_POWERPC_PGALLOC_32_H */ #endif /* _ASM_POWERPC_PGALLOC_32_H */
...@@ -393,3 +393,4 @@ SYSCALL(pkey_alloc) ...@@ -393,3 +393,4 @@ SYSCALL(pkey_alloc)
SYSCALL(pkey_free) SYSCALL(pkey_free)
SYSCALL(pkey_mprotect) SYSCALL(pkey_mprotect)
SYSCALL(rseq) SYSCALL(rseq)
COMPAT_SYS(io_pgetevents)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <uapi/asm/unistd.h> #include <uapi/asm/unistd.h>
#define NR_syscalls 388 #define NR_syscalls 389
#define __NR__exit __NR_exit #define __NR__exit __NR_exit
......
...@@ -399,5 +399,6 @@ ...@@ -399,5 +399,6 @@
#define __NR_pkey_free 385 #define __NR_pkey_free 385
#define __NR_pkey_mprotect 386 #define __NR_pkey_mprotect 386
#define __NR_rseq 387 #define __NR_rseq 387
#define __NR_io_pgetevents 388
#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
...@@ -42,7 +42,11 @@ ...@@ -42,7 +42,11 @@
#define DBG(x...) #define DBG(x...)
#endif #endif
/* Apparently the RTC stores seconds since 1 Jan 1904 */ /*
* Offset between Unix time (1970-based) and Mac time (1904-based). Cuda and PMU
* times wrap in 2040. If we need to handle later times, the read_time functions
* need to be changed to interpret wrapped times as post-2040.
*/
#define RTC_OFFSET 2082844800 #define RTC_OFFSET 2082844800
/* /*
...@@ -97,8 +101,11 @@ static time64_t cuda_get_time(void) ...@@ -97,8 +101,11 @@ static time64_t cuda_get_time(void)
if (req.reply_len != 7) if (req.reply_len != 7)
printk(KERN_ERR "cuda_get_time: got %d byte reply\n", printk(KERN_ERR "cuda_get_time: got %d byte reply\n",
req.reply_len); req.reply_len);
now = (req.reply[3] << 24) + (req.reply[4] << 16) now = (u32)((req.reply[3] << 24) + (req.reply[4] << 16) +
+ (req.reply[5] << 8) + req.reply[6]; (req.reply[5] << 8) + req.reply[6]);
/* it's either after year 2040, or the RTC has gone backwards */
WARN_ON(now < RTC_OFFSET);
return now - RTC_OFFSET; return now - RTC_OFFSET;
} }
...@@ -106,10 +113,10 @@ static time64_t cuda_get_time(void) ...@@ -106,10 +113,10 @@ static time64_t cuda_get_time(void)
static int cuda_set_rtc_time(struct rtc_time *tm) static int cuda_set_rtc_time(struct rtc_time *tm)
{ {
time64_t nowtime; u32 nowtime;
struct adb_request req; struct adb_request req;
nowtime = rtc_tm_to_time64(tm) + RTC_OFFSET; nowtime = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET);
if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime >> 24, nowtime >> 16, nowtime >> 8,
nowtime) < 0) nowtime) < 0)
...@@ -140,8 +147,12 @@ static time64_t pmu_get_time(void) ...@@ -140,8 +147,12 @@ static time64_t pmu_get_time(void)
if (req.reply_len != 4) if (req.reply_len != 4)
printk(KERN_ERR "pmu_get_time: got %d byte reply from PMU\n", printk(KERN_ERR "pmu_get_time: got %d byte reply from PMU\n",
req.reply_len); req.reply_len);
now = (req.reply[0] << 24) + (req.reply[1] << 16) now = (u32)((req.reply[0] << 24) + (req.reply[1] << 16) +
+ (req.reply[2] << 8) + req.reply[3]; (req.reply[2] << 8) + req.reply[3]);
/* it's either after year 2040, or the RTC has gone backwards */
WARN_ON(now < RTC_OFFSET);
return now - RTC_OFFSET; return now - RTC_OFFSET;
} }
...@@ -149,10 +160,10 @@ static time64_t pmu_get_time(void) ...@@ -149,10 +160,10 @@ static time64_t pmu_get_time(void)
static int pmu_set_rtc_time(struct rtc_time *tm) static int pmu_set_rtc_time(struct rtc_time *tm)
{ {
time64_t nowtime; u32 nowtime;
struct adb_request req; struct adb_request req;
nowtime = rtc_tm_to_time64(tm) + RTC_OFFSET; nowtime = lower_32_bits(rtc_tm_to_time64(tm) + RTC_OFFSET);
if (pmu_request(&req, NULL, 5, PMU_SET_RTC, nowtime >> 24, if (pmu_request(&req, NULL, 5, PMU_SET_RTC, nowtime >> 24,
nowtime >> 16, nowtime >> 8, nowtime) < 0) nowtime >> 16, nowtime >> 8, nowtime) < 0)
return -ENXIO; return -ENXIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment