Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / powerpc / platforms / powernv / copy-paste.h
blobc9a50362343107b079875233faac064301435084
1 /*
2 * Copyright 2016-17 IBM Corp.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9 #include <asm/ppc-opcode.h>
11 #define CR0_SHIFT 28
12 #define CR0_MASK 0xF
14 * Copy/paste instructions:
16 * copy RA,RB
17 * Copy contents of address (RA) + effective_address(RB)
18 * to internal copy-buffer.
20 * paste RA,RB
21 * Paste contents of internal copy-buffer to the address
22 * (RA) + effective_address(RB)
24 static inline int vas_copy(void *crb, int offset)
26 asm volatile(PPC_COPY(%0, %1)";"
28 : "b" (offset), "b" (crb)
29 : "memory");
31 return 0;
34 static inline int vas_paste(void *paste_address, int offset)
36 u32 cr;
38 cr = 0;
39 asm volatile(PPC_PASTE(%1, %2)";"
40 "mfocrf %0, 0x80;"
41 : "=r" (cr)
42 : "b" (offset), "b" (paste_address)
43 : "memory", "cr0");
45 return (cr >> CR0_SHIFT) & CR0_MASK;