1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright 2020-21 IBM Corp.
9 #include <linux/mutex.h>
10 #include <linux/stringify.h>
13 * VAS window modify flags
15 #define VAS_MOD_WIN_CLOSE PPC_BIT(0)
16 #define VAS_MOD_WIN_JOBS_KILL PPC_BIT(1)
17 #define VAS_MOD_WIN_DR PPC_BIT(3)
18 #define VAS_MOD_WIN_PR PPC_BIT(4)
19 #define VAS_MOD_WIN_SF PPC_BIT(5)
20 #define VAS_MOD_WIN_TA PPC_BIT(6)
21 #define VAS_MOD_WIN_FLAGS (VAS_MOD_WIN_JOBS_KILL | VAS_MOD_WIN_DR | \
22 VAS_MOD_WIN_PR | VAS_MOD_WIN_SF)
24 #define VAS_WIN_ACTIVE 0x0
25 #define VAS_WIN_CLOSED 0x1
26 #define VAS_WIN_INACTIVE 0x2 /* Inactive due to HW failure */
27 /* Process of being modified, deallocated, or quiesced */
28 #define VAS_WIN_MOD_IN_PROCESS 0x3
30 #define VAS_COPY_PASTE_USER_MODE 0x00000001
31 #define VAS_COP_OP_USER_MODE 0x00000010
34 * Co-processor feature - GZIP QoS windows or GZIP default windows
36 enum vas_cop_feat_type {
37 VAS_GZIP_QOS_FEAT_TYPE,
38 VAS_GZIP_DEF_FEAT_TYPE,
43 * Use to get feature specific capabilities from the
46 struct hv_vas_cop_feat_caps {
48 u8 win_type; /* Default or QoS type */
50 __be16 max_lpar_creds;
54 __be16 def_lpar_creds; /* Used for default capabilities */
56 __be16 target_lpar_creds;
57 } __packed __aligned(0x1000);
60 * Feature specific (QoS or default) capabilities.
62 struct vas_cop_feat_caps {
64 u8 win_type; /* Default or QoS type */
65 u8 user_mode; /* User mode copy/paste or COP HCALL */
66 u16 max_lpar_creds; /* Max credits available in LPAR */
67 /* Max credits can be assigned per window */
70 u16 reserved; /* Used for QoS credit type */
71 u16 def_lpar_creds; /* Used for default credit type */
73 /* Total LPAR available credits. Can be different from max LPAR */
74 /* credits due to DLPAR operation */
75 atomic_t target_lpar_creds;
76 atomic_t used_lpar_creds; /* Used credits so far */
77 u16 avail_lpar_creds; /* Remaining available credits */
81 * Feature (QoS or Default) specific to store capabilities and
82 * the list of open windows.
85 struct vas_cop_feat_caps caps;
86 struct list_head list; /* List of open windows */
90 * To get window information from the hypervisor.
92 struct hv_vas_win_lpar {
96 __be16 credits; /* No of credits assigned to this window */
98 __be32 pid; /* LPAR Process ID */
99 __be32 tid; /* LPAR Thread ID */
100 __be64 win_addr; /* Paste address */
101 __be32 interrupt; /* Interrupt when NX request completes */
102 __be32 fault; /* Interrupt when NX sees fault */
103 /* Associativity Domain Identifiers as returned in */
104 /* H_HOME_NODE_ASSOCIATIVITY */
106 __be64 win_util; /* Number of bytes processed */
107 } __packed __aligned(0x1000);
109 struct pseries_vas_window {
110 struct vas_window vas_win;
111 u64 win_addr; /* Physical paste address */
112 u8 win_type; /* QoS or Default window */
113 u32 complete_irq; /* Completion interrupt */
114 u32 fault_irq; /* Fault interrupt */
115 u64 domain[6]; /* Associativity domain Ids */
116 /* this window is allocated */
119 /* List of windows opened which is used for LPM */
120 struct list_head win_list;