native.c 30.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * Copyright 2014 IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
17
#include <linux/delay.h>
18
#include <asm/synch.h>
19
#include <misc/cxl-base.h>
20 21

#include "cxl.h"
I
Ian Munsie 已提交
22
#include "trace.h"
23 24 25 26 27 28

static int afu_control(struct cxl_afu *afu, u64 command,
		       u64 result, u64 mask, bool enabled)
{
	u64 AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
	unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
I
Ian Munsie 已提交
29
	int rc = 0;
30 31 32 33

	spin_lock(&afu->afu_cntl_lock);
	pr_devel("AFU command starting: %llx\n", command);

I
Ian Munsie 已提交
34 35
	trace_cxl_afu_ctrl(afu, command);

36 37 38 39 40 41
	cxl_p2n_write(afu, CXL_AFU_Cntl_An, AFU_Cntl | command);

	AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
	while ((AFU_Cntl & mask) != result) {
		if (time_after_eq(jiffies, timeout)) {
			dev_warn(&afu->dev, "WARNING: AFU control timed out!\n");
I
Ian Munsie 已提交
42 43
			rc = -EBUSY;
			goto out;
44
		}
45

46
		if (!cxl_ops->link_ok(afu->adapter, afu)) {
47 48 49 50 51
			afu->enabled = enabled;
			rc = -EIO;
			goto out;
		}

52
		pr_devel_ratelimited("AFU control... (0x%016llx)\n",
53 54 55 56 57 58
				     AFU_Cntl | command);
		cpu_relax();
		AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
	};
	pr_devel("AFU command complete: %llx\n", command);
	afu->enabled = enabled;
I
Ian Munsie 已提交
59 60
out:
	trace_cxl_afu_ctrl_done(afu, command, rc);
61 62
	spin_unlock(&afu->afu_cntl_lock);

I
Ian Munsie 已提交
63
	return rc;
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
}

static int afu_enable(struct cxl_afu *afu)
{
	pr_devel("AFU enable request\n");

	return afu_control(afu, CXL_AFU_Cntl_An_E,
			   CXL_AFU_Cntl_An_ES_Enabled,
			   CXL_AFU_Cntl_An_ES_MASK, true);
}

int cxl_afu_disable(struct cxl_afu *afu)
{
	pr_devel("AFU disable request\n");

	return afu_control(afu, 0, CXL_AFU_Cntl_An_ES_Disabled,
			   CXL_AFU_Cntl_An_ES_MASK, false);
}

/* This will disable as well as reset */
84
static int native_afu_reset(struct cxl_afu *afu)
85 86 87 88 89 90 91 92 93
{
	pr_devel("AFU reset request\n");

	return afu_control(afu, CXL_AFU_Cntl_An_RA,
			   CXL_AFU_Cntl_An_RS_Complete | CXL_AFU_Cntl_An_ES_Disabled,
			   CXL_AFU_Cntl_An_RS_MASK | CXL_AFU_Cntl_An_ES_MASK,
			   false);
}

94
static int native_afu_check_and_enable(struct cxl_afu *afu)
95
{
96
	if (!cxl_ops->link_ok(afu->adapter, afu)) {
97 98 99
		WARN(1, "Refusing to enable afu while link down!\n");
		return -EIO;
	}
100 101 102 103 104 105 106 107 108 109 110 111
	if (afu->enabled)
		return 0;
	return afu_enable(afu);
}

int cxl_psl_purge(struct cxl_afu *afu)
{
	u64 PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
	u64 AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
	u64 dsisr, dar;
	u64 start, end;
	unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
I
Ian Munsie 已提交
112 113 114
	int rc = 0;

	trace_cxl_psl_ctrl(afu, CXL_PSL_SCNTL_An_Pc);
115 116 117

	pr_devel("PSL purge request\n");

118
	if (!cxl_ops->link_ok(afu->adapter, afu)) {
119 120 121 122 123
		dev_warn(&afu->dev, "PSL Purge called with link down, ignoring\n");
		rc = -EIO;
		goto out;
	}

124 125 126 127 128 129 130 131 132 133 134 135 136
	if ((AFU_Cntl & CXL_AFU_Cntl_An_ES_MASK) != CXL_AFU_Cntl_An_ES_Disabled) {
		WARN(1, "psl_purge request while AFU not disabled!\n");
		cxl_afu_disable(afu);
	}

	cxl_p1n_write(afu, CXL_PSL_SCNTL_An,
		       PSL_CNTL | CXL_PSL_SCNTL_An_Pc);
	start = local_clock();
	PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
	while ((PSL_CNTL &  CXL_PSL_SCNTL_An_Ps_MASK)
			== CXL_PSL_SCNTL_An_Ps_Pending) {
		if (time_after_eq(jiffies, timeout)) {
			dev_warn(&afu->dev, "WARNING: PSL Purge timed out!\n");
I
Ian Munsie 已提交
137 138
			rc = -EBUSY;
			goto out;
139
		}
140
		if (!cxl_ops->link_ok(afu->adapter, afu)) {
141 142 143 144
			rc = -EIO;
			goto out;
		}

145
		dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
146
		pr_devel_ratelimited("PSL purging... PSL_CNTL: 0x%016llx  PSL_DSISR: 0x%016llx\n", PSL_CNTL, dsisr);
147 148
		if (dsisr & CXL_PSL_DSISR_TRANS) {
			dar = cxl_p2n_read(afu, CXL_PSL_DAR_An);
149
			dev_notice(&afu->dev, "PSL purge terminating pending translation, DSISR: 0x%016llx, DAR: 0x%016llx\n", dsisr, dar);
150 151
			cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_AE);
		} else if (dsisr) {
152
			dev_notice(&afu->dev, "PSL purge acknowledging pending non-translation fault, DSISR: 0x%016llx\n", dsisr);
153 154 155 156 157 158 159 160 161 162 163
			cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_A);
		} else {
			cpu_relax();
		}
		PSL_CNTL = cxl_p1n_read(afu, CXL_PSL_SCNTL_An);
	};
	end = local_clock();
	pr_devel("PSL purged in %lld ns\n", end - start);

	cxl_p1n_write(afu, CXL_PSL_SCNTL_An,
		       PSL_CNTL & ~CXL_PSL_SCNTL_An_Pc);
I
Ian Munsie 已提交
164 165 166
out:
	trace_cxl_psl_ctrl_done(afu, CXL_PSL_SCNTL_An_Pc, rc);
	return rc;
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
}

static int spa_max_procs(int spa_size)
{
	/*
	 * From the CAIA:
	 *    end_of_SPA_area = SPA_Base + ((n+4) * 128) + (( ((n*8) + 127) >> 7) * 128) + 255
	 * Most of that junk is really just an overly-complicated way of saying
	 * the last 256 bytes are __aligned(128), so it's really:
	 *    end_of_SPA_area = end_of_PSL_queue_area + __aligned(128) 255
	 * and
	 *    end_of_PSL_queue_area = SPA_Base + ((n+4) * 128) + (n*8) - 1
	 * so
	 *    sizeof(SPA) = ((n+4) * 128) + (n*8) + __aligned(128) 256
	 * Ignore the alignment (which is safe in this case as long as we are
	 * careful with our rounding) and solve for n:
	 */
	return ((spa_size / 8) - 96) / 17;
}

187
int cxl_alloc_spa(struct cxl_afu *afu)
188
{
189 190
	unsigned spa_size;

191
	/* Work out how many pages to allocate */
192
	afu->native->spa_order = 0;
193
	do {
194
		afu->native->spa_order++;
195 196 197 198 199 200 201 202 203 204
		spa_size = (1 << afu->native->spa_order) * PAGE_SIZE;

		if (spa_size > 0x100000) {
			dev_warn(&afu->dev, "num_of_processes too large for the SPA, limiting to %i (0x%x)\n",
					afu->native->spa_max_procs, afu->native->spa_size);
			afu->num_procs = afu->native->spa_max_procs;
			break;
		}

		afu->native->spa_size = spa_size;
205 206
		afu->native->spa_max_procs = spa_max_procs(afu->native->spa_size);
	} while (afu->native->spa_max_procs < afu->num_procs);
207

208 209
	if (!(afu->native->spa = (struct cxl_process_element *)
	      __get_free_pages(GFP_KERNEL | __GFP_ZERO, afu->native->spa_order))) {
210 211 212 213
		pr_err("cxl_alloc_spa: Unable to allocate scheduled process area\n");
		return -ENOMEM;
	}
	pr_devel("spa pages: %i afu->spa_max_procs: %i   afu->num_procs: %i\n",
214
		 1<<afu->native->spa_order, afu->native->spa_max_procs, afu->num_procs);
215

216 217 218 219 220 221 222
	return 0;
}

static void attach_spa(struct cxl_afu *afu)
{
	u64 spap;

223 224
	afu->native->sw_command_status = (__be64 *)((char *)afu->native->spa +
					    ((afu->native->spa_max_procs + 3) * 128));
225

226 227
	spap = virt_to_phys(afu->native->spa) & CXL_PSL_SPAP_Addr;
	spap |= ((afu->native->spa_size >> (12 - CXL_PSL_SPAP_Size_Shift)) - 1) & CXL_PSL_SPAP_Size;
228
	spap |= CXL_PSL_SPAP_V;
229 230 231
	pr_devel("cxl: SPA allocated at 0x%p. Max processes: %i, sw_command_status: 0x%p CXL_PSL_SPAP_An=0x%016llx\n",
		afu->native->spa, afu->native->spa_max_procs,
		afu->native->sw_command_status, spap);
232 233 234
	cxl_p1n_write(afu, CXL_PSL_SPAP_An, spap);
}

235
static inline void detach_spa(struct cxl_afu *afu)
236
{
237
	cxl_p1n_write(afu, CXL_PSL_SPAP_An, 0);
238 239 240 241
}

void cxl_release_spa(struct cxl_afu *afu)
{
242 243 244 245
	if (afu->native->spa) {
		free_pages((unsigned long) afu->native->spa,
			afu->native->spa_order);
		afu->native->spa = NULL;
246
	}
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
}

int cxl_tlb_slb_invalidate(struct cxl *adapter)
{
	unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);

	pr_devel("CXL adapter wide TLBIA & SLBIA\n");

	cxl_p1_write(adapter, CXL_PSL_AFUSEL, CXL_PSL_AFUSEL_A);

	cxl_p1_write(adapter, CXL_PSL_TLBIA, CXL_TLB_SLB_IQ_ALL);
	while (cxl_p1_read(adapter, CXL_PSL_TLBIA) & CXL_TLB_SLB_P) {
		if (time_after_eq(jiffies, timeout)) {
			dev_warn(&adapter->dev, "WARNING: CXL adapter wide TLBIA timed out!\n");
			return -EBUSY;
		}
263
		if (!cxl_ops->link_ok(adapter, NULL))
264
			return -EIO;
265 266 267 268 269 270 271 272 273
		cpu_relax();
	}

	cxl_p1_write(adapter, CXL_PSL_SLBIA, CXL_TLB_SLB_IQ_ALL);
	while (cxl_p1_read(adapter, CXL_PSL_SLBIA) & CXL_TLB_SLB_P) {
		if (time_after_eq(jiffies, timeout)) {
			dev_warn(&adapter->dev, "WARNING: CXL adapter wide SLBIA timed out!\n");
			return -EBUSY;
		}
274
		if (!cxl_ops->link_ok(adapter, NULL))
275
			return -EIO;
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
		cpu_relax();
	}
	return 0;
}

static int cxl_write_sstp(struct cxl_afu *afu, u64 sstp0, u64 sstp1)
{
	int rc;

	/* 1. Disable SSTP by writing 0 to SSTP1[V] */
	cxl_p2n_write(afu, CXL_SSTP1_An, 0);

	/* 2. Invalidate all SLB entries */
	if ((rc = cxl_afu_slbia(afu)))
		return rc;

	/* 3. Set SSTP0_An */
	cxl_p2n_write(afu, CXL_SSTP0_An, sstp0);

	/* 4. Set SSTP1_An */
	cxl_p2n_write(afu, CXL_SSTP1_An, sstp1);

	return 0;
}

/* Using per slice version may improve performance here. (ie. SLBIA_An) */
static void slb_invalid(struct cxl_context *ctx)
{
	struct cxl *adapter = ctx->afu->adapter;
	u64 slbia;

307
	WARN_ON(!mutex_is_locked(&ctx->afu->native->spa_mutex));
308 309 310 311 312 313 314

	cxl_p1_write(adapter, CXL_PSL_LBISEL,
			((u64)be32_to_cpu(ctx->elem->common.pid) << 32) |
			be32_to_cpu(ctx->elem->lpid));
	cxl_p1_write(adapter, CXL_PSL_SLBIA, CXL_TLB_SLB_IQ_LPIDPID);

	while (1) {
315
		if (!cxl_ops->link_ok(adapter, NULL))
316
			break;
317 318 319 320 321 322 323 324 325 326 327
		slbia = cxl_p1_read(adapter, CXL_PSL_SLBIA);
		if (!(slbia & CXL_TLB_SLB_P))
			break;
		cpu_relax();
	}
}

static int do_process_element_cmd(struct cxl_context *ctx,
				  u64 cmd, u64 pe_state)
{
	u64 state;
328
	unsigned long timeout = jiffies + (HZ * CXL_TIMEOUT);
I
Ian Munsie 已提交
329 330 331
	int rc = 0;

	trace_cxl_llcmd(ctx, cmd);
332 333 334 335 336

	WARN_ON(!ctx->afu->enabled);

	ctx->elem->software_state = cpu_to_be32(pe_state);
	smp_wmb();
337
	*(ctx->afu->native->sw_command_status) = cpu_to_be64(cmd | 0 | ctx->pe);
338 339 340
	smp_mb();
	cxl_p1n_write(ctx->afu, CXL_PSL_LLCMD_An, cmd | ctx->pe);
	while (1) {
341 342
		if (time_after_eq(jiffies, timeout)) {
			dev_warn(&ctx->afu->dev, "WARNING: Process Element Command timed out!\n");
I
Ian Munsie 已提交
343 344
			rc = -EBUSY;
			goto out;
345
		}
346
		if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
347 348 349 350
			dev_warn(&ctx->afu->dev, "WARNING: Device link down, aborting Process Element Command!\n");
			rc = -EIO;
			goto out;
		}
351
		state = be64_to_cpup(ctx->afu->native->sw_command_status);
352 353
		if (state == ~0ULL) {
			pr_err("cxl: Error adding process element to AFU\n");
I
Ian Munsie 已提交
354 355
			rc = -1;
			goto out;
356 357 358 359 360 361 362 363 364 365 366 367 368 369
		}
		if ((state & (CXL_SPA_SW_CMD_MASK | CXL_SPA_SW_STATE_MASK  | CXL_SPA_SW_LINK_MASK)) ==
		    (cmd | (cmd >> 16) | ctx->pe))
			break;
		/*
		 * The command won't finish in the PSL if there are
		 * outstanding DSIs.  Hence we need to yield here in
		 * case there are outstanding DSIs that we need to
		 * service.  Tuning possiblity: we could wait for a
		 * while before sched
		 */
		schedule();

	}
I
Ian Munsie 已提交
370 371 372
out:
	trace_cxl_llcmd_done(ctx, cmd, rc);
	return rc;
373 374 375 376 377 378
}

static int add_process_element(struct cxl_context *ctx)
{
	int rc = 0;

379
	mutex_lock(&ctx->afu->native->spa_mutex);
380 381 382 383
	pr_devel("%s Adding pe: %i started\n", __func__, ctx->pe);
	if (!(rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_ADD, CXL_PE_SOFTWARE_STATE_V)))
		ctx->pe_inserted = true;
	pr_devel("%s Adding pe: %i finished\n", __func__, ctx->pe);
384
	mutex_unlock(&ctx->afu->native->spa_mutex);
385 386 387 388 389 390 391 392 393 394 395
	return rc;
}

static int terminate_process_element(struct cxl_context *ctx)
{
	int rc = 0;

	/* fast path terminate if it's already invalid */
	if (!(ctx->elem->software_state & cpu_to_be32(CXL_PE_SOFTWARE_STATE_V)))
		return rc;

396
	mutex_lock(&ctx->afu->native->spa_mutex);
397
	pr_devel("%s Terminate pe: %i started\n", __func__, ctx->pe);
398 399 400 401
	/* We could be asked to terminate when the hw is down. That
	 * should always succeed: it's not running if the hw has gone
	 * away and is being reset.
	 */
402
	if (cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
403 404
		rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_TERMINATE,
					    CXL_PE_SOFTWARE_STATE_V | CXL_PE_SOFTWARE_STATE_T);
405 406
	ctx->elem->software_state = 0;	/* Remove Valid bit */
	pr_devel("%s Terminate pe: %i finished\n", __func__, ctx->pe);
407
	mutex_unlock(&ctx->afu->native->spa_mutex);
408 409 410 411 412 413 414
	return rc;
}

static int remove_process_element(struct cxl_context *ctx)
{
	int rc = 0;

415
	mutex_lock(&ctx->afu->native->spa_mutex);
416
	pr_devel("%s Remove pe: %i started\n", __func__, ctx->pe);
417 418 419 420

	/* We could be asked to remove when the hw is down. Again, if
	 * the hw is down, the PE is gone, so we succeed.
	 */
421
	if (cxl_ops->link_ok(ctx->afu->adapter, ctx->afu))
422 423 424
		rc = do_process_element_cmd(ctx, CXL_SPA_SW_CMD_REMOVE, 0);

	if (!rc)
425 426 427
		ctx->pe_inserted = false;
	slb_invalid(ctx);
	pr_devel("%s Remove pe: %i finished\n", __func__, ctx->pe);
428
	mutex_unlock(&ctx->afu->native->spa_mutex);
429 430 431 432 433

	return rc;
}


M
Michael Neuling 已提交
434
void cxl_assign_psn_space(struct cxl_context *ctx)
435 436 437 438 439 440
{
	if (!ctx->afu->pp_size || ctx->master) {
		ctx->psn_phys = ctx->afu->psn_phys;
		ctx->psn_size = ctx->afu->adapter->ps_size;
	} else {
		ctx->psn_phys = ctx->afu->psn_phys +
441
			(ctx->afu->native->pp_offset + ctx->afu->pp_size * ctx->pe);
442 443 444 445 446 447 448 449 450 451
		ctx->psn_size = ctx->afu->pp_size;
	}
}

static int activate_afu_directed(struct cxl_afu *afu)
{
	int rc;

	dev_info(&afu->dev, "Activating AFU directed mode\n");

452
	afu->num_procs = afu->max_procs_virtualised;
453
	if (afu->native->spa == NULL) {
454 455 456 457
		if (cxl_alloc_spa(afu))
			return -ENOMEM;
	}
	attach_spa(afu);
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487

	cxl_p1n_write(afu, CXL_PSL_SCNTL_An, CXL_PSL_SCNTL_An_PM_AFU);
	cxl_p1n_write(afu, CXL_PSL_AMOR_An, 0xFFFFFFFFFFFFFFFFULL);
	cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L);

	afu->current_mode = CXL_MODE_DIRECTED;

	if ((rc = cxl_chardev_m_afu_add(afu)))
		return rc;

	if ((rc = cxl_sysfs_afu_m_add(afu)))
		goto err;

	if ((rc = cxl_chardev_s_afu_add(afu)))
		goto err1;

	return 0;
err1:
	cxl_sysfs_afu_m_remove(afu);
err:
	cxl_chardev_afu_remove(afu);
	return rc;
}

#ifdef CONFIG_CPU_LITTLE_ENDIAN
#define set_endian(sr) ((sr) |= CXL_PSL_SR_An_LE)
#else
#define set_endian(sr) ((sr) &= ~(CXL_PSL_SR_An_LE))
#endif

488 489 490 491
static u64 calculate_sr(struct cxl_context *ctx)
{
	u64 sr = 0;

492
	set_endian(sr);
493 494 495 496 497
	if (ctx->master)
		sr |= CXL_PSL_SR_An_MP;
	if (mfspr(SPRN_LPCR) & LPCR_TC)
		sr |= CXL_PSL_SR_An_TC;
	if (ctx->kernel) {
498 499 500
		if (!ctx->real_mode)
			sr |= CXL_PSL_SR_An_R;
		sr |= (mfmsr() & MSR_SF) | CXL_PSL_SR_An_HV;
501 502 503 504 505 506 507 508 509
	} else {
		sr |= CXL_PSL_SR_An_PR | CXL_PSL_SR_An_R;
		sr &= ~(CXL_PSL_SR_An_HV);
		if (!test_tsk_thread_flag(current, TIF_32BIT))
			sr |= CXL_PSL_SR_An_SF;
	}
	return sr;
}

510 511
static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr)
{
512
	u32 pid;
513 514
	int r, result;

M
Michael Neuling 已提交
515
	cxl_assign_psn_space(ctx);
516 517 518 519 520 521

	ctx->elem->ctxtime = 0; /* disable */
	ctx->elem->lpid = cpu_to_be32(mfspr(SPRN_LPID));
	ctx->elem->haurp = 0; /* disable */
	ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1));

522 523 524
	pid = current->pid;
	if (ctx->kernel)
		pid = 0;
525
	ctx->elem->common.tid = 0;
526 527 528
	ctx->elem->common.pid = cpu_to_be32(pid);

	ctx->elem->sr = cpu_to_be64(calculate_sr(ctx));
529 530 531 532 533 534 535 536 537 538

	ctx->elem->common.csrp = 0; /* disable */
	ctx->elem->common.aurp0 = 0; /* disable */
	ctx->elem->common.aurp1 = 0; /* disable */

	cxl_prefault(ctx, wed);

	ctx->elem->common.sstp0 = cpu_to_be64(ctx->sstp0);
	ctx->elem->common.sstp1 = cpu_to_be64(ctx->sstp1);

539 540 541 542 543 544 545 546 547
	/*
	 * Ensure we have the multiplexed PSL interrupt set up to take faults
	 * for kernel contexts that may not have allocated any AFU IRQs at all:
	 */
	if (ctx->irqs.range[0] == 0) {
		ctx->irqs.offset[0] = ctx->afu->native->psl_hwirq;
		ctx->irqs.range[0] = 1;
	}

548 549 550 551 552 553 554 555 556
	for (r = 0; r < CXL_IRQ_RANGES; r++) {
		ctx->elem->ivte_offsets[r] = cpu_to_be16(ctx->irqs.offset[r]);
		ctx->elem->ivte_ranges[r] = cpu_to_be16(ctx->irqs.range[r]);
	}

	ctx->elem->common.amr = cpu_to_be64(amr);
	ctx->elem->common.wed = cpu_to_be64(wed);

	/* first guy needs to enable */
557
	if ((result = cxl_ops->afu_check_and_enable(ctx->afu)))
558 559
		return result;

560
	return add_process_element(ctx);
561 562 563 564 565 566 567 568 569 570 571 572
}

static int deactivate_afu_directed(struct cxl_afu *afu)
{
	dev_info(&afu->dev, "Deactivating AFU directed mode\n");

	afu->current_mode = 0;
	afu->num_procs = 0;

	cxl_sysfs_afu_m_remove(afu);
	cxl_chardev_afu_remove(afu);

573
	cxl_ops->afu_reset(afu);
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
	cxl_afu_disable(afu);
	cxl_psl_purge(afu);

	return 0;
}

static int activate_dedicated_process(struct cxl_afu *afu)
{
	dev_info(&afu->dev, "Activating dedicated process mode\n");

	cxl_p1n_write(afu, CXL_PSL_SCNTL_An, CXL_PSL_SCNTL_An_PM_Process);

	cxl_p1n_write(afu, CXL_PSL_CtxTime_An, 0); /* disable */
	cxl_p1n_write(afu, CXL_PSL_SPAP_An, 0);    /* disable */
	cxl_p1n_write(afu, CXL_PSL_AMOR_An, 0xFFFFFFFFFFFFFFFFULL);
	cxl_p1n_write(afu, CXL_PSL_LPID_An, mfspr(SPRN_LPID));
	cxl_p1n_write(afu, CXL_HAURP_An, 0);       /* disable */
	cxl_p1n_write(afu, CXL_PSL_SDR_An, mfspr(SPRN_SDR1));

	cxl_p2n_write(afu, CXL_CSRP_An, 0);        /* disable */
	cxl_p2n_write(afu, CXL_AURP0_An, 0);       /* disable */
	cxl_p2n_write(afu, CXL_AURP1_An, 0);       /* disable */

	afu->current_mode = CXL_MODE_DEDICATED;
	afu->num_procs = 1;

	return cxl_chardev_d_afu_add(afu);
}

static int attach_dedicated(struct cxl_context *ctx, u64 wed, u64 amr)
{
	struct cxl_afu *afu = ctx->afu;
606
	u64 pid;
607 608
	int rc;

609 610 611 612 613 614
	pid = (u64)current->pid << 32;
	if (ctx->kernel)
		pid = 0;
	cxl_p2n_write(afu, CXL_PSL_PID_TID_An, pid);

	cxl_p1n_write(afu, CXL_PSL_SR_An, calculate_sr(ctx));
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634

	if ((rc = cxl_write_sstp(afu, ctx->sstp0, ctx->sstp1)))
		return rc;

	cxl_prefault(ctx, wed);

	cxl_p1n_write(afu, CXL_PSL_IVTE_Offset_An,
		       (((u64)ctx->irqs.offset[0] & 0xffff) << 48) |
		       (((u64)ctx->irqs.offset[1] & 0xffff) << 32) |
		       (((u64)ctx->irqs.offset[2] & 0xffff) << 16) |
			((u64)ctx->irqs.offset[3] & 0xffff));
	cxl_p1n_write(afu, CXL_PSL_IVTE_Limit_An, (u64)
		       (((u64)ctx->irqs.range[0] & 0xffff) << 48) |
		       (((u64)ctx->irqs.range[1] & 0xffff) << 32) |
		       (((u64)ctx->irqs.range[2] & 0xffff) << 16) |
			((u64)ctx->irqs.range[3] & 0xffff));

	cxl_p2n_write(afu, CXL_PSL_AMR_An, amr);

	/* master only context for dedicated */
M
Michael Neuling 已提交
635
	cxl_assign_psn_space(ctx);
636

637
	if ((rc = cxl_ops->afu_reset(afu)))
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
		return rc;

	cxl_p2n_write(afu, CXL_PSL_WED_An, wed);

	return afu_enable(afu);
}

static int deactivate_dedicated_process(struct cxl_afu *afu)
{
	dev_info(&afu->dev, "Deactivating dedicated process mode\n");

	afu->current_mode = 0;
	afu->num_procs = 0;

	cxl_chardev_afu_remove(afu);

	return 0;
}

657
static int native_afu_deactivate_mode(struct cxl_afu *afu, int mode)
658 659 660 661 662 663 664 665
{
	if (mode == CXL_MODE_DIRECTED)
		return deactivate_afu_directed(afu);
	if (mode == CXL_MODE_DEDICATED)
		return deactivate_dedicated_process(afu);
	return 0;
}

666
static int native_afu_activate_mode(struct cxl_afu *afu, int mode)
667 668 669 670 671 672
{
	if (!mode)
		return 0;
	if (!(mode & afu->modes_supported))
		return -EINVAL;

673
	if (!cxl_ops->link_ok(afu->adapter, afu)) {
674 675 676 677
		WARN(1, "Device link is down, refusing to activate!\n");
		return -EIO;
	}

678 679 680 681 682 683 684 685
	if (mode == CXL_MODE_DIRECTED)
		return activate_afu_directed(afu);
	if (mode == CXL_MODE_DEDICATED)
		return activate_dedicated_process(afu);

	return -EINVAL;
}

686 687
static int native_attach_process(struct cxl_context *ctx, bool kernel,
				u64 wed, u64 amr)
688
{
689
	if (!cxl_ops->link_ok(ctx->afu->adapter, ctx->afu)) {
690 691 692 693
		WARN(1, "Device link is down, refusing to attach process!\n");
		return -EIO;
	}

694 695 696 697 698 699 700 701 702 703 704 705
	ctx->kernel = kernel;
	if (ctx->afu->current_mode == CXL_MODE_DIRECTED)
		return attach_afu_directed(ctx, wed, amr);

	if (ctx->afu->current_mode == CXL_MODE_DEDICATED)
		return attach_dedicated(ctx, wed, amr);

	return -EINVAL;
}

static inline int detach_process_native_dedicated(struct cxl_context *ctx)
{
706
	cxl_ops->afu_reset(ctx->afu);
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
	cxl_afu_disable(ctx->afu);
	cxl_psl_purge(ctx->afu);
	return 0;
}

static inline int detach_process_native_afu_directed(struct cxl_context *ctx)
{
	if (!ctx->pe_inserted)
		return 0;
	if (terminate_process_element(ctx))
		return -1;
	if (remove_process_element(ctx))
		return -1;

	return 0;
}

724
static int native_detach_process(struct cxl_context *ctx)
725
{
I
Ian Munsie 已提交
726 727
	trace_cxl_detach(ctx);

728 729 730 731 732 733
	if (ctx->afu->current_mode == CXL_MODE_DEDICATED)
		return detach_process_native_dedicated(ctx);

	return detach_process_native_afu_directed(ctx);
}

734
static int native_get_irq_info(struct cxl_afu *afu, struct cxl_irq_info *info)
735 736 737
{
	u64 pidtid;

738 739 740
	/* If the adapter has gone away, we can't get any meaningful
	 * information.
	 */
741
	if (!cxl_ops->link_ok(afu->adapter, afu))
742 743
		return -EIO;

744 745 746 747
	info->dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
	info->dar = cxl_p2n_read(afu, CXL_PSL_DAR_An);
	info->dsr = cxl_p2n_read(afu, CXL_PSL_DSR_An);
	pidtid = cxl_p2n_read(afu, CXL_PSL_PID_TID_An);
748 749
	info->pid = pidtid >> 32;
	info->tid = pidtid & 0xffffffff;
750 751
	info->afu_err = cxl_p2n_read(afu, CXL_AFU_ERR_An);
	info->errstat = cxl_p2n_read(afu, CXL_PSL_ErrStat_An);
752
	info->proc_handle = 0;
753 754 755 756

	return 0;
}

757 758
static irqreturn_t native_handle_psl_slice_error(struct cxl_context *ctx,
						u64 dsisr, u64 errstat)
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
{
	u64 fir1, fir2, fir_slice, serr, afu_debug;

	fir1 = cxl_p1_read(ctx->afu->adapter, CXL_PSL_FIR1);
	fir2 = cxl_p1_read(ctx->afu->adapter, CXL_PSL_FIR2);
	fir_slice = cxl_p1n_read(ctx->afu, CXL_PSL_FIR_SLICE_An);
	serr = cxl_p1n_read(ctx->afu, CXL_PSL_SERR_An);
	afu_debug = cxl_p1n_read(ctx->afu, CXL_AFU_DEBUG_An);

	dev_crit(&ctx->afu->dev, "PSL ERROR STATUS: 0x%016llx\n", errstat);
	dev_crit(&ctx->afu->dev, "PSL_FIR1: 0x%016llx\n", fir1);
	dev_crit(&ctx->afu->dev, "PSL_FIR2: 0x%016llx\n", fir2);
	dev_crit(&ctx->afu->dev, "PSL_SERR_An: 0x%016llx\n", serr);
	dev_crit(&ctx->afu->dev, "PSL_FIR_SLICE_An: 0x%016llx\n", fir_slice);
	dev_crit(&ctx->afu->dev, "CXL_PSL_AFU_DEBUG_An: 0x%016llx\n", afu_debug);

	dev_crit(&ctx->afu->dev, "STOPPING CXL TRACE\n");
	cxl_stop_trace(ctx->afu->adapter);

778
	return cxl_ops->ack_irq(ctx, 0, errstat);
779 780 781 782 783 784 785 786 787 788 789 790
}

static irqreturn_t fail_psl_irq(struct cxl_afu *afu, struct cxl_irq_info *irq_info)
{
	if (irq_info->dsisr & CXL_PSL_DSISR_TRANS)
		cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_AE);
	else
		cxl_p2n_write(afu, CXL_PSL_TFC_An, CXL_PSL_TFC_An_A);

	return IRQ_HANDLED;
}

791
static irqreturn_t native_irq_multiplexed(int irq, void *data)
792 793 794 795 796 797 798
{
	struct cxl_afu *afu = data;
	struct cxl_context *ctx;
	struct cxl_irq_info irq_info;
	int ph = cxl_p2n_read(afu, CXL_PSL_PEHandle_An) & 0xffff;
	int ret;

799
	if ((ret = native_get_irq_info(afu, &irq_info))) {
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
		WARN(1, "Unable to get CXL IRQ Info: %i\n", ret);
		return fail_psl_irq(afu, &irq_info);
	}

	rcu_read_lock();
	ctx = idr_find(&afu->contexts_idr, ph);
	if (ctx) {
		ret = cxl_irq(irq, ctx, &irq_info);
		rcu_read_unlock();
		return ret;
	}
	rcu_read_unlock();

	WARN(1, "Unable to demultiplex CXL PSL IRQ for PE %i DSISR %016llx DAR"
		" %016llx\n(Possible AFU HW issue - was a term/remove acked"
		" with outstanding transactions?)\n", ph, irq_info.dsisr,
		irq_info.dar);
	return fail_psl_irq(afu, &irq_info);
}

820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
void native_irq_wait(struct cxl_context *ctx)
{
	u64 dsisr;
	int timeout = 1000;
	int ph;

	/*
	 * Wait until no further interrupts are presented by the PSL
	 * for this context.
	 */
	while (timeout--) {
		ph = cxl_p2n_read(ctx->afu, CXL_PSL_PEHandle_An) & 0xffff;
		if (ph != ctx->pe)
			return;
		dsisr = cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An);
		if ((dsisr & CXL_PSL_DSISR_PENDING) == 0)
			return;
		/*
		 * We are waiting for the workqueue to process our
		 * irq, so need to let that run here.
		 */
		msleep(1);
	}

	dev_warn(&ctx->afu->dev, "WARNING: waiting on DSI for PE %i"
		 " DSISR %016llx!\n", ph, dsisr);
	return;
}

849
static irqreturn_t native_slice_irq_err(int irq, void *data)
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869
{
	struct cxl_afu *afu = data;
	u64 fir_slice, errstat, serr, afu_debug;

	WARN(irq, "CXL SLICE ERROR interrupt %i\n", irq);

	serr = cxl_p1n_read(afu, CXL_PSL_SERR_An);
	fir_slice = cxl_p1n_read(afu, CXL_PSL_FIR_SLICE_An);
	errstat = cxl_p2n_read(afu, CXL_PSL_ErrStat_An);
	afu_debug = cxl_p1n_read(afu, CXL_AFU_DEBUG_An);
	dev_crit(&afu->dev, "PSL_SERR_An: 0x%016llx\n", serr);
	dev_crit(&afu->dev, "PSL_FIR_SLICE_An: 0x%016llx\n", fir_slice);
	dev_crit(&afu->dev, "CXL_PSL_ErrStat_An: 0x%016llx\n", errstat);
	dev_crit(&afu->dev, "CXL_PSL_AFU_DEBUG_An: 0x%016llx\n", afu_debug);

	cxl_p1n_write(afu, CXL_PSL_SERR_An, serr);

	return IRQ_HANDLED;
}

870
static irqreturn_t native_irq_err(int irq, void *data)
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890
{
	struct cxl *adapter = data;
	u64 fir1, fir2, err_ivte;

	WARN(1, "CXL ERROR interrupt %i\n", irq);

	err_ivte = cxl_p1_read(adapter, CXL_PSL_ErrIVTE);
	dev_crit(&adapter->dev, "PSL_ErrIVTE: 0x%016llx\n", err_ivte);

	dev_crit(&adapter->dev, "STOPPING CXL TRACE\n");
	cxl_stop_trace(adapter);

	fir1 = cxl_p1_read(adapter, CXL_PSL_FIR1);
	fir2 = cxl_p1_read(adapter, CXL_PSL_FIR2);

	dev_crit(&adapter->dev, "PSL_FIR1: 0x%016llx\nPSL_FIR2: 0x%016llx\n", fir1, fir2);

	return IRQ_HANDLED;
}

891
int cxl_native_register_psl_err_irq(struct cxl *adapter)
892 893 894 895 896 897 898 899
{
	int rc;

	adapter->irq_name = kasprintf(GFP_KERNEL, "cxl-%s-err",
				      dev_name(&adapter->dev));
	if (!adapter->irq_name)
		return -ENOMEM;

900
	if ((rc = cxl_register_one_irq(adapter, native_irq_err, adapter,
901 902
				       &adapter->native->err_hwirq,
				       &adapter->native->err_virq,
903 904 905 906 907 908
				       adapter->irq_name))) {
		kfree(adapter->irq_name);
		adapter->irq_name = NULL;
		return rc;
	}

909
	cxl_p1_write(adapter, CXL_PSL_ErrIVTE, adapter->native->err_hwirq & 0xffff);
910 911 912 913

	return 0;
}

914
void cxl_native_release_psl_err_irq(struct cxl *adapter)
915
{
916
	if (adapter->native->err_virq != irq_find_mapping(NULL, adapter->native->err_hwirq))
917 918 919
		return;

	cxl_p1_write(adapter, CXL_PSL_ErrIVTE, 0x0000000000000000);
920 921
	cxl_unmap_irq(adapter->native->err_virq, adapter);
	cxl_ops->release_one_irq(adapter, adapter->native->err_hwirq);
922 923 924
	kfree(adapter->irq_name);
}

925
int cxl_native_register_serr_irq(struct cxl_afu *afu)
926 927 928 929 930 931 932 933 934
{
	u64 serr;
	int rc;

	afu->err_irq_name = kasprintf(GFP_KERNEL, "cxl-%s-err",
				      dev_name(&afu->dev));
	if (!afu->err_irq_name)
		return -ENOMEM;

935
	if ((rc = cxl_register_one_irq(afu->adapter, native_slice_irq_err, afu,
936 937 938 939 940 941 942 943 944 945 946 947 948 949
				       &afu->serr_hwirq,
				       &afu->serr_virq, afu->err_irq_name))) {
		kfree(afu->err_irq_name);
		afu->err_irq_name = NULL;
		return rc;
	}

	serr = cxl_p1n_read(afu, CXL_PSL_SERR_An);
	serr = (serr & 0x00ffffffffff0000ULL) | (afu->serr_hwirq & 0xffff);
	cxl_p1n_write(afu, CXL_PSL_SERR_An, serr);

	return 0;
}

950
void cxl_native_release_serr_irq(struct cxl_afu *afu)
951 952 953 954 955 956
{
	if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq))
		return;

	cxl_p1n_write(afu, CXL_PSL_SERR_An, 0x0000000000000000);
	cxl_unmap_irq(afu->serr_virq, afu);
957
	cxl_ops->release_one_irq(afu->adapter, afu->serr_hwirq);
958 959 960
	kfree(afu->err_irq_name);
}

961
int cxl_native_register_psl_irq(struct cxl_afu *afu)
962 963 964 965 966 967 968 969
{
	int rc;

	afu->psl_irq_name = kasprintf(GFP_KERNEL, "cxl-%s",
				      dev_name(&afu->dev));
	if (!afu->psl_irq_name)
		return -ENOMEM;

970 971
	if ((rc = cxl_register_one_irq(afu->adapter, native_irq_multiplexed,
				    afu, &afu->native->psl_hwirq, &afu->native->psl_virq,
972 973 974 975 976 977 978
				    afu->psl_irq_name))) {
		kfree(afu->psl_irq_name);
		afu->psl_irq_name = NULL;
	}
	return rc;
}

979
void cxl_native_release_psl_irq(struct cxl_afu *afu)
980
{
981
	if (afu->native->psl_virq != irq_find_mapping(NULL, afu->native->psl_hwirq))
982 983
		return;

984 985
	cxl_unmap_irq(afu->native->psl_virq, afu);
	cxl_ops->release_one_irq(afu->adapter, afu->native->psl_hwirq);
986 987 988
	kfree(afu->psl_irq_name);
}

989 990 991 992
static void recover_psl_err(struct cxl_afu *afu, u64 errstat)
{
	u64 dsisr;

993
	pr_devel("RECOVERING FROM PSL ERROR... (0x%016llx)\n", errstat);
994 995 996 997 998 999 1000 1001 1002

	/* Clear PSL_DSISR[PE] */
	dsisr = cxl_p2n_read(afu, CXL_PSL_DSISR_An);
	cxl_p2n_write(afu, CXL_PSL_DSISR_An, dsisr & ~CXL_PSL_DSISR_An_PE);

	/* Write 1s to clear error status bits */
	cxl_p2n_write(afu, CXL_PSL_ErrStat_An, errstat);
}

1003
static int native_ack_irq(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask)
1004
{
I
Ian Munsie 已提交
1005
	trace_cxl_psl_irq_ack(ctx, tfc);
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
	if (tfc)
		cxl_p2n_write(ctx->afu, CXL_PSL_TFC_An, tfc);
	if (psl_reset_mask)
		recover_psl_err(ctx->afu, psl_reset_mask);

	return 0;
}

int cxl_check_error(struct cxl_afu *afu)
{
	return (cxl_p1n_read(afu, CXL_PSL_SCNTL_An) == ~0ULL);
}
1018

1019 1020 1021 1022 1023 1024
static bool native_support_attributes(const char *attr_name,
				      enum cxl_attrs type)
{
	return true;
}

1025
static int native_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off, u64 *out)
1026
{
1027
	if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
1028 1029 1030
		return -EIO;
	if (unlikely(off >= afu->crs_len))
		return -ERANGE;
1031
	*out = in_le64(afu->native->afu_desc_mmio + afu->crs_offset +
1032 1033
		(cr * afu->crs_len) + off);
	return 0;
1034 1035
}

1036
static int native_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off, u32 *out)
1037
{
1038
	if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
1039 1040 1041
		return -EIO;
	if (unlikely(off >= afu->crs_len))
		return -ERANGE;
1042
	*out = in_le32(afu->native->afu_desc_mmio + afu->crs_offset +
1043 1044
		(cr * afu->crs_len) + off);
	return 0;
1045 1046
}

1047
static int native_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off, u16 *out)
1048 1049 1050
{
	u64 aligned_off = off & ~0x3L;
	u32 val;
1051
	int rc;
1052

1053
	rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
1054 1055 1056
	if (!rc)
		*out = (val >> ((off & 0x3) * 8)) & 0xffff;
	return rc;
1057 1058
}

1059
static int native_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off, u8 *out)
1060 1061 1062
{
	u64 aligned_off = off & ~0x3L;
	u32 val;
1063
	int rc;
1064

1065
	rc = native_afu_cr_read32(afu, cr, aligned_off, &val);
1066 1067 1068
	if (!rc)
		*out = (val >> ((off & 0x3) * 8)) & 0xff;
	return rc;
1069
}
1070

1071 1072
static int native_afu_cr_write32(struct cxl_afu *afu, int cr, u64 off, u32 in)
{
1073
	if (unlikely(!cxl_ops->link_ok(afu->adapter, afu)))
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116
		return -EIO;
	if (unlikely(off >= afu->crs_len))
		return -ERANGE;
	out_le32(afu->native->afu_desc_mmio + afu->crs_offset +
		(cr * afu->crs_len) + off, in);
	return 0;
}

static int native_afu_cr_write16(struct cxl_afu *afu, int cr, u64 off, u16 in)
{
	u64 aligned_off = off & ~0x3L;
	u32 val32, mask, shift;
	int rc;

	rc = native_afu_cr_read32(afu, cr, aligned_off, &val32);
	if (rc)
		return rc;
	shift = (off & 0x3) * 8;
	WARN_ON(shift == 24);
	mask = 0xffff << shift;
	val32 = (val32 & ~mask) | (in << shift);

	rc = native_afu_cr_write32(afu, cr, aligned_off, val32);
	return rc;
}

static int native_afu_cr_write8(struct cxl_afu *afu, int cr, u64 off, u8 in)
{
	u64 aligned_off = off & ~0x3L;
	u32 val32, mask, shift;
	int rc;

	rc = native_afu_cr_read32(afu, cr, aligned_off, &val32);
	if (rc)
		return rc;
	shift = (off & 0x3) * 8;
	mask = 0xff << shift;
	val32 = (val32 & ~mask) | (in << shift);

	rc = native_afu_cr_write32(afu, cr, aligned_off, val32);
	return rc;
}

1117 1118
const struct cxl_backend_ops cxl_native_ops = {
	.module = THIS_MODULE,
1119 1120 1121 1122 1123 1124 1125
	.adapter_reset = cxl_pci_reset,
	.alloc_one_irq = cxl_pci_alloc_one_irq,
	.release_one_irq = cxl_pci_release_one_irq,
	.alloc_irq_ranges = cxl_pci_alloc_irq_ranges,
	.release_irq_ranges = cxl_pci_release_irq_ranges,
	.setup_irq = cxl_pci_setup_irq,
	.handle_psl_slice_error = native_handle_psl_slice_error,
1126
	.psl_interrupt = NULL,
1127
	.ack_irq = native_ack_irq,
1128
	.irq_wait = native_irq_wait,
1129 1130
	.attach_process = native_attach_process,
	.detach_process = native_detach_process,
1131
	.support_attributes = native_support_attributes,
1132
	.link_ok = cxl_adapter_link_ok,
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
	.release_afu = cxl_pci_release_afu,
	.afu_read_err_buffer = cxl_pci_afu_read_err_buffer,
	.afu_check_and_enable = native_afu_check_and_enable,
	.afu_activate_mode = native_afu_activate_mode,
	.afu_deactivate_mode = native_afu_deactivate_mode,
	.afu_reset = native_afu_reset,
	.afu_cr_read8 = native_afu_cr_read8,
	.afu_cr_read16 = native_afu_cr_read16,
	.afu_cr_read32 = native_afu_cr_read32,
	.afu_cr_read64 = native_afu_cr_read64,
1143 1144 1145 1146
	.afu_cr_write8 = native_afu_cr_write8,
	.afu_cr_write16 = native_afu_cr_write16,
	.afu_cr_write32 = native_afu_cr_write32,
	.read_adapter_vpd = cxl_pci_read_adapter_vpd,
1147
};