mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
d60a540ac5
Pull s390 updates from Heiko Carstens: "Since Martin is on vacation you get the s390 pull request for the v4.15 merge window this time from me. Besides a lot of cleanups and bug fixes these are the most important changes: - a new regset for runtime instrumentation registers - hardware accelerated AES-GCM support for the aes_s390 module - support for the new CEX6S crypto cards - support for FORTIFY_SOURCE - addition of missing z13 and new z14 instructions to the in-kernel disassembler - generate opcode tables for the in-kernel disassembler out of a simple text file instead of having to manually maintain those tables - fast memset16, memset32 and memset64 implementations - removal of named saved segment support - hardware counter support for z14 - queued spinlocks and queued rwlocks implementations for s390 - use the stack_depth tracking feature for s390 BPF JIT - a new s390_sthyi system call which emulates the sthyi (store hypervisor information) instruction - removal of the old KVM virtio transport - an s390 specific CPU alternatives implementation which is used in the new spinlock code" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (88 commits) MAINTAINERS: add virtio-ccw.h to virtio/s390 section s390/noexec: execute kexec datamover without DAT s390: fix transactional execution control register handling s390/bpf: take advantage of stack_depth tracking s390: simplify transactional execution elf hwcap handling s390/zcrypt: Rework struct ap_qact_ap_info. s390/virtio: remove unused header file kvm_virtio.h s390: avoid undefined behaviour s390/disassembler: generate opcode tables from text file s390/disassembler: remove insn_to_mnemonic() s390/dasd: avoid calling do_gettimeofday() s390: vfio-ccw: Do not attempt to free no-op, test and tic cda. s390: remove named saved segment support s390/archrandom: Reconsider s390 arch random implementation s390/pci: do not require AIS facility s390/qdio: sanitize put_indicator s390/qdio: use atomic_cmpxchg s390/nmi: avoid using long-displacement facility s390: pass endianness info to sparse s390/decompressor: remove informational messages ...
193 lines
4.7 KiB
C
193 lines
4.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright IBM Corp. 2016
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
*
|
|
* Adjunct processor bus, card related code.
|
|
*/
|
|
|
|
#define KMSG_COMPONENT "ap"
|
|
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/slab.h>
|
|
#include <asm/facility.h>
|
|
|
|
#include "ap_bus.h"
|
|
#include "ap_asm.h"
|
|
|
|
/*
|
|
* AP card related attributes.
|
|
*/
|
|
static ssize_t ap_hwtype_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", ac->ap_dev.device_type);
|
|
}
|
|
|
|
static DEVICE_ATTR(hwtype, 0444, ap_hwtype_show, NULL);
|
|
|
|
static ssize_t ap_raw_hwtype_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", ac->raw_hwtype);
|
|
}
|
|
|
|
static DEVICE_ATTR(raw_hwtype, 0444, ap_raw_hwtype_show, NULL);
|
|
|
|
static ssize_t ap_depth_show(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", ac->queue_depth);
|
|
}
|
|
|
|
static DEVICE_ATTR(depth, 0444, ap_depth_show, NULL);
|
|
|
|
static ssize_t ap_functions_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
|
|
return snprintf(buf, PAGE_SIZE, "0x%08X\n", ac->functions);
|
|
}
|
|
|
|
static DEVICE_ATTR(ap_functions, 0444, ap_functions_show, NULL);
|
|
|
|
static ssize_t ap_req_count_show(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
unsigned int req_cnt;
|
|
|
|
req_cnt = 0;
|
|
spin_lock_bh(&ap_list_lock);
|
|
req_cnt = atomic_read(&ac->total_request_count);
|
|
spin_unlock_bh(&ap_list_lock);
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", req_cnt);
|
|
}
|
|
|
|
static ssize_t ap_req_count_store(struct device *dev,
|
|
struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
struct ap_queue *aq;
|
|
|
|
spin_lock_bh(&ap_list_lock);
|
|
for_each_ap_queue(aq, ac)
|
|
aq->total_request_count = 0;
|
|
spin_unlock_bh(&ap_list_lock);
|
|
atomic_set(&ac->total_request_count, 0);
|
|
|
|
return count;
|
|
}
|
|
|
|
static DEVICE_ATTR(request_count, 0644, ap_req_count_show, ap_req_count_store);
|
|
|
|
static ssize_t ap_requestq_count_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
struct ap_queue *aq;
|
|
unsigned int reqq_cnt;
|
|
|
|
reqq_cnt = 0;
|
|
spin_lock_bh(&ap_list_lock);
|
|
for_each_ap_queue(aq, ac)
|
|
reqq_cnt += aq->requestq_count;
|
|
spin_unlock_bh(&ap_list_lock);
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", reqq_cnt);
|
|
}
|
|
|
|
static DEVICE_ATTR(requestq_count, 0444, ap_requestq_count_show, NULL);
|
|
|
|
static ssize_t ap_pendingq_count_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
struct ap_queue *aq;
|
|
unsigned int penq_cnt;
|
|
|
|
penq_cnt = 0;
|
|
spin_lock_bh(&ap_list_lock);
|
|
for_each_ap_queue(aq, ac)
|
|
penq_cnt += aq->pendingq_count;
|
|
spin_unlock_bh(&ap_list_lock);
|
|
return snprintf(buf, PAGE_SIZE, "%d\n", penq_cnt);
|
|
}
|
|
|
|
static DEVICE_ATTR(pendingq_count, 0444, ap_pendingq_count_show, NULL);
|
|
|
|
static ssize_t ap_modalias_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "ap:t%02X\n", to_ap_dev(dev)->device_type);
|
|
}
|
|
|
|
static DEVICE_ATTR(modalias, 0444, ap_modalias_show, NULL);
|
|
|
|
static struct attribute *ap_card_dev_attrs[] = {
|
|
&dev_attr_hwtype.attr,
|
|
&dev_attr_raw_hwtype.attr,
|
|
&dev_attr_depth.attr,
|
|
&dev_attr_ap_functions.attr,
|
|
&dev_attr_request_count.attr,
|
|
&dev_attr_requestq_count.attr,
|
|
&dev_attr_pendingq_count.attr,
|
|
&dev_attr_modalias.attr,
|
|
NULL
|
|
};
|
|
|
|
static struct attribute_group ap_card_dev_attr_group = {
|
|
.attrs = ap_card_dev_attrs
|
|
};
|
|
|
|
static const struct attribute_group *ap_card_dev_attr_groups[] = {
|
|
&ap_card_dev_attr_group,
|
|
NULL
|
|
};
|
|
|
|
static struct device_type ap_card_type = {
|
|
.name = "ap_card",
|
|
.groups = ap_card_dev_attr_groups,
|
|
};
|
|
|
|
static void ap_card_device_release(struct device *dev)
|
|
{
|
|
struct ap_card *ac = to_ap_card(dev);
|
|
|
|
if (!list_empty(&ac->list)) {
|
|
spin_lock_bh(&ap_list_lock);
|
|
list_del_init(&ac->list);
|
|
spin_unlock_bh(&ap_list_lock);
|
|
}
|
|
kfree(ac);
|
|
}
|
|
|
|
struct ap_card *ap_card_create(int id, int queue_depth, int raw_type,
|
|
int comp_type, unsigned int functions)
|
|
{
|
|
struct ap_card *ac;
|
|
|
|
ac = kzalloc(sizeof(*ac), GFP_KERNEL);
|
|
if (!ac)
|
|
return NULL;
|
|
INIT_LIST_HEAD(&ac->list);
|
|
INIT_LIST_HEAD(&ac->queues);
|
|
ac->ap_dev.device.release = ap_card_device_release;
|
|
ac->ap_dev.device.type = &ap_card_type;
|
|
ac->ap_dev.device_type = comp_type;
|
|
ac->raw_hwtype = raw_type;
|
|
ac->queue_depth = queue_depth;
|
|
ac->functions = functions;
|
|
ac->id = id;
|
|
return ac;
|
|
}
|