0001
0002
0003
0004
0005
0006 #ifndef _VAS_H
0007 #define _VAS_H
0008 #include <asm/vas.h>
0009 #include <linux/mutex.h>
0010 #include <linux/stringify.h>
0011
0012
0013
0014
0015 #define VAS_MOD_WIN_CLOSE PPC_BIT(0)
0016 #define VAS_MOD_WIN_JOBS_KILL PPC_BIT(1)
0017 #define VAS_MOD_WIN_DR PPC_BIT(3)
0018 #define VAS_MOD_WIN_PR PPC_BIT(4)
0019 #define VAS_MOD_WIN_SF PPC_BIT(5)
0020 #define VAS_MOD_WIN_TA PPC_BIT(6)
0021 #define VAS_MOD_WIN_FLAGS (VAS_MOD_WIN_JOBS_KILL | VAS_MOD_WIN_DR | \
0022 VAS_MOD_WIN_PR | VAS_MOD_WIN_SF)
0023
0024 #define VAS_WIN_ACTIVE 0x0
0025 #define VAS_WIN_CLOSED 0x1
0026 #define VAS_WIN_INACTIVE 0x2
0027
0028 #define VAS_WIN_MOD_IN_PROCESS 0x3
0029
0030 #define VAS_COPY_PASTE_USER_MODE 0x00000001
0031 #define VAS_COP_OP_USER_MODE 0x00000010
0032
0033 #define VAS_GZIP_QOS_CAPABILITIES 0x56516F73477A6970
0034 #define VAS_GZIP_DEFAULT_CAPABILITIES 0x56446566477A6970
0035
0036 enum vas_migrate_action {
0037 VAS_SUSPEND,
0038 VAS_RESUME,
0039 };
0040
0041
0042
0043
0044 enum vas_cop_feat_type {
0045 VAS_GZIP_QOS_FEAT_TYPE,
0046 VAS_GZIP_DEF_FEAT_TYPE,
0047 VAS_MAX_FEAT_TYPE,
0048 };
0049
0050
0051
0052
0053
0054 struct hv_vas_cop_feat_caps {
0055 __be64 descriptor;
0056 u8 win_type;
0057 u8 user_mode;
0058 __be16 max_lpar_creds;
0059 __be16 max_win_creds;
0060 union {
0061 __be16 reserved;
0062 __be16 def_lpar_creds;
0063 };
0064 __be16 target_lpar_creds;
0065 } __packed __aligned(0x1000);
0066
0067
0068
0069
0070 struct vas_cop_feat_caps {
0071 u64 descriptor;
0072 u8 win_type;
0073 u8 user_mode;
0074 u16 max_lpar_creds;
0075
0076 u16 max_win_creds;
0077 union {
0078 u16 reserved;
0079 u16 def_lpar_creds;
0080 };
0081
0082
0083 atomic_t nr_total_credits;
0084 atomic_t nr_used_credits;
0085 };
0086
0087
0088
0089
0090
0091 struct vas_caps {
0092 struct vas_cop_feat_caps caps;
0093 struct list_head list;
0094 int nr_close_wins;
0095 int nr_open_windows;
0096 u8 feat;
0097 };
0098
0099
0100
0101
0102 struct hv_vas_win_lpar {
0103 __be16 version;
0104 u8 win_type;
0105 u8 status;
0106 __be16 credits;
0107 __be16 reserved;
0108 __be32 pid;
0109 __be32 tid;
0110 __be64 win_addr;
0111 __be32 interrupt;
0112 __be32 fault;
0113
0114
0115 __be64 domain[6];
0116 __be64 win_util;
0117 } __packed __aligned(0x1000);
0118
0119 struct pseries_vas_window {
0120 struct vas_window vas_win;
0121 u64 win_addr;
0122 u8 win_type;
0123 u32 complete_irq;
0124 u32 fault_irq;
0125 u64 domain[6];
0126
0127 u64 util;
0128 u32 pid;
0129
0130
0131 struct list_head win_list;
0132 u64 flags;
0133 char *name;
0134 int fault_virq;
0135 };
0136
0137 int sysfs_add_vas_caps(struct vas_cop_feat_caps *caps);
0138 int vas_reconfig_capabilties(u8 type, int new_nr_creds);
0139 int __init sysfs_pseries_vas_init(struct vas_all_caps *vas_caps);
0140
0141 #ifdef CONFIG_PPC_VAS
0142 int vas_migration_handler(int action);
0143 #else
0144 static inline int vas_migration_handler(int action)
0145 {
0146 return 0;
0147 }
0148 #endif
0149 #endif