mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
fbc90c042c
walkers") is known to cause a performance regression (https://lore.kernel.org/all/3acefad9-96e5-4681-8014-827d6be71c7a@linux.ibm.com/T/#mfa809800a7862fb5bdf834c6f71a3a5113eb83ff). Yu has a fix which I'll send along later via the hotfixes branch. - In the series "mm: Avoid possible overflows in dirty throttling" Jan Kara addresses a couple of issues in the writeback throttling code. These fixes are also targetted at -stable kernels. - Ryusuke Konishi's series "nilfs2: fix potential issues related to reserved inodes" does that. This should actually be in the mm-nonmm-stable tree, along with the many other nilfs2 patches. My bad. - More folio conversions from Kefeng Wang in the series "mm: convert to folio_alloc_mpol()" - Kemeng Shi has sent some cleanups to the writeback code in the series "Add helper functions to remove repeated code and improve readability of cgroup writeback" - Kairui Song has made the swap code a little smaller and a little faster in the series "mm/swap: clean up and optimize swap cache index". - In the series "mm/memory: cleanly support zeropage in vm_insert_page*(), vm_map_pages*() and vmf_insert_mixed()" David Hildenbrand has reworked the rather sketchy handling of the use of the zeropage in MAP_SHARED mappings. I don't see any runtime effects here - more a cleanup/understandability/maintainablity thing. - Dev Jain has improved selftests/mm/va_high_addr_switch.c's handling of higher addresses, for aarch64. The (poorly named) series is "Restructure va_high_addr_switch". - The core TLB handling code gets some cleanups and possible slight optimizations in Bang Li's series "Add update_mmu_tlb_range() to simplify code". - Jane Chu has improved the handling of our fake-an-unrecoverable-memory-error testing feature MADV_HWPOISON in the series "Enhance soft hwpoison handling and injection". - Jeff Johnson has sent a billion patches everywhere to add MODULE_DESCRIPTION() to everything. Some landed in this pull. - In the series "mm: cleanup MIGRATE_SYNC_NO_COPY mode", Kefeng Wang has simplified migration's use of hardware-offload memory copying. - Yosry Ahmed performs more folio API conversions in his series "mm: zswap: trivial folio conversions". - In the series "large folios swap-in: handle refault cases first", Chuanhua Han inches us forward in the handling of large pages in the swap code. This is a cleanup and optimization, working toward the end objective of full support of large folio swapin/out. - In the series "mm,swap: cleanup VMA based swap readahead window calculation", Huang Ying has contributed some cleanups and a possible fixlet to his VMA based swap readahead code. - In the series "add mTHP support for anonymous shmem" Baolin Wang has taught anonymous shmem mappings to use multisize THP. By default this is a no-op - users must opt in vis sysfs controls. Dramatic improvements in pagefault latency are realized. - David Hildenbrand has some cleanups to our remaining use of page_mapcount() in the series "fs/proc: move page_mapcount() to fs/proc/internal.h". - David also has some highmem accounting cleanups in the series "mm/highmem: don't track highmem pages manually". - Build-time fixes and cleanups from John Hubbard in the series "cleanups, fixes, and progress towards avoiding "make headers"". - Cleanups and consolidation of the core pagemap handling from Barry Song in the series "mm: introduce pmd|pte_needs_soft_dirty_wp helpers and utilize them". - Lance Yang's series "Reclaim lazyfree THP without splitting" has reduced the latency of the reclaim of pmd-mapped THPs under fairly common circumstances. A 10x speedup is seen in a microbenchmark. It does this by punting to aother CPU but I guess that's a win unless all CPUs are pegged. - hugetlb_cgroup cleanups from Xiu Jianfeng in the series "mm/hugetlb_cgroup: rework on cftypes". - Miaohe Lin's series "Some cleanups for memory-failure" does just that thing. - Is anyone reading this stuff? If so, email me! - Someone other than SeongJae has developed a DAMON feature in Honggyu Kim's series "DAMON based tiered memory management for CXL memory". This adds DAMON features which may be used to help determine the efficiency of our placement of CXL/PCIe attached DRAM. - DAMON user API centralization and simplificatio work in SeongJae Park's series "mm/damon: introduce DAMON parameters online commit function". - In the series "mm: page_type, zsmalloc and page_mapcount_reset()" David Hildenbrand does some maintenance work on zsmalloc - partially modernizing its use of pageframe fields. - Kefeng Wang provides more folio conversions in the series "mm: remove page_maybe_dma_pinned() and page_mkclean()". - More cleanup from David Hildenbrand, this time in the series "mm/memory_hotplug: use PageOffline() instead of PageReserved() for !ZONE_DEVICE". It "enlightens memory hotplug more about PageOffline() pages" and permits the removal of some virtio-mem hacks. - Barry Song's series "mm: clarify folio_add_new_anon_rmap() and __folio_add_anon_rmap()" is a cleanup to the anon folio handling in preparation for mTHP (multisize THP) swapin. - Kefeng Wang's series "mm: improve clear and copy user folio" implements more folio conversions, this time in the area of large folio userspace copying. - The series "Docs/mm/damon/maintaier-profile: document a mailing tool and community meetup series" tells people how to get better involved with other DAMON developers. From SeongJae Park. - A large series ("kmsan: Enable on s390") from Ilya Leoshkevich does that. - David Hildenbrand sends along more cleanups, this time against the migration code. The series is "mm/migrate: move NUMA hinting fault folio isolation + checks under PTL". - Jan Kara has found quite a lot of strangenesses and minor errors in the readahead code. He addresses this in the series "mm: Fix various readahead quirks". - SeongJae Park's series "selftests/damon: test DAMOS tried regions and {min,max}_nr_regions" adds features and addresses errors in DAMON's self testing code. - Gavin Shan has found a userspace-triggerable WARN in the pagecache code. The series "mm/filemap: Limit page cache size to that supported by xarray" addresses this. The series is marked cc:stable. - Chengming Zhou's series "mm/ksm: cmp_and_merge_page() optimizations and cleanup" cleans up and slightly optimizes KSM. - Roman Gushchin has separated the memcg-v1 and memcg-v2 code - lots of code motion. The series (which also makes the memcg-v1 code Kconfigurable) are "mm: memcg: separate legacy cgroup v1 code and put under config option" and "mm: memcg: put cgroup v1-specific memcg data under CONFIG_MEMCG_V1" - Dan Schatzberg's series "Add swappiness argument to memory.reclaim" adds an additional feature to this cgroup-v2 control file. - The series "Userspace controls soft-offline pages" from Jiaqi Yan permits userspace to stop the kernel's automatic treatment of excessive correctable memory errors. In order to permit userspace to monitor and handle this situation. - Kefeng Wang's series "mm: migrate: support poison recover from migrate folio" teaches the kernel to appropriately handle migration from poisoned source folios rather than simply panicing. - SeongJae Park's series "Docs/damon: minor fixups and improvements" does those things. - In the series "mm/zsmalloc: change back to per-size_class lock" Chengming Zhou improves zsmalloc's scalability and memory utilization. - Vivek Kasireddy's series "mm/gup: Introduce memfd_pin_folios() for pinning memfd folios" makes the GUP code use FOLL_PIN rather than bare refcount increments. So these paes can first be moved aside if they reside in the movable zone or a CMA block. - Andrii Nakryiko has added a binary ioctl()-based API to /proc/pid/maps for much faster reading of vma information. The series is "query VMAs from /proc/<pid>/maps". - In the series "mm: introduce per-order mTHP split counters" Lance Yang improves the kernel's presentation of developer information related to multisize THP splitting. - Michael Ellerman has developed the series "Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)". This permits userspace to use all available huge page sizes. - In the series "revert unconditional slab and page allocator fault injection calls" Vlastimil Babka removes a performance-affecting and not very useful feature from slab fault injection. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZp2C+QAKCRDdBJ7gKXxA joTkAQDvjqOoFStqk4GU3OXMYB7WCU/ZQMFG0iuu1EEwTVDZ4QEA8CnG7seek1R3 xEoo+vw0sWWeLV3qzsxnCA1BJ8cTJA8= =z0Lf -----END PGP SIGNATURE----- Merge tag 'mm-stable-2024-07-21-14-50' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull MM updates from Andrew Morton: - In the series "mm: Avoid possible overflows in dirty throttling" Jan Kara addresses a couple of issues in the writeback throttling code. These fixes are also targetted at -stable kernels. - Ryusuke Konishi's series "nilfs2: fix potential issues related to reserved inodes" does that. This should actually be in the mm-nonmm-stable tree, along with the many other nilfs2 patches. My bad. - More folio conversions from Kefeng Wang in the series "mm: convert to folio_alloc_mpol()" - Kemeng Shi has sent some cleanups to the writeback code in the series "Add helper functions to remove repeated code and improve readability of cgroup writeback" - Kairui Song has made the swap code a little smaller and a little faster in the series "mm/swap: clean up and optimize swap cache index". - In the series "mm/memory: cleanly support zeropage in vm_insert_page*(), vm_map_pages*() and vmf_insert_mixed()" David Hildenbrand has reworked the rather sketchy handling of the use of the zeropage in MAP_SHARED mappings. I don't see any runtime effects here - more a cleanup/understandability/maintainablity thing. - Dev Jain has improved selftests/mm/va_high_addr_switch.c's handling of higher addresses, for aarch64. The (poorly named) series is "Restructure va_high_addr_switch". - The core TLB handling code gets some cleanups and possible slight optimizations in Bang Li's series "Add update_mmu_tlb_range() to simplify code". - Jane Chu has improved the handling of our fake-an-unrecoverable-memory-error testing feature MADV_HWPOISON in the series "Enhance soft hwpoison handling and injection". - Jeff Johnson has sent a billion patches everywhere to add MODULE_DESCRIPTION() to everything. Some landed in this pull. - In the series "mm: cleanup MIGRATE_SYNC_NO_COPY mode", Kefeng Wang has simplified migration's use of hardware-offload memory copying. - Yosry Ahmed performs more folio API conversions in his series "mm: zswap: trivial folio conversions". - In the series "large folios swap-in: handle refault cases first", Chuanhua Han inches us forward in the handling of large pages in the swap code. This is a cleanup and optimization, working toward the end objective of full support of large folio swapin/out. - In the series "mm,swap: cleanup VMA based swap readahead window calculation", Huang Ying has contributed some cleanups and a possible fixlet to his VMA based swap readahead code. - In the series "add mTHP support for anonymous shmem" Baolin Wang has taught anonymous shmem mappings to use multisize THP. By default this is a no-op - users must opt in vis sysfs controls. Dramatic improvements in pagefault latency are realized. - David Hildenbrand has some cleanups to our remaining use of page_mapcount() in the series "fs/proc: move page_mapcount() to fs/proc/internal.h". - David also has some highmem accounting cleanups in the series "mm/highmem: don't track highmem pages manually". - Build-time fixes and cleanups from John Hubbard in the series "cleanups, fixes, and progress towards avoiding "make headers"". - Cleanups and consolidation of the core pagemap handling from Barry Song in the series "mm: introduce pmd|pte_needs_soft_dirty_wp helpers and utilize them". - Lance Yang's series "Reclaim lazyfree THP without splitting" has reduced the latency of the reclaim of pmd-mapped THPs under fairly common circumstances. A 10x speedup is seen in a microbenchmark. It does this by punting to aother CPU but I guess that's a win unless all CPUs are pegged. - hugetlb_cgroup cleanups from Xiu Jianfeng in the series "mm/hugetlb_cgroup: rework on cftypes". - Miaohe Lin's series "Some cleanups for memory-failure" does just that thing. - Someone other than SeongJae has developed a DAMON feature in Honggyu Kim's series "DAMON based tiered memory management for CXL memory". This adds DAMON features which may be used to help determine the efficiency of our placement of CXL/PCIe attached DRAM. - DAMON user API centralization and simplificatio work in SeongJae Park's series "mm/damon: introduce DAMON parameters online commit function". - In the series "mm: page_type, zsmalloc and page_mapcount_reset()" David Hildenbrand does some maintenance work on zsmalloc - partially modernizing its use of pageframe fields. - Kefeng Wang provides more folio conversions in the series "mm: remove page_maybe_dma_pinned() and page_mkclean()". - More cleanup from David Hildenbrand, this time in the series "mm/memory_hotplug: use PageOffline() instead of PageReserved() for !ZONE_DEVICE". It "enlightens memory hotplug more about PageOffline() pages" and permits the removal of some virtio-mem hacks. - Barry Song's series "mm: clarify folio_add_new_anon_rmap() and __folio_add_anon_rmap()" is a cleanup to the anon folio handling in preparation for mTHP (multisize THP) swapin. - Kefeng Wang's series "mm: improve clear and copy user folio" implements more folio conversions, this time in the area of large folio userspace copying. - The series "Docs/mm/damon/maintaier-profile: document a mailing tool and community meetup series" tells people how to get better involved with other DAMON developers. From SeongJae Park. - A large series ("kmsan: Enable on s390") from Ilya Leoshkevich does that. - David Hildenbrand sends along more cleanups, this time against the migration code. The series is "mm/migrate: move NUMA hinting fault folio isolation + checks under PTL". - Jan Kara has found quite a lot of strangenesses and minor errors in the readahead code. He addresses this in the series "mm: Fix various readahead quirks". - SeongJae Park's series "selftests/damon: test DAMOS tried regions and {min,max}_nr_regions" adds features and addresses errors in DAMON's self testing code. - Gavin Shan has found a userspace-triggerable WARN in the pagecache code. The series "mm/filemap: Limit page cache size to that supported by xarray" addresses this. The series is marked cc:stable. - Chengming Zhou's series "mm/ksm: cmp_and_merge_page() optimizations and cleanup" cleans up and slightly optimizes KSM. - Roman Gushchin has separated the memcg-v1 and memcg-v2 code - lots of code motion. The series (which also makes the memcg-v1 code Kconfigurable) are "mm: memcg: separate legacy cgroup v1 code and put under config option" and "mm: memcg: put cgroup v1-specific memcg data under CONFIG_MEMCG_V1" - Dan Schatzberg's series "Add swappiness argument to memory.reclaim" adds an additional feature to this cgroup-v2 control file. - The series "Userspace controls soft-offline pages" from Jiaqi Yan permits userspace to stop the kernel's automatic treatment of excessive correctable memory errors. In order to permit userspace to monitor and handle this situation. - Kefeng Wang's series "mm: migrate: support poison recover from migrate folio" teaches the kernel to appropriately handle migration from poisoned source folios rather than simply panicing. - SeongJae Park's series "Docs/damon: minor fixups and improvements" does those things. - In the series "mm/zsmalloc: change back to per-size_class lock" Chengming Zhou improves zsmalloc's scalability and memory utilization. - Vivek Kasireddy's series "mm/gup: Introduce memfd_pin_folios() for pinning memfd folios" makes the GUP code use FOLL_PIN rather than bare refcount increments. So these paes can first be moved aside if they reside in the movable zone or a CMA block. - Andrii Nakryiko has added a binary ioctl()-based API to /proc/pid/maps for much faster reading of vma information. The series is "query VMAs from /proc/<pid>/maps". - In the series "mm: introduce per-order mTHP split counters" Lance Yang improves the kernel's presentation of developer information related to multisize THP splitting. - Michael Ellerman has developed the series "Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)". This permits userspace to use all available huge page sizes. - In the series "revert unconditional slab and page allocator fault injection calls" Vlastimil Babka removes a performance-affecting and not very useful feature from slab fault injection. * tag 'mm-stable-2024-07-21-14-50' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (411 commits) mm/mglru: fix ineffective protection calculation mm/zswap: fix a white space issue mm/hugetlb: fix kernel NULL pointer dereference when migrating hugetlb folio mm/hugetlb: fix possible recursive locking detected warning mm/gup: clear the LRU flag of a page before adding to LRU batch mm/numa_balancing: teach mpol_to_str about the balancing mode mm: memcg1: convert charge move flags to unsigned long long alloc_tag: fix page_ext_get/page_ext_put sequence during page splitting lib: reuse page_ext_data() to obtain codetag_ref lib: add missing newline character in the warning message mm/mglru: fix overshooting shrinker memory mm/mglru: fix div-by-zero in vmpressure_calc_level() mm/kmemleak: replace strncpy() with strscpy() mm, page_alloc: put should_fail_alloc_page() back behing CONFIG_FAIL_PAGE_ALLOC mm, slab: put should_failslab() back behind CONFIG_SHOULD_FAILSLAB mm: ignore data-race in __swap_writepage hugetlbfs: ensure generic_hugetlb_get_unmapped_area() returns higher address than mmap_min_addr mm: shmem: rename mTHP shmem counters mm: swap_state: use folio_alloc_mpol() in __read_swap_cache_async() mm/migrate: putback split folios when numa hint migration fails ...
306 lines
8.5 KiB
C
306 lines
8.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Implementation of s390 diagnose codes
|
|
*
|
|
* Copyright IBM Corp. 2007
|
|
* Author(s): Michael Holzheu <holzheu@de.ibm.com>
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/init.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <asm/asm-extable.h>
|
|
#include <asm/diag.h>
|
|
#include <asm/trace/diag.h>
|
|
#include <asm/sections.h>
|
|
#include "entry.h"
|
|
|
|
struct diag_stat {
|
|
unsigned int counter[NR_DIAG_STAT];
|
|
};
|
|
|
|
static DEFINE_PER_CPU(struct diag_stat, diag_stat);
|
|
|
|
struct diag_desc {
|
|
int code;
|
|
char *name;
|
|
};
|
|
|
|
static const struct diag_desc diag_map[NR_DIAG_STAT] = {
|
|
[DIAG_STAT_X008] = { .code = 0x008, .name = "Console Function" },
|
|
[DIAG_STAT_X00C] = { .code = 0x00c, .name = "Pseudo Timer" },
|
|
[DIAG_STAT_X010] = { .code = 0x010, .name = "Release Pages" },
|
|
[DIAG_STAT_X014] = { .code = 0x014, .name = "Spool File Services" },
|
|
[DIAG_STAT_X044] = { .code = 0x044, .name = "Voluntary Timeslice End" },
|
|
[DIAG_STAT_X064] = { .code = 0x064, .name = "NSS Manipulation" },
|
|
[DIAG_STAT_X08C] = { .code = 0x08c, .name = "Access 3270 Display Device Information" },
|
|
[DIAG_STAT_X09C] = { .code = 0x09c, .name = "Relinquish Timeslice" },
|
|
[DIAG_STAT_X0DC] = { .code = 0x0dc, .name = "Appldata Control" },
|
|
[DIAG_STAT_X204] = { .code = 0x204, .name = "Logical-CPU Utilization" },
|
|
[DIAG_STAT_X210] = { .code = 0x210, .name = "Device Information" },
|
|
[DIAG_STAT_X224] = { .code = 0x224, .name = "EBCDIC-Name Table" },
|
|
[DIAG_STAT_X250] = { .code = 0x250, .name = "Block I/O" },
|
|
[DIAG_STAT_X258] = { .code = 0x258, .name = "Page-Reference Services" },
|
|
[DIAG_STAT_X26C] = { .code = 0x26c, .name = "Certain System Information" },
|
|
[DIAG_STAT_X288] = { .code = 0x288, .name = "Time Bomb" },
|
|
[DIAG_STAT_X2C4] = { .code = 0x2c4, .name = "FTP Services" },
|
|
[DIAG_STAT_X2FC] = { .code = 0x2fc, .name = "Guest Performance Data" },
|
|
[DIAG_STAT_X304] = { .code = 0x304, .name = "Partition-Resource Service" },
|
|
[DIAG_STAT_X308] = { .code = 0x308, .name = "List-Directed IPL" },
|
|
[DIAG_STAT_X318] = { .code = 0x318, .name = "CP Name and Version Codes" },
|
|
[DIAG_STAT_X320] = { .code = 0x320, .name = "Certificate Store" },
|
|
[DIAG_STAT_X500] = { .code = 0x500, .name = "Virtio Service" },
|
|
};
|
|
|
|
struct diag_ops __amode31_ref diag_amode31_ops = {
|
|
.diag210 = _diag210_amode31,
|
|
.diag26c = _diag26c_amode31,
|
|
.diag14 = _diag14_amode31,
|
|
.diag0c = _diag0c_amode31,
|
|
.diag8c = _diag8c_amode31,
|
|
.diag308_reset = _diag308_reset_amode31
|
|
};
|
|
|
|
static struct diag210 _diag210_tmp_amode31 __section(".amode31.data");
|
|
struct diag210 __amode31_ref *__diag210_tmp_amode31 = &_diag210_tmp_amode31;
|
|
|
|
static struct diag8c _diag8c_tmp_amode31 __section(".amode31.data");
|
|
static struct diag8c __amode31_ref *__diag8c_tmp_amode31 = &_diag8c_tmp_amode31;
|
|
|
|
static int show_diag_stat(struct seq_file *m, void *v)
|
|
{
|
|
struct diag_stat *stat;
|
|
unsigned long n = (unsigned long) v - 1;
|
|
int cpu, prec, tmp;
|
|
|
|
cpus_read_lock();
|
|
if (n == 0) {
|
|
seq_puts(m, " ");
|
|
|
|
for_each_online_cpu(cpu) {
|
|
prec = 10;
|
|
for (tmp = 10; cpu >= tmp; tmp *= 10)
|
|
prec--;
|
|
seq_printf(m, "%*s%d", prec, "CPU", cpu);
|
|
}
|
|
seq_putc(m, '\n');
|
|
} else if (n <= NR_DIAG_STAT) {
|
|
seq_printf(m, "diag %03x:", diag_map[n-1].code);
|
|
for_each_online_cpu(cpu) {
|
|
stat = &per_cpu(diag_stat, cpu);
|
|
seq_printf(m, " %10u", stat->counter[n-1]);
|
|
}
|
|
seq_printf(m, " %s\n", diag_map[n-1].name);
|
|
}
|
|
cpus_read_unlock();
|
|
return 0;
|
|
}
|
|
|
|
static void *show_diag_stat_start(struct seq_file *m, loff_t *pos)
|
|
{
|
|
return *pos <= NR_DIAG_STAT ? (void *)((unsigned long) *pos + 1) : NULL;
|
|
}
|
|
|
|
static void *show_diag_stat_next(struct seq_file *m, void *v, loff_t *pos)
|
|
{
|
|
++*pos;
|
|
return show_diag_stat_start(m, pos);
|
|
}
|
|
|
|
static void show_diag_stat_stop(struct seq_file *m, void *v)
|
|
{
|
|
}
|
|
|
|
static const struct seq_operations show_diag_stat_sops = {
|
|
.start = show_diag_stat_start,
|
|
.next = show_diag_stat_next,
|
|
.stop = show_diag_stat_stop,
|
|
.show = show_diag_stat,
|
|
};
|
|
|
|
DEFINE_SEQ_ATTRIBUTE(show_diag_stat);
|
|
|
|
static int __init show_diag_stat_init(void)
|
|
{
|
|
debugfs_create_file("diag_stat", 0400, NULL, NULL,
|
|
&show_diag_stat_fops);
|
|
return 0;
|
|
}
|
|
|
|
device_initcall(show_diag_stat_init);
|
|
|
|
void diag_stat_inc(enum diag_stat_enum nr)
|
|
{
|
|
this_cpu_inc(diag_stat.counter[nr]);
|
|
trace_s390_diagnose(diag_map[nr].code);
|
|
}
|
|
EXPORT_SYMBOL(diag_stat_inc);
|
|
|
|
void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr)
|
|
{
|
|
this_cpu_inc(diag_stat.counter[nr]);
|
|
trace_s390_diagnose_norecursion(diag_map[nr].code);
|
|
}
|
|
EXPORT_SYMBOL(diag_stat_inc_norecursion);
|
|
|
|
/*
|
|
* Diagnose 0c: Pseudo Timer
|
|
*/
|
|
void diag0c(struct hypfs_diag0c_entry *data)
|
|
{
|
|
diag_stat_inc(DIAG_STAT_X00C);
|
|
diag_amode31_ops.diag0c(virt_to_phys(data));
|
|
}
|
|
|
|
/*
|
|
* Diagnose 14: Input spool file manipulation
|
|
*
|
|
* The subcode parameter determines the type of the first parameter rx.
|
|
* Currently used are the following 3 subcommands:
|
|
* 0x0: Read the Next Spool File Buffer (Data Record)
|
|
* 0x28: Position a Spool File to the Designated Record
|
|
* 0xfff: Retrieve Next File Descriptor
|
|
*
|
|
* For subcommands 0x0 and 0xfff, the value of the first parameter is
|
|
* a virtual address of a memory buffer and needs virtual to physical
|
|
* address translation. For other subcommands the rx parameter is not
|
|
* a virtual address.
|
|
*/
|
|
int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
|
|
{
|
|
diag_stat_inc(DIAG_STAT_X014);
|
|
switch (subcode) {
|
|
case 0x0:
|
|
case 0xfff:
|
|
rx = virt_to_phys((void *)rx);
|
|
break;
|
|
default:
|
|
/* Do nothing */
|
|
break;
|
|
}
|
|
return diag_amode31_ops.diag14(rx, ry1, subcode);
|
|
}
|
|
EXPORT_SYMBOL(diag14);
|
|
|
|
#define DIAG204_BUSY_RC 8
|
|
|
|
static inline int __diag204(unsigned long *subcode, unsigned long size, void *addr)
|
|
{
|
|
union register_pair rp = { .even = *subcode, .odd = size };
|
|
|
|
asm volatile(
|
|
" diag %[addr],%[rp],0x204\n"
|
|
"0: nopr %%r7\n"
|
|
EX_TABLE(0b,0b)
|
|
: [rp] "+&d" (rp.pair) : [addr] "d" (addr) : "memory");
|
|
*subcode = rp.even;
|
|
return rp.odd;
|
|
}
|
|
|
|
/**
|
|
* diag204() - Issue diagnose 204 call.
|
|
* @subcode: Subcode of diagnose 204 to be executed.
|
|
* @size: Size of area in pages which @area points to, if given.
|
|
* @addr: Vmalloc'ed memory area where the result is written to.
|
|
*
|
|
* Execute diagnose 204 with the given subcode and write the result to the
|
|
* memory area specified with @addr. For subcodes which do not write a
|
|
* result to memory both @size and @addr must be zero. If @addr is
|
|
* specified it must be page aligned and must have been allocated with
|
|
* vmalloc(). Conversion to real / physical addresses will be handled by
|
|
* this function if required.
|
|
*/
|
|
int diag204(unsigned long subcode, unsigned long size, void *addr)
|
|
{
|
|
if (addr) {
|
|
if (WARN_ON_ONCE(!is_vmalloc_addr(addr)))
|
|
return -EINVAL;
|
|
if (WARN_ON_ONCE(!IS_ALIGNED((unsigned long)addr, PAGE_SIZE)))
|
|
return -EINVAL;
|
|
}
|
|
if ((subcode & DIAG204_SUBCODE_MASK) == DIAG204_SUBC_STIB4)
|
|
addr = (void *)pfn_to_phys(vmalloc_to_pfn(addr));
|
|
diag_stat_inc(DIAG_STAT_X204);
|
|
size = __diag204(&subcode, size, addr);
|
|
if (subcode == DIAG204_BUSY_RC)
|
|
return -EBUSY;
|
|
else if (subcode)
|
|
return -EOPNOTSUPP;
|
|
return size;
|
|
}
|
|
EXPORT_SYMBOL(diag204);
|
|
|
|
/*
|
|
* Diagnose 210: Get information about a virtual device
|
|
*/
|
|
int diag210(struct diag210 *addr)
|
|
{
|
|
static DEFINE_SPINLOCK(diag210_lock);
|
|
unsigned long flags;
|
|
int ccode;
|
|
|
|
spin_lock_irqsave(&diag210_lock, flags);
|
|
*__diag210_tmp_amode31 = *addr;
|
|
|
|
diag_stat_inc(DIAG_STAT_X210);
|
|
ccode = diag_amode31_ops.diag210(__diag210_tmp_amode31);
|
|
|
|
*addr = *__diag210_tmp_amode31;
|
|
spin_unlock_irqrestore(&diag210_lock, flags);
|
|
|
|
return ccode;
|
|
}
|
|
EXPORT_SYMBOL(diag210);
|
|
|
|
/*
|
|
* Diagnose 8C: Access 3270 Display Device Information
|
|
*/
|
|
int diag8c(struct diag8c *addr, struct ccw_dev_id *devno)
|
|
{
|
|
static DEFINE_SPINLOCK(diag8c_lock);
|
|
unsigned long flags;
|
|
int ccode;
|
|
|
|
spin_lock_irqsave(&diag8c_lock, flags);
|
|
|
|
diag_stat_inc(DIAG_STAT_X08C);
|
|
ccode = diag_amode31_ops.diag8c(__diag8c_tmp_amode31, devno, sizeof(*addr));
|
|
|
|
*addr = *__diag8c_tmp_amode31;
|
|
spin_unlock_irqrestore(&diag8c_lock, flags);
|
|
|
|
return ccode;
|
|
}
|
|
EXPORT_SYMBOL(diag8c);
|
|
|
|
int diag224(void *ptr)
|
|
{
|
|
unsigned long addr = __pa(ptr);
|
|
int rc = -EOPNOTSUPP;
|
|
|
|
diag_stat_inc(DIAG_STAT_X224);
|
|
asm volatile("\n"
|
|
" diag %[type],%[addr],0x224\n"
|
|
"0: lhi %[rc],0\n"
|
|
"1:\n"
|
|
EX_TABLE(0b,1b)
|
|
: [rc] "+d" (rc)
|
|
, "=m" (*(struct { char buf[PAGE_SIZE]; } *)ptr)
|
|
: [type] "d" (0), [addr] "d" (addr));
|
|
return rc;
|
|
}
|
|
EXPORT_SYMBOL(diag224);
|
|
|
|
/*
|
|
* Diagnose 26C: Access Certain System Information
|
|
*/
|
|
int diag26c(void *req, void *resp, enum diag26c_sc subcode)
|
|
{
|
|
diag_stat_inc(DIAG_STAT_X26C);
|
|
return diag_amode31_ops.diag26c(virt_to_phys(req), virt_to_phys(resp), subcode);
|
|
}
|
|
EXPORT_SYMBOL(diag26c);
|