/* * Copyright 2015, Michael Neuling, IBM Corp. * Licensed under GPLv2. * * Original: Michael Neuling 4/12/2013 * Edited: Rashmica Gupta 4/12/2015 * * See if the altivec state is leaked out of an aborted transaction due to * kernel vmx copy loops. * * When the transaction aborts, VSR values should rollback to the values * they held before the transaction commenced. Using VSRs while transaction * is suspended should not affect the checkpointed values. * * (1) write A to a VSR * (2) start transaction * (3) suspend transaction * (4) change the VSR to B * (5) trigger kernel vmx copy loop * (6) abort transaction * (7) check that the VSR value is A */ #include #include #include #include #include #include #include #include "tm.h" #include "utils.h" int test_vmxcopy() { long double vecin = 1.3; long double vecout; unsigned long pgsize = getpagesize(); int i; int fd; int size = pgsize*16; char tmpfile[] = "/tmp/page_faultXXXXXX"; char buf[pgsize]; char *a; uint64_t aborted = 0; SKIP_IF(!have_htm()); fd = mkstemp(tmpfile); assert(fd >= 0); memset(buf, 0, pgsize); for (i = 0; i < size; i += pgsize) assert(write(fd, buf, pgsize) == pgsize); unlink(tmpfile); a = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); assert(a != MAP_FAILED); asm __volatile__( "lxvd2x 40,0,%[vecinptr];" /* set 40 to initial value*/ "tbegin.;" "beq 3f;" "tsuspend.;" "xxlxor 40,40,40;" /* set 40 to 0 */ "std 5, 0(%[map]);" /* cause kernel vmx copy page */ "tabort. 0;" "tresume.;" "tend.;" "li %[res], 0;" "b 5f;" /* Abort handler */ "3:;" "li %[res], 1;" "5:;" "stxvd2x 40,0,%[vecoutptr];" : [res]"=r"(aborted) : [vecinptr]"r"(&vecin), [vecoutptr]"r"(&vecout), [map]"r"(a) : "memory", "r0", "r3", "r4", "r5", "r6", "r7"); if (aborted && (vecin != vecout)){ printf("FAILED: vector state leaked on abort %f != %f\n", (double)vecin, (double)vecout); return 1; } munmap(a, size); close(fd); return 0; } int main(void) { return test_harness(test_vmxcopy, "tm_vmxcopy"); } b/chipidea/bits.h?h=nds-private-remove&id=e69e46261063a25c3907bed16a2e9d18b115d1fd'>diff
'>
AgeCommit message (Expand)AuthorFilesLines
space:
mode:
authorBhumika Goyal <bhumirks@gmail.com>2017-01-25 00:54:07 +0530
committerDan Williams <dan.j.williams@intel.com>2017-01-31 18:16:30 -0800
commit970d14e3989160ee9e97c7d75ecbc893fd29dab9 (patch)
tree4a731cac4efedb17f86a912ec56c151d26792abe /sound/soc/codecs/pcm179x-spi.c
parent7a308bb3016f57e5be11a677d15b821536419d36 (diff)
nvdimm: constify device_type structures
Declare device_type structure as const as it is only stored in the type field of a device structure. This field is of type const, so add const to declaration of device_type structure. File size before: text data bss dec hex filename 19278 3199 16 22493 57dd nvdimm/namespace_devs.o File size after: text data bss dec hex filename 19929 3160 16 23105 5a41 nvdimm/namespace_devs.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'sound/soc/codecs/pcm179x-spi.c')