forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/arch/powerpc/include/asm/icswx.h
....@@ -1,12 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * ICSWX api
34 *
45 * Copyright (C) 2015 IBM Corp.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
106 *
117 * This provides the Initiate Coprocessor Store Word Indexed (ICSWX)
128 * instruction. This instruction is used to communicate with PowerPC
....@@ -81,6 +77,8 @@
8177 #define CSB_CC_CHAIN (37)
8278 #define CSB_CC_SEQUENCE (38)
8379 #define CSB_CC_HW (39)
80
+/* P9 DD2 NX Workbook 3.2 (Table 4-36): Address translation fault */
81
+#define CSB_CC_FAULT_ADDRESS (250)
8482
8583 #define CSB_SIZE (0x10)
8684 #define CSB_ALIGN CSB_SIZE
....@@ -112,6 +110,17 @@
112110 __be64 address;
113111 } __packed __aligned(DDE_ALIGN);
114112
113
+/* 4.3.2 NX-stamped Fault CRB */
114
+
115
+#define NX_STAMP_ALIGN (0x10)
116
+
117
+struct nx_fault_stamp {
118
+ __be64 fault_storage_addr;
119
+ __be16 reserved;
120
+ __u8 flags;
121
+ __u8 fault_status;
122
+ __be32 pswid;
123
+} __packed __aligned(NX_STAMP_ALIGN);
115124
116125 /* Chapter 6.5.2 Coprocessor-Request Block (CRB) */
117126
....@@ -139,11 +148,15 @@
139148
140149 struct coprocessor_completion_block ccb;
141150
142
- u8 reserved[48];
151
+ union {
152
+ struct nx_fault_stamp nx;
153
+ u8 reserved[16];
154
+ } stamp;
155
+
156
+ u8 reserved[32];
143157
144158 struct coprocessor_status_block csb;
145
-} __packed __aligned(CRB_ALIGN);
146
-
159
+} __aligned(128);
147160
148161 /* RFC02167 Initiate Coprocessor Instructions document
149162 * Chapter 8.2.1.1.1 RS
....@@ -174,6 +187,9 @@
174187 __be64 ccw_reg = ccw;
175188 u32 cr;
176189
190
+ /* NB: the same structures are used by VAS-NX */
191
+ BUILD_BUG_ON(sizeof(*crb) != 128);
192
+
177193 __asm__ __volatile__(
178194 PPC_ICSWX(%1,0,%2) "\n"
179195 "mfcr %0\n"