Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 's390-5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull more s390 updates from Vasily Gorbik:

- Fix physical vs virtual confusion in some basic mm macros and
routines. Caused by __pa == __va on s390 currently.

- Get rid of on-stack cpu masks.

- Add support for complete CPU counter set extraction.

- Add arch_irq_work_raise implementation.

- virtio-ccw revision and opcode fixes.

* tag 's390-5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/cpumf: Add support for complete counter set extraction
virtio/s390: implement virtio-ccw revision 2 correctly
s390/smp: implement arch_irq_work_raise()
s390/topology: move cpumasks away from stack
s390/smp: smp_emergency_stop() - move cpumask away from stack
s390/smp: __smp_rescan_cpus() - move cpumask away from stack
s390/smp: consolidate locking for smp_rescan()
s390/mm: fix phys vs virt confusion in vmem_*() functions family
s390/mm: fix phys vs virt confusion in pgtable allocation routines
s390/mm: fix invalid __pa() usage in pfn_pXd() macros
s390/mm: make pXd_deref() macros return a pointer
s390/opcodes: rename selhhhr to selfhr

+660 -81
+12
arch/s390/include/asm/irq_work.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_S390_IRQ_WORK_H 3 + #define _ASM_S390_IRQ_WORK_H 4 + 5 + static inline bool arch_irq_work_has_interrupt(void) 6 + { 7 + return true; 8 + } 9 + 10 + void arch_irq_work_raise(void); 11 + 12 + #endif /* _ASM_S390_IRQ_WORK_H */
+1 -1
arch/s390/include/asm/pgalloc.h
··· 135 135 #define pmd_populate_kernel(mm, pmd, pte) pmd_populate(mm, pmd, pte) 136 136 137 137 #define pmd_pgtable(pmd) \ 138 - (pgtable_t)(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE) 138 + ((pgtable_t)__va(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE)) 139 139 140 140 /* 141 141 * page table entry allocation/free routines.
+8 -8
arch/s390/include/asm/pgtable.h
··· 1219 1219 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) 1220 1220 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 1221 1221 1222 - #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN) 1223 - #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) 1222 + #define p4d_deref(pud) ((unsigned long)__va(p4d_val(pud) & _REGION_ENTRY_ORIGIN)) 1223 + #define pgd_deref(pgd) ((unsigned long)__va(pgd_val(pgd) & _REGION_ENTRY_ORIGIN)) 1224 1224 1225 1225 static inline unsigned long pmd_deref(pmd_t pmd) 1226 1226 { ··· 1229 1229 origin_mask = _SEGMENT_ENTRY_ORIGIN; 1230 1230 if (pmd_large(pmd)) 1231 1231 origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE; 1232 - return pmd_val(pmd) & origin_mask; 1232 + return (unsigned long)__va(pmd_val(pmd) & origin_mask); 1233 1233 } 1234 1234 1235 1235 static inline unsigned long pmd_pfn(pmd_t pmd) 1236 1236 { 1237 - return pmd_deref(pmd) >> PAGE_SHIFT; 1237 + return __pa(pmd_deref(pmd)) >> PAGE_SHIFT; 1238 1238 } 1239 1239 1240 1240 static inline unsigned long pud_deref(pud_t pud) ··· 1244 1244 origin_mask = _REGION_ENTRY_ORIGIN; 1245 1245 if (pud_large(pud)) 1246 1246 origin_mask = _REGION3_ENTRY_ORIGIN_LARGE; 1247 - return pud_val(pud) & origin_mask; 1247 + return (unsigned long)__va(pud_val(pud) & origin_mask); 1248 1248 } 1249 1249 1250 1250 static inline unsigned long pud_pfn(pud_t pud) 1251 1251 { 1252 - return pud_deref(pud) >> PAGE_SHIFT; 1252 + return __pa(pud_deref(pud)) >> PAGE_SHIFT; 1253 1253 } 1254 1254 1255 1255 /* ··· 1329 1329 } 1330 1330 #define gup_fast_permitted gup_fast_permitted 1331 1331 1332 - #define pfn_pte(pfn,pgprot) mk_pte_phys(__pa((pfn) << PAGE_SHIFT),(pgprot)) 1332 + #define pfn_pte(pfn, pgprot) mk_pte_phys(((pfn) << PAGE_SHIFT), (pgprot)) 1333 1333 #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) 1334 1334 #define pte_page(x) pfn_to_page(pte_pfn(x)) 1335 1335 ··· 1636 1636 } 1637 1637 #define pmdp_collapse_flush pmdp_collapse_flush 1638 1638 1639 - #define pfn_pmd(pfn, pgprot) mk_pmd_phys(__pa((pfn) << PAGE_SHIFT), (pgprot)) 1639 + #define pfn_pmd(pfn, pgprot) mk_pmd_phys(((pfn) << PAGE_SHIFT), (pgprot)) 1640 1640 #define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot)) 1641 1641 1642 1642 static inline int pmd_trans_huge(pmd_t pmd)
+51
arch/s390/include/uapi/asm/perf_cpum_cf_diag.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + /* 3 + * Copyright IBM Corp. 2021 4 + * Interface implementation for communication with the CPU Measurement 5 + * counter facility device driver. 6 + * 7 + * Author(s): Thomas Richter <tmricht@linux.ibm.com> 8 + * 9 + * Define for ioctl() commands to communicate with the CPU Measurement 10 + * counter facility device driver. 11 + */ 12 + 13 + #ifndef _PERF_CPUM_CF_DIAG_H 14 + #define _PERF_CPUM_CF_DIAG_H 15 + 16 + #include <linux/ioctl.h> 17 + #include <linux/types.h> 18 + 19 + #define S390_HWCTR_DEVICE "hwctr" 20 + #define S390_HWCTR_START_VERSION 1 21 + 22 + struct s390_ctrset_start { /* Set CPUs to operate on */ 23 + __u64 version; /* Version of interface */ 24 + __u64 data_bytes; /* # of bytes required */ 25 + __u64 cpumask_len; /* Length of CPU mask in bytes */ 26 + __u64 *cpumask; /* Pointer to CPU mask */ 27 + __u64 counter_sets; /* Bit mask of counter sets to get */ 28 + }; 29 + 30 + struct s390_ctrset_setdata { /* Counter set data */ 31 + __u32 set; /* Counter set number */ 32 + __u32 no_cnts; /* # of counters stored in cv[] */ 33 + __u64 cv[0]; /* Counter values (variable length) */ 34 + }; 35 + 36 + struct s390_ctrset_cpudata { /* Counter set data per CPU */ 37 + __u32 cpu_nr; /* CPU number */ 38 + __u32 no_sets; /* # of counters sets in data[] */ 39 + struct s390_ctrset_setdata data[0]; 40 + }; 41 + 42 + struct s390_ctrset_read { /* Structure to get all ctr sets */ 43 + __u64 no_cpus; /* Total # of CPUs data taken from */ 44 + struct s390_ctrset_cpudata data[0]; 45 + }; 46 + 47 + #define S390_HWCTR_MAGIC 'C' /* Random magic # for ioctls */ 48 + #define S390_HWCTR_START _IOWR(S390_HWCTR_MAGIC, 1, struct s390_ctrset_start) 49 + #define S390_HWCTR_STOP _IO(S390_HWCTR_MAGIC, 2) 50 + #define S390_HWCTR_READ _IOWR(S390_HWCTR_MAGIC, 3, struct s390_ctrset_read) 51 + #endif
+525 -23
arch/s390/kernel/perf_cpum_cf_diag.c
··· 2 2 /* 3 3 * Performance event support for s390x - CPU-measurement Counter Sets 4 4 * 5 - * Copyright IBM Corp. 2019 5 + * Copyright IBM Corp. 2019, 2021 6 6 * Author(s): Hendrik Brueckner <brueckner@linux.ibm.com> 7 7 * Thomas Richer <tmricht@linux.ibm.com> 8 8 */ ··· 17 17 #include <linux/export.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/processor.h> 20 + #include <linux/miscdevice.h> 21 + #include <linux/mutex.h> 20 22 21 23 #include <asm/ctl_reg.h> 22 24 #include <asm/irq.h> ··· 26 24 #include <asm/timex.h> 27 25 #include <asm/debug.h> 28 26 29 - #define CF_DIAG_CTRSET_DEF 0xfeef /* Counter set header mark */ 27 + #include <asm/perf_cpum_cf_diag.h> 30 28 29 + #define CF_DIAG_CTRSET_DEF 0xfeef /* Counter set header mark */ 30 + #define CF_DIAG_MIN_INTERVAL 60 /* Minimum counter set read */ 31 + /* interval in seconds */ 32 + static unsigned long cf_diag_interval = CF_DIAG_MIN_INTERVAL; 31 33 static unsigned int cf_diag_cpu_speed; 32 34 static debug_info_t *cf_diag_dbg; 33 35 34 - struct cf_diag_csd { /* Counter set data per CPU */ 36 + struct cf_diag_csd { /* Counter set data per CPU */ 35 37 size_t used; /* Bytes used in data/start */ 36 38 unsigned char start[PAGE_SIZE]; /* Counter set at event start */ 37 39 unsigned char data[PAGE_SIZE]; /* Counter set at event delete */ 40 + unsigned int sets; /* # Counter set saved in data */ 38 41 }; 39 42 static DEFINE_PER_CPU(struct cf_diag_csd, cf_diag_csd); 40 43 ··· 185 178 186 179 /* Number of perf events counting hardware events */ 187 180 static atomic_t cf_diag_events = ATOMIC_INIT(0); 181 + /* Used to avoid races in calling reserve/release_cpumf_hardware */ 182 + static DEFINE_MUTEX(cf_diag_reserve_mutex); 188 183 189 184 /* Release the PMU if event is the last perf event */ 190 185 static void cf_diag_perf_event_destroy(struct perf_event *event) 191 186 { 192 187 debug_sprintf_event(cf_diag_dbg, 5, 193 188 "%s event %p cpu %d cf_diag_events %d\n", 194 - __func__, event, event->cpu, 189 + __func__, event, smp_processor_id(), 195 190 atomic_read(&cf_diag_events)); 196 191 if (atomic_dec_return(&cf_diag_events) == 0) 197 192 __kernel_cpumcf_end(); 193 + } 194 + 195 + static int get_authctrsets(void) 196 + { 197 + struct cpu_cf_events *cpuhw; 198 + unsigned long auth = 0; 199 + enum cpumf_ctr_set i; 200 + 201 + cpuhw = &get_cpu_var(cpu_cf_events); 202 + for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) { 203 + if (cpuhw->info.auth_ctl & cpumf_ctr_ctl[i]) 204 + auth |= cpumf_ctr_ctl[i]; 205 + } 206 + put_cpu_var(cpu_cf_events); 207 + return auth; 198 208 } 199 209 200 210 /* Setup the event. Test for authorized counter sets and only include counter ··· 221 197 static int __hw_perf_event_init(struct perf_event *event) 222 198 { 223 199 struct perf_event_attr *attr = &event->attr; 224 - struct cpu_cf_events *cpuhw; 225 - enum cpumf_ctr_set i; 226 200 int err = 0; 227 201 228 202 debug_sprintf_event(cf_diag_dbg, 5, "%s event %p cpu %d\n", __func__, 229 203 event, event->cpu); 230 204 231 205 event->hw.config = attr->config; 232 - event->hw.config_base = 0; 233 206 234 207 /* Add all authorized counter sets to config_base. The 235 208 * the hardware init function is either called per-cpu or just once ··· 236 215 * Checking the authorization on any CPU is fine as the hardware 237 216 * applies the same authorization settings to all CPUs. 238 217 */ 239 - cpuhw = &get_cpu_var(cpu_cf_events); 240 - for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) 241 - if (cpuhw->info.auth_ctl & cpumf_ctr_ctl[i]) 242 - event->hw.config_base |= cpumf_ctr_ctl[i]; 243 - put_cpu_var(cpu_cf_events); 218 + event->hw.config_base = get_authctrsets(); 244 219 245 220 /* No authorized counter sets, nothing to count/sample */ 246 221 if (!event->hw.config_base) { ··· 251 234 out: 252 235 debug_sprintf_event(cf_diag_dbg, 5, "%s err %d config_base %#lx\n", 253 236 __func__, err, event->hw.config_base); 237 + return err; 238 + } 239 + 240 + /* Return 0 if the CPU-measurement counter facility is currently free 241 + * and an error otherwise. 242 + */ 243 + static int cf_diag_perf_event_inuse(void) 244 + { 245 + int err = 0; 246 + 247 + if (!atomic_inc_not_zero(&cf_diag_events)) { 248 + mutex_lock(&cf_diag_reserve_mutex); 249 + if (atomic_read(&cf_diag_events) == 0 && 250 + __kernel_cpumcf_begin()) 251 + err = -EBUSY; 252 + else 253 + err = atomic_inc_return(&cf_diag_events); 254 + mutex_unlock(&cf_diag_reserve_mutex); 255 + } 254 256 return err; 255 257 } 256 258 ··· 300 264 } 301 265 302 266 /* Initialize for using the CPU-measurement counter facility */ 303 - if (atomic_inc_return(&cf_diag_events) == 1) { 304 - if (__kernel_cpumcf_begin()) { 305 - atomic_dec(&cf_diag_events); 306 - err = -EBUSY; 307 - goto out; 308 - } 309 - } 267 + err = cf_diag_perf_event_inuse(); 268 + if (err < 0) 269 + goto out; 310 270 event->destroy = cf_diag_perf_event_destroy; 311 271 312 272 err = __hw_perf_event_init(event); ··· 631 599 cpuhw->flags &= ~PMU_F_IN_USE; 632 600 } 633 601 602 + /* Default counter set events and format attribute groups */ 603 + 634 604 CPUMF_EVENT_ATTR(CF_DIAG, CF_DIAG, PERF_EVENT_CPUM_CF_DIAG); 635 605 636 606 static struct attribute *cf_diag_events_attr[] = { ··· 697 663 } 698 664 } 699 665 666 + /* Code to create device and file I/O operations */ 667 + static atomic_t ctrset_opencnt = ATOMIC_INIT(0); /* Excl. access */ 668 + 669 + static int cf_diag_open(struct inode *inode, struct file *file) 670 + { 671 + int err = 0; 672 + 673 + if (!capable(CAP_SYS_ADMIN)) 674 + return -EPERM; 675 + if (atomic_xchg(&ctrset_opencnt, 1)) 676 + return -EBUSY; 677 + 678 + /* Avoid concurrent access with perf_event_open() system call */ 679 + mutex_lock(&cf_diag_reserve_mutex); 680 + if (atomic_read(&cf_diag_events) || __kernel_cpumcf_begin()) 681 + err = -EBUSY; 682 + mutex_unlock(&cf_diag_reserve_mutex); 683 + if (err) { 684 + atomic_set(&ctrset_opencnt, 0); 685 + return err; 686 + } 687 + file->private_data = NULL; 688 + debug_sprintf_event(cf_diag_dbg, 2, "%s\n", __func__); 689 + /* nonseekable_open() never fails */ 690 + return nonseekable_open(inode, file); 691 + } 692 + 693 + /* Variables for ioctl() interface support */ 694 + static DEFINE_MUTEX(cf_diag_ctrset_mutex); 695 + static struct cf_diag_ctrset { 696 + unsigned long ctrset; /* Bit mask of counter set to read */ 697 + cpumask_t mask; /* CPU mask to read from */ 698 + time64_t lastread; /* Epoch counter set last read */ 699 + } cf_diag_ctrset; 700 + 701 + static void cf_diag_ctrset_clear(void) 702 + { 703 + cpumask_clear(&cf_diag_ctrset.mask); 704 + cf_diag_ctrset.ctrset = 0; 705 + } 706 + 707 + static void cf_diag_release_cpu(void *p) 708 + { 709 + struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 710 + 711 + debug_sprintf_event(cf_diag_dbg, 3, "%s cpu %d\n", __func__, 712 + smp_processor_id()); 713 + lcctl(0); /* Reset counter sets */ 714 + cpuhw->state = 0; /* Save state in CPU hardware state */ 715 + } 716 + 717 + /* Release function is also called when application gets terminated without 718 + * doing a proper ioctl(..., S390_HWCTR_STOP, ...) command. 719 + * Since only one application is allowed to open the device, simple stop all 720 + * CPU counter sets. 721 + */ 722 + static int cf_diag_release(struct inode *inode, struct file *file) 723 + { 724 + on_each_cpu(cf_diag_release_cpu, NULL, 1); 725 + cf_diag_ctrset_clear(); 726 + atomic_set(&ctrset_opencnt, 0); 727 + __kernel_cpumcf_end(); 728 + debug_sprintf_event(cf_diag_dbg, 2, "%s\n", __func__); 729 + return 0; 730 + } 731 + 732 + struct cf_diag_call_on_cpu_parm { /* Parm struct for smp_call_on_cpu */ 733 + unsigned int sets; /* Counter set bit mask */ 734 + atomic_t cpus_ack; /* # CPUs successfully executed func */ 735 + }; 736 + 737 + static int cf_diag_all_copy(unsigned long arg, cpumask_t *mask) 738 + { 739 + struct s390_ctrset_read __user *ctrset_read; 740 + unsigned int cpu, cpus, rc; 741 + void __user *uptr; 742 + 743 + ctrset_read = (struct s390_ctrset_read __user *)arg; 744 + uptr = ctrset_read->data; 745 + for_each_cpu(cpu, mask) { 746 + struct cf_diag_csd *csd = per_cpu_ptr(&cf_diag_csd, cpu); 747 + struct s390_ctrset_cpudata __user *ctrset_cpudata; 748 + 749 + ctrset_cpudata = uptr; 750 + debug_sprintf_event(cf_diag_dbg, 5, "%s cpu %d used %zd\n", 751 + __func__, cpu, csd->used); 752 + rc = put_user(cpu, &ctrset_cpudata->cpu_nr); 753 + rc |= put_user(csd->sets, &ctrset_cpudata->no_sets); 754 + rc |= copy_to_user(ctrset_cpudata->data, csd->data, csd->used); 755 + if (rc) 756 + return -EFAULT; 757 + uptr += sizeof(struct s390_ctrset_cpudata) + csd->used; 758 + cond_resched(); 759 + } 760 + cpus = cpumask_weight(mask); 761 + if (put_user(cpus, &ctrset_read->no_cpus)) 762 + return -EFAULT; 763 + debug_sprintf_event(cf_diag_dbg, 5, "%s copied %ld\n", 764 + __func__, uptr - (void __user *)ctrset_read->data); 765 + return 0; 766 + } 767 + 768 + static size_t cf_diag_cpuset_read(struct s390_ctrset_setdata *p, int ctrset, 769 + int ctrset_size, size_t room) 770 + { 771 + size_t need = 0; 772 + int rc = -1; 773 + 774 + need = sizeof(*p) + sizeof(u64) * ctrset_size; 775 + debug_sprintf_event(cf_diag_dbg, 5, 776 + "%s room %zd need %zd set %#x set_size %d\n", 777 + __func__, room, need, ctrset, ctrset_size); 778 + if (need <= room) { 779 + p->set = cpumf_ctr_ctl[ctrset]; 780 + p->no_cnts = ctrset_size; 781 + rc = ctr_stcctm(ctrset, ctrset_size, (u64 *)p->cv); 782 + if (rc == 3) /* Nothing stored */ 783 + need = 0; 784 + } 785 + debug_sprintf_event(cf_diag_dbg, 5, "%s need %zd rc %d\n", __func__, 786 + need, rc); 787 + return need; 788 + } 789 + 790 + /* Read all counter sets. Since the perf_event_open() system call with 791 + * event cpum_cf_diag/.../ is blocked when this interface is active, reuse 792 + * the perf_event_open() data buffer to store the counter sets. 793 + */ 794 + static void cf_diag_cpu_read(void *parm) 795 + { 796 + struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 797 + struct cf_diag_csd *csd = this_cpu_ptr(&cf_diag_csd); 798 + struct cf_diag_call_on_cpu_parm *p = parm; 799 + int set, set_size; 800 + size_t space; 801 + 802 + debug_sprintf_event(cf_diag_dbg, 5, 803 + "%s new %#x flags %#x state %#llx\n", 804 + __func__, p->sets, cpuhw->flags, 805 + cpuhw->state); 806 + /* No data saved yet */ 807 + csd->used = 0; 808 + csd->sets = 0; 809 + memset(csd->data, 0, sizeof(csd->data)); 810 + 811 + /* Scan the counter sets */ 812 + for (set = CPUMF_CTR_SET_BASIC; set < CPUMF_CTR_SET_MAX; ++set) { 813 + struct s390_ctrset_setdata *sp = (void *)csd->data + csd->used; 814 + 815 + if (!(p->sets & cpumf_ctr_ctl[set])) 816 + continue; /* Counter set not in list */ 817 + set_size = cf_diag_ctrset_size(set, &cpuhw->info); 818 + space = sizeof(csd->data) - csd->used; 819 + space = cf_diag_cpuset_read(sp, set, set_size, space); 820 + if (space) { 821 + csd->used += space; 822 + csd->sets += 1; 823 + } 824 + debug_sprintf_event(cf_diag_dbg, 5, "%s sp %px space %zd\n", 825 + __func__, sp, space); 826 + } 827 + debug_sprintf_event(cf_diag_dbg, 5, "%s sets %d used %zd\n", __func__, 828 + csd->sets, csd->used); 829 + } 830 + 831 + static int cf_diag_all_read(unsigned long arg) 832 + { 833 + struct cf_diag_call_on_cpu_parm p; 834 + cpumask_var_t mask; 835 + time64_t now; 836 + int rc = 0; 837 + 838 + debug_sprintf_event(cf_diag_dbg, 5, "%s\n", __func__); 839 + if (!alloc_cpumask_var(&mask, GFP_KERNEL)) 840 + return -ENOMEM; 841 + now = ktime_get_seconds(); 842 + if (cf_diag_ctrset.lastread + cf_diag_interval > now) { 843 + debug_sprintf_event(cf_diag_dbg, 5, "%s now %lld " 844 + " lastread %lld\n", __func__, now, 845 + cf_diag_ctrset.lastread); 846 + rc = -EAGAIN; 847 + goto out; 848 + } else { 849 + cf_diag_ctrset.lastread = now; 850 + } 851 + p.sets = cf_diag_ctrset.ctrset; 852 + cpumask_and(mask, &cf_diag_ctrset.mask, cpu_online_mask); 853 + on_each_cpu_mask(mask, cf_diag_cpu_read, &p, 1); 854 + rc = cf_diag_all_copy(arg, mask); 855 + out: 856 + free_cpumask_var(mask); 857 + debug_sprintf_event(cf_diag_dbg, 5, "%s rc %d\n", __func__, rc); 858 + return rc; 859 + } 860 + 861 + /* Stop all counter sets via ioctl interface */ 862 + static void cf_diag_ioctl_off(void *parm) 863 + { 864 + struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 865 + struct cf_diag_call_on_cpu_parm *p = parm; 866 + int rc; 867 + 868 + debug_sprintf_event(cf_diag_dbg, 5, 869 + "%s new %#x flags %#x state %#llx\n", 870 + __func__, p->sets, cpuhw->flags, 871 + cpuhw->state); 872 + 873 + ctr_set_multiple_disable(&cpuhw->state, p->sets); 874 + ctr_set_multiple_stop(&cpuhw->state, p->sets); 875 + rc = lcctl(cpuhw->state); /* Stop counter sets */ 876 + if (!cpuhw->state) 877 + cpuhw->flags &= ~PMU_F_IN_USE; 878 + debug_sprintf_event(cf_diag_dbg, 5, 879 + "%s rc %d flags %#x state %#llx\n", __func__, 880 + rc, cpuhw->flags, cpuhw->state); 881 + } 882 + 883 + /* Start counter sets on particular CPU */ 884 + static void cf_diag_ioctl_on(void *parm) 885 + { 886 + struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 887 + struct cf_diag_call_on_cpu_parm *p = parm; 888 + int rc; 889 + 890 + debug_sprintf_event(cf_diag_dbg, 5, 891 + "%s new %#x flags %#x state %#llx\n", 892 + __func__, p->sets, cpuhw->flags, 893 + cpuhw->state); 894 + 895 + if (!(cpuhw->flags & PMU_F_IN_USE)) 896 + cpuhw->state = 0; 897 + cpuhw->flags |= PMU_F_IN_USE; 898 + rc = lcctl(cpuhw->state); /* Reset unused counter sets */ 899 + ctr_set_multiple_enable(&cpuhw->state, p->sets); 900 + ctr_set_multiple_start(&cpuhw->state, p->sets); 901 + rc |= lcctl(cpuhw->state); /* Start counter sets */ 902 + if (!rc) 903 + atomic_inc(&p->cpus_ack); 904 + debug_sprintf_event(cf_diag_dbg, 5, "%s rc %d state %#llx\n", 905 + __func__, rc, cpuhw->state); 906 + } 907 + 908 + static int cf_diag_all_stop(void) 909 + { 910 + struct cf_diag_call_on_cpu_parm p = { 911 + .sets = cf_diag_ctrset.ctrset, 912 + }; 913 + cpumask_var_t mask; 914 + 915 + if (!alloc_cpumask_var(&mask, GFP_KERNEL)) 916 + return -ENOMEM; 917 + cpumask_and(mask, &cf_diag_ctrset.mask, cpu_online_mask); 918 + on_each_cpu_mask(mask, cf_diag_ioctl_off, &p, 1); 919 + free_cpumask_var(mask); 920 + return 0; 921 + } 922 + 923 + static int cf_diag_all_start(void) 924 + { 925 + struct cf_diag_call_on_cpu_parm p = { 926 + .sets = cf_diag_ctrset.ctrset, 927 + .cpus_ack = ATOMIC_INIT(0), 928 + }; 929 + cpumask_var_t mask; 930 + int rc = 0; 931 + 932 + if (!alloc_cpumask_var(&mask, GFP_KERNEL)) 933 + return -ENOMEM; 934 + cpumask_and(mask, &cf_diag_ctrset.mask, cpu_online_mask); 935 + on_each_cpu_mask(mask, cf_diag_ioctl_on, &p, 1); 936 + if (atomic_read(&p.cpus_ack) != cpumask_weight(mask)) { 937 + on_each_cpu_mask(mask, cf_diag_ioctl_off, &p, 1); 938 + rc = -EIO; 939 + } 940 + free_cpumask_var(mask); 941 + return rc; 942 + } 943 + 944 + /* Return the maximum required space for all possible CPUs in case one 945 + * CPU will be onlined during the START, READ, STOP cycles. 946 + * To find out the size of the counter sets, any one CPU will do. They 947 + * all have the same counter sets. 948 + */ 949 + static size_t cf_diag_needspace(unsigned int sets) 950 + { 951 + struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); 952 + size_t bytes = 0; 953 + int i; 954 + 955 + for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) { 956 + if (!(sets & cpumf_ctr_ctl[i])) 957 + continue; 958 + bytes += cf_diag_ctrset_size(i, &cpuhw->info) * sizeof(u64) + 959 + sizeof(((struct s390_ctrset_setdata *)0)->set) + 960 + sizeof(((struct s390_ctrset_setdata *)0)->no_cnts); 961 + } 962 + bytes = sizeof(((struct s390_ctrset_read *)0)->no_cpus) + nr_cpu_ids * 963 + (bytes + sizeof(((struct s390_ctrset_cpudata *)0)->cpu_nr) + 964 + sizeof(((struct s390_ctrset_cpudata *)0)->no_sets)); 965 + debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__, 966 + bytes); 967 + return bytes; 968 + } 969 + 970 + static long cf_diag_ioctl_read(unsigned long arg) 971 + { 972 + struct s390_ctrset_read read; 973 + int ret = 0; 974 + 975 + debug_sprintf_event(cf_diag_dbg, 5, "%s\n", __func__); 976 + if (copy_from_user(&read, (char __user *)arg, sizeof(read))) 977 + return -EFAULT; 978 + ret = cf_diag_all_read(arg); 979 + debug_sprintf_event(cf_diag_dbg, 5, "%s ret %d\n", __func__, ret); 980 + return ret; 981 + } 982 + 983 + static long cf_diag_ioctl_stop(void) 984 + { 985 + int ret; 986 + 987 + debug_sprintf_event(cf_diag_dbg, 5, "%s\n", __func__); 988 + ret = cf_diag_all_stop(); 989 + cf_diag_ctrset_clear(); 990 + debug_sprintf_event(cf_diag_dbg, 5, "%s ret %d\n", __func__, ret); 991 + return ret; 992 + } 993 + 994 + static long cf_diag_ioctl_start(unsigned long arg) 995 + { 996 + struct s390_ctrset_start __user *ustart; 997 + struct s390_ctrset_start start; 998 + void __user *umask; 999 + unsigned int len; 1000 + int ret = 0; 1001 + size_t need; 1002 + 1003 + if (cf_diag_ctrset.ctrset) 1004 + return -EBUSY; 1005 + ustart = (struct s390_ctrset_start __user *)arg; 1006 + if (copy_from_user(&start, ustart, sizeof(start))) 1007 + return -EFAULT; 1008 + if (start.version != S390_HWCTR_START_VERSION) 1009 + return -EINVAL; 1010 + if (start.counter_sets & ~(cpumf_ctr_ctl[CPUMF_CTR_SET_BASIC] | 1011 + cpumf_ctr_ctl[CPUMF_CTR_SET_USER] | 1012 + cpumf_ctr_ctl[CPUMF_CTR_SET_CRYPTO] | 1013 + cpumf_ctr_ctl[CPUMF_CTR_SET_EXT] | 1014 + cpumf_ctr_ctl[CPUMF_CTR_SET_MT_DIAG])) 1015 + return -EINVAL; /* Invalid counter set */ 1016 + if (!start.counter_sets) 1017 + return -EINVAL; /* No counter set at all? */ 1018 + cpumask_clear(&cf_diag_ctrset.mask); 1019 + len = min_t(u64, start.cpumask_len, cpumask_size()); 1020 + umask = (void __user *)start.cpumask; 1021 + if (copy_from_user(&cf_diag_ctrset.mask, umask, len)) 1022 + return -EFAULT; 1023 + if (cpumask_empty(&cf_diag_ctrset.mask)) 1024 + return -EINVAL; 1025 + need = cf_diag_needspace(start.counter_sets); 1026 + if (put_user(need, &ustart->data_bytes)) 1027 + ret = -EFAULT; 1028 + if (ret) 1029 + goto out; 1030 + cf_diag_ctrset.ctrset = start.counter_sets; 1031 + ret = cf_diag_all_start(); 1032 + out: 1033 + if (ret) 1034 + cf_diag_ctrset_clear(); 1035 + debug_sprintf_event(cf_diag_dbg, 2, "%s sets %#lx need %ld ret %d\n", 1036 + __func__, cf_diag_ctrset.ctrset, need, ret); 1037 + return ret; 1038 + } 1039 + 1040 + static long cf_diag_ioctl(struct file *file, unsigned int cmd, 1041 + unsigned long arg) 1042 + { 1043 + int ret; 1044 + 1045 + debug_sprintf_event(cf_diag_dbg, 2, "%s cmd %#x arg %lx\n", __func__, 1046 + cmd, arg); 1047 + get_online_cpus(); 1048 + mutex_lock(&cf_diag_ctrset_mutex); 1049 + switch (cmd) { 1050 + case S390_HWCTR_START: 1051 + ret = cf_diag_ioctl_start(arg); 1052 + break; 1053 + case S390_HWCTR_STOP: 1054 + ret = cf_diag_ioctl_stop(); 1055 + break; 1056 + case S390_HWCTR_READ: 1057 + ret = cf_diag_ioctl_read(arg); 1058 + break; 1059 + default: 1060 + ret = -ENOTTY; 1061 + break; 1062 + } 1063 + mutex_unlock(&cf_diag_ctrset_mutex); 1064 + put_online_cpus(); 1065 + debug_sprintf_event(cf_diag_dbg, 2, "%s ret %d\n", __func__, ret); 1066 + return ret; 1067 + } 1068 + 1069 + static const struct file_operations cf_diag_fops = { 1070 + .owner = THIS_MODULE, 1071 + .open = cf_diag_open, 1072 + .release = cf_diag_release, 1073 + .unlocked_ioctl = cf_diag_ioctl, 1074 + .compat_ioctl = cf_diag_ioctl, 1075 + .llseek = no_llseek 1076 + }; 1077 + 1078 + static struct miscdevice cf_diag_dev = { 1079 + .name = S390_HWCTR_DEVICE, 1080 + .minor = MISC_DYNAMIC_MINOR, 1081 + .fops = &cf_diag_fops, 1082 + }; 1083 + 1084 + static int cf_diag_online_cpu(unsigned int cpu) 1085 + { 1086 + struct cf_diag_call_on_cpu_parm p; 1087 + 1088 + mutex_lock(&cf_diag_ctrset_mutex); 1089 + if (!cf_diag_ctrset.ctrset) 1090 + goto out; 1091 + p.sets = cf_diag_ctrset.ctrset; 1092 + cf_diag_ioctl_on(&p); 1093 + out: 1094 + mutex_unlock(&cf_diag_ctrset_mutex); 1095 + return 0; 1096 + } 1097 + 1098 + static int cf_diag_offline_cpu(unsigned int cpu) 1099 + { 1100 + struct cf_diag_call_on_cpu_parm p; 1101 + 1102 + mutex_lock(&cf_diag_ctrset_mutex); 1103 + if (!cf_diag_ctrset.ctrset) 1104 + goto out; 1105 + p.sets = cf_diag_ctrset.ctrset; 1106 + cf_diag_ioctl_off(&p); 1107 + out: 1108 + mutex_unlock(&cf_diag_ctrset_mutex); 1109 + return 0; 1110 + } 1111 + 700 1112 /* Initialize the counter set PMU to generate complete counter set data as 701 1113 * event raw data. This relies on the CPU Measurement Counter Facility device 702 1114 * already being loaded and initialized. ··· 1165 685 return -ENOMEM; 1166 686 } 1167 687 688 + rc = misc_register(&cf_diag_dev); 689 + if (rc) { 690 + pr_err("Registration of /dev/" S390_HWCTR_DEVICE 691 + "failed rc=%d\n", rc); 692 + goto out; 693 + } 694 + 1168 695 /* Setup s390dbf facility */ 1169 696 cf_diag_dbg = debug_register(KMSG_COMPONENT, 2, 1, 128); 1170 697 if (!cf_diag_dbg) { 1171 698 pr_err("Registration of s390dbf(cpum_cf_diag) failed\n"); 1172 - return -ENOMEM; 699 + rc = -ENOMEM; 700 + goto out_dbf; 1173 701 } 1174 702 debug_register_view(cf_diag_dbg, &debug_sprintf_view); 1175 703 1176 704 rc = perf_pmu_register(&cf_diag, "cpum_cf_diag", -1); 1177 705 if (rc) { 1178 - debug_unregister_view(cf_diag_dbg, &debug_sprintf_view); 1179 - debug_unregister(cf_diag_dbg); 1180 706 pr_err("Registration of PMU(cpum_cf_diag) failed with rc=%i\n", 1181 707 rc); 708 + goto out_perf; 1182 709 } 710 + rc = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_S390_CFD_ONLINE, 711 + "perf/s390/cfd:online", 712 + cf_diag_online_cpu, cf_diag_offline_cpu); 713 + if (!rc) 714 + goto out; 715 + 716 + pr_err("Registration of CPUHP_AP_PERF_S390_CFD_ONLINE failed rc=%i\n", 717 + rc); 718 + perf_pmu_unregister(&cf_diag); 719 + out_perf: 720 + debug_unregister_view(cf_diag_dbg, &debug_sprintf_view); 721 + debug_unregister(cf_diag_dbg); 722 + out_dbf: 723 + misc_deregister(&cf_diag_dev); 724 + out: 1183 725 return rc; 1184 726 } 1185 - arch_initcall(cf_diag_init); 727 + device_initcall(cf_diag_init);
+20 -8
arch/s390/kernel/smp.c
··· 30 30 #include <linux/delay.h> 31 31 #include <linux/interrupt.h> 32 32 #include <linux/irqflags.h> 33 + #include <linux/irq_work.h> 33 34 #include <linux/cpu.h> 34 35 #include <linux/slab.h> 35 36 #include <linux/sched/hotplug.h> ··· 63 62 ec_call_function_single, 64 63 ec_stop_cpu, 65 64 ec_mcck_pending, 65 + ec_irq_work, 66 66 }; 67 67 68 68 enum { ··· 436 434 */ 437 435 void notrace smp_emergency_stop(void) 438 436 { 439 - cpumask_t cpumask; 437 + static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED; 438 + static cpumask_t cpumask; 440 439 u64 end; 441 440 int cpu; 442 441 442 + arch_spin_lock(&lock); 443 443 cpumask_copy(&cpumask, cpu_online_mask); 444 444 cpumask_clear_cpu(smp_processor_id(), &cpumask); 445 445 ··· 462 458 break; 463 459 cpu_relax(); 464 460 } 461 + arch_spin_unlock(&lock); 465 462 } 466 463 NOKPROBE_SYMBOL(smp_emergency_stop); 467 464 ··· 510 505 generic_smp_call_function_single_interrupt(); 511 506 if (test_bit(ec_mcck_pending, &bits)) 512 507 __s390_handle_mcck(); 508 + if (test_bit(ec_irq_work, &bits)) 509 + irq_work_run(); 513 510 } 514 511 515 512 static void do_ext_call_interrupt(struct ext_code ext_code, ··· 543 536 { 544 537 pcpu_ec_call(pcpu_devices + cpu, ec_schedule); 545 538 } 539 + 540 + #ifdef CONFIG_IRQ_WORK 541 + void arch_irq_work_raise(void) 542 + { 543 + pcpu_ec_call(pcpu_devices + smp_processor_id(), ec_irq_work); 544 + } 545 + #endif 546 546 547 547 /* 548 548 * parameter area for the set/clear control bit callbacks ··· 789 775 static int __smp_rescan_cpus(struct sclp_core_info *info, bool early) 790 776 { 791 777 struct sclp_core_entry *core; 792 - cpumask_t avail; 778 + static cpumask_t avail; 793 779 bool configured; 794 780 u16 core_id; 795 781 int nr, i; 796 782 783 + get_online_cpus(); 784 + mutex_lock(&smp_cpu_state_mutex); 797 785 nr = 0; 798 786 cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); 799 787 /* ··· 816 800 configured = i < info->configured; 817 801 nr += smp_add_core(&info->core[i], &avail, configured, early); 818 802 } 803 + mutex_unlock(&smp_cpu_state_mutex); 804 + put_online_cpus(); 819 805 return nr; 820 806 } 821 807 ··· 865 847 pr_info("%d configured CPUs, %d standby CPUs\n", c_cpus, s_cpus); 866 848 867 849 /* Add CPUs present at boot */ 868 - get_online_cpus(); 869 850 __smp_rescan_cpus(info, true); 870 - put_online_cpus(); 871 851 memblock_free_early((unsigned long)info, sizeof(*info)); 872 852 } 873 853 ··· 1194 1178 if (!info) 1195 1179 return -ENOMEM; 1196 1180 smp_get_core_info(info, 0); 1197 - get_online_cpus(); 1198 - mutex_lock(&smp_cpu_state_mutex); 1199 1181 nr = __smp_rescan_cpus(info, false); 1200 - mutex_unlock(&smp_cpu_state_mutex); 1201 - put_online_cpus(); 1202 1182 kfree(info); 1203 1183 if (nr) 1204 1184 topology_schedule_update();
+13 -12
arch/s390/kernel/topology.c
··· 62 62 struct cpu_topology_s390 cpu_topology[NR_CPUS]; 63 63 EXPORT_SYMBOL_GPL(cpu_topology); 64 64 65 - static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) 65 + static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int cpu) 66 66 { 67 - cpumask_t mask; 67 + static cpumask_t mask; 68 68 69 69 cpumask_copy(&mask, cpumask_of(cpu)); 70 70 switch (topology_mode) { 71 71 case TOPOLOGY_MODE_HW: 72 72 while (info) { 73 73 if (cpumask_test_cpu(cpu, &info->mask)) { 74 - mask = info->mask; 74 + cpumask_copy(&mask, &info->mask); 75 75 break; 76 76 } 77 77 info = info->next; ··· 89 89 break; 90 90 } 91 91 cpumask_and(&mask, &mask, cpu_online_mask); 92 - return mask; 92 + cpumask_copy(dst, &mask); 93 93 } 94 94 95 - static cpumask_t cpu_thread_map(unsigned int cpu) 95 + static void cpu_thread_map(cpumask_t *dst, unsigned int cpu) 96 96 { 97 - cpumask_t mask; 97 + static cpumask_t mask; 98 98 int i; 99 99 100 100 cpumask_copy(&mask, cpumask_of(cpu)); 101 101 if (topology_mode != TOPOLOGY_MODE_HW) 102 - return mask; 102 + goto out; 103 103 cpu -= cpu % (smp_cpu_mtid + 1); 104 104 for (i = 0; i <= smp_cpu_mtid; i++) 105 105 if (cpu_present(cpu + i)) 106 106 cpumask_set_cpu(cpu + i, &mask); 107 107 cpumask_and(&mask, &mask, cpu_online_mask); 108 - return mask; 108 + out: 109 + cpumask_copy(dst, &mask); 109 110 } 110 111 111 112 #define TOPOLOGY_CORE_BITS 64 ··· 251 250 252 251 for_each_possible_cpu(cpu) { 253 252 topo = &cpu_topology[cpu]; 254 - topo->thread_mask = cpu_thread_map(cpu); 255 - topo->core_mask = cpu_group_map(&socket_info, cpu); 256 - topo->book_mask = cpu_group_map(&book_info, cpu); 257 - topo->drawer_mask = cpu_group_map(&drawer_info, cpu); 253 + cpu_thread_map(&topo->thread_mask, cpu); 254 + cpu_group_map(&topo->core_mask, &socket_info, cpu); 255 + cpu_group_map(&topo->book_mask, &book_info, cpu); 256 + cpu_group_map(&topo->drawer_mask, &drawer_info, cpu); 258 257 topo->booted_cores = 0; 259 258 if (topology_mode != TOPOLOGY_MODE_HW) { 260 259 id = topology_mode == TOPOLOGY_MODE_PACKAGE ? 0 : cpu;
+11 -11
arch/s390/mm/pgalloc.c
··· 58 58 if (!page) 59 59 return NULL; 60 60 arch_set_page_dat(page, 2); 61 - return (unsigned long *) page_to_phys(page); 61 + return (unsigned long *) page_to_virt(page); 62 62 } 63 63 64 64 void crst_table_free(struct mm_struct *mm, unsigned long *table) ··· 161 161 162 162 page = alloc_page(GFP_KERNEL); 163 163 if (page) { 164 - table = (u64 *)page_to_phys(page); 164 + table = (u64 *)page_to_virt(page); 165 165 memset64(table, _PAGE_INVALID, PTRS_PER_PTE); 166 166 memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); 167 167 } ··· 194 194 mask = atomic_read(&page->_refcount) >> 24; 195 195 mask = (mask | (mask >> 4)) & 3; 196 196 if (mask != 3) { 197 - table = (unsigned long *) page_to_phys(page); 197 + table = (unsigned long *) page_to_virt(page); 198 198 bit = mask & 1; /* =1 -> second 2K */ 199 199 if (bit) 200 200 table += PTRS_PER_PTE; ··· 217 217 } 218 218 arch_set_page_dat(page, 0); 219 219 /* Initialize page table */ 220 - table = (unsigned long *) page_to_phys(page); 220 + table = (unsigned long *) page_to_virt(page); 221 221 if (mm_alloc_pgste(mm)) { 222 222 /* Return 4K page table with PGSTEs */ 223 223 atomic_xor_bits(&page->_refcount, 3 << 24); ··· 239 239 struct page *page; 240 240 unsigned int bit, mask; 241 241 242 - page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 242 + page = virt_to_page(table); 243 243 if (!mm_alloc_pgste(mm)) { 244 244 /* Free 2K page table fragment of a 4K page */ 245 - bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); 245 + bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); 246 246 spin_lock_bh(&mm->context.lock); 247 247 mask = atomic_xor_bits(&page->_refcount, 1U << (bit + 24)); 248 248 mask >>= 24; ··· 269 269 unsigned int bit, mask; 270 270 271 271 mm = tlb->mm; 272 - page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 272 + page = virt_to_page(table); 273 273 if (mm_alloc_pgste(mm)) { 274 274 gmap_unlink(mm, table, vmaddr); 275 - table = (unsigned long *) (__pa(table) | 3); 275 + table = (unsigned long *) ((unsigned long)table | 3); 276 276 tlb_remove_table(tlb, table); 277 277 return; 278 278 } 279 - bit = (__pa(table) & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); 279 + bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); 280 280 spin_lock_bh(&mm->context.lock); 281 281 mask = atomic_xor_bits(&page->_refcount, 0x11U << (bit + 24)); 282 282 mask >>= 24; ··· 285 285 else 286 286 list_del(&page->lru); 287 287 spin_unlock_bh(&mm->context.lock); 288 - table = (unsigned long *) (__pa(table) | (1U << bit)); 288 + table = (unsigned long *) ((unsigned long) table | (1U << bit)); 289 289 tlb_remove_table(tlb, table); 290 290 } 291 291 ··· 293 293 { 294 294 unsigned int mask = (unsigned long) _table & 3; 295 295 void *table = (void *)((unsigned long) _table ^ mask); 296 - struct page *page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 296 + struct page *page = virt_to_page(table); 297 297 298 298 switch (mask) { 299 299 case 0: /* pmd, pud, or p4d */
+15 -15
arch/s390/mm/vmem.c
··· 27 27 28 28 if (slab_is_available()) 29 29 return (void *)__get_free_pages(GFP_KERNEL, order); 30 - return (void *) memblock_phys_alloc(size, size); 30 + return memblock_alloc(size, size); 31 31 } 32 32 33 33 static void vmem_free_pages(unsigned long addr, int order) 34 34 { 35 35 /* We don't expect boot memory to be removed ever. */ 36 36 if (!slab_is_available() || 37 - WARN_ON_ONCE(PageReserved(phys_to_page(addr)))) 37 + WARN_ON_ONCE(PageReserved(virt_to_page(addr)))) 38 38 return; 39 39 free_pages(addr, order); 40 40 } ··· 57 57 if (slab_is_available()) 58 58 pte = (pte_t *) page_table_alloc(&init_mm); 59 59 else 60 - pte = (pte_t *) memblock_phys_alloc(size, size); 60 + pte = (pte_t *) memblock_alloc(size, size); 61 61 if (!pte) 62 62 return NULL; 63 63 memset64((u64 *)pte, _PAGE_INVALID, PTRS_PER_PTE); ··· 85 85 { 86 86 if (!unused_sub_pmd_start) 87 87 return; 88 - memset(__va(unused_sub_pmd_start), PAGE_UNUSED, 88 + memset((void *)unused_sub_pmd_start, PAGE_UNUSED, 89 89 ALIGN(unused_sub_pmd_start, PMD_SIZE) - unused_sub_pmd_start); 90 90 unused_sub_pmd_start = 0; 91 91 } ··· 98 98 * getting removed (just in case the memmap never gets initialized, 99 99 * e.g., because the memory block never gets onlined). 100 100 */ 101 - memset(__va(start), 0, sizeof(struct page)); 101 + memset((void *)start, 0, sizeof(struct page)); 102 102 } 103 103 104 104 static void vmemmap_use_sub_pmd(unsigned long start, unsigned long end) ··· 119 119 120 120 static void vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end) 121 121 { 122 - void *page = __va(ALIGN_DOWN(start, PMD_SIZE)); 122 + unsigned long page = ALIGN_DOWN(start, PMD_SIZE); 123 123 124 124 vmemmap_flush_unused_sub_pmd(); 125 125 ··· 128 128 129 129 /* Mark the unused parts of the new memmap page PAGE_UNUSED. */ 130 130 if (!IS_ALIGNED(start, PMD_SIZE)) 131 - memset(page, PAGE_UNUSED, start - __pa(page)); 131 + memset((void *)page, PAGE_UNUSED, start - page); 132 132 /* 133 133 * We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of 134 134 * consecutive sections. Remember for the last added PMD the last ··· 141 141 /* Returns true if the PMD is completely unused and can be freed. */ 142 142 static bool vmemmap_unuse_sub_pmd(unsigned long start, unsigned long end) 143 143 { 144 - void *page = __va(ALIGN_DOWN(start, PMD_SIZE)); 144 + unsigned long page = ALIGN_DOWN(start, PMD_SIZE); 145 145 146 146 vmemmap_flush_unused_sub_pmd(); 147 - memset(__va(start), PAGE_UNUSED, end - start); 148 - return !memchr_inv(page, PAGE_UNUSED, PMD_SIZE); 147 + memset((void *)start, PAGE_UNUSED, end - start); 148 + return !memchr_inv((void *)page, PAGE_UNUSED, PMD_SIZE); 149 149 } 150 150 151 151 /* __ref: we'll only call vmemmap_alloc_block() via vmemmap_populate() */ ··· 166 166 if (pte_none(*pte)) 167 167 continue; 168 168 if (!direct) 169 - vmem_free_pages(pfn_to_phys(pte_pfn(*pte)), 0); 169 + vmem_free_pages((unsigned long) pfn_to_virt(pte_pfn(*pte)), 0); 170 170 pte_clear(&init_mm, addr, pte); 171 171 } else if (pte_none(*pte)) { 172 172 if (!direct) { ··· 176 176 goto out; 177 177 pte_val(*pte) = __pa(new_page) | prot; 178 178 } else { 179 - pte_val(*pte) = addr | prot; 179 + pte_val(*pte) = __pa(addr) | prot; 180 180 } 181 181 } else { 182 182 continue; ··· 201 201 if (!pte_none(*pte)) 202 202 return; 203 203 } 204 - vmem_pte_free(__va(pmd_deref(*pmd))); 204 + vmem_pte_free((unsigned long *) pmd_deref(*pmd)); 205 205 pmd_clear(pmd); 206 206 } 207 207 ··· 242 242 IS_ALIGNED(next, PMD_SIZE) && 243 243 MACHINE_HAS_EDAT1 && addr && direct && 244 244 !debug_pagealloc_enabled()) { 245 - pmd_val(*pmd) = addr | prot; 245 + pmd_val(*pmd) = __pa(addr) | prot; 246 246 pages++; 247 247 continue; 248 248 } else if (!direct && MACHINE_HAS_EDAT1) { ··· 338 338 IS_ALIGNED(next, PUD_SIZE) && 339 339 MACHINE_HAS_EDAT2 && addr && direct && 340 340 !debug_pagealloc_enabled()) { 341 - pud_val(*pud) = addr | prot; 341 + pud_val(*pud) = __pa(addr) | prot; 342 342 pages++; 343 343 continue; 344 344 }
+1 -1
arch/s390/tools/opcodes.txt
··· 597 597 b9bd trtre RRF_U0RR 598 598 b9be srstu RRE_RR 599 599 b9bf trte RRF_U0RR 600 - b9c0 selhhhr RRF_RURR 600 + b9c0 selfhr RRF_RURR 601 601 b9c8 ahhhr RRF_R0RR2 602 602 b9c9 shhhr RRF_R0RR2 603 603 b9ca alhhhr RRF_R0RR2
+2 -2
drivers/s390/virtio/virtio_ccw.c
··· 117 117 }; 118 118 119 119 /* the highest virtio-ccw revision we support */ 120 - #define VIRTIO_CCW_REV_MAX 1 120 + #define VIRTIO_CCW_REV_MAX 2 121 121 122 122 struct virtio_ccw_vq_info { 123 123 struct virtqueue *vq; ··· 952 952 u8 old_status = vcdev->dma_area->status; 953 953 struct ccw1 *ccw; 954 954 955 - if (vcdev->revision < 1) 955 + if (vcdev->revision < 2) 956 956 return vcdev->dma_area->status; 957 957 958 958 ccw = ccw_device_dma_zalloc(vcdev->cdev, sizeof(*ccw));
+1
include/linux/cpuhotplug.h
··· 168 168 CPUHP_AP_PERF_X86_CQM_ONLINE, 169 169 CPUHP_AP_PERF_X86_CSTATE_ONLINE, 170 170 CPUHP_AP_PERF_S390_CF_ONLINE, 171 + CPUHP_AP_PERF_S390_CFD_ONLINE, 171 172 CPUHP_AP_PERF_S390_SF_ONLINE, 172 173 CPUHP_AP_PERF_ARM_CCI_ONLINE, 173 174 CPUHP_AP_PERF_ARM_CCN_ONLINE,