Lines Matching +full:key +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-or-later
14 #define CR0_FETCH_PROTECTION_OVERRIDE (1UL << (63 - 38))
15 #define CR0_STORAGE_PROTECTION_OVERRIDE (1UL << (63 - 39))
22 static int set_storage_key(void *addr, uint8_t key) in set_storage_key() argument
31 "0: sske %[key], %[addr]\n" in set_storage_key()
34 : [key] "r" (key) in set_storage_key()
37 return -not_mapped; in set_storage_key()
47 static enum permission test_protection(void *addr, uint8_t key) in test_protection() argument
52 "tprot %[addr], 0(%[key])\n" in test_protection()
56 [key] "a" (key) in test_protection()
75 uint8_t key; member
80 * the specified addr with the specified key and checking if the returned
91 * See Enhanced Suppression-on-Protection Facilities in the
92 * Interpretive-Execution Mode
95 * guest: set storage key of page_store_prot to 1
96 * storage key of page_fetch_prot to 9 and enable
101 /* access key 0 matches any storage key -> RW */
103 /* access key matches storage key -> RW */
105 /* mismatched keys, but no fetch protection -> RO */
107 /* access key 0 matches any storage key -> RW */
109 /* access key matches storage key -> RW */
111 /* mismatched keys, fetch protection -> inaccessible */
113 /* page 0 not mapped yet -> translation not available */
117 * guest: set storage key of page 0 to 9 and enable fetch protection
120 * enable fetch protection override
122 /* mismatched keys, fetch protection, but override applies -> RO */
124 /* mismatched keys, fetch protection, override applies to 0-2048 only -> inaccessible */
127 * host: enable storage protection override
129 /* mismatched keys, but override applies (storage key 9) -> RW */
131 /* mismatched keys, no fetch protection, override doesn't apply -> RO */
133 /* mismatched keys, but override applies (storage key 9) -> RW */
157 result = test_protection(tests[*i].addr, tests[*i].key); in perform_next_stage()
176 /* Fetch-protection override */ in guest_code()
181 /* Storage-protection override */ in guest_code()
216 run = vcpu->run; in main()
226 ksft_test_result_skip("STAGE_INIT_FETCH_PROT_OVERRIDE - " in main()
233 run->s.regs.crs[0] |= CR0_FETCH_PROTECTION_OVERRIDE; in main()
234 run->kvm_dirty_regs = KVM_SYNC_CRS; in main()
237 run->s.regs.crs[0] |= CR0_STORAGE_PROTECTION_OVERRIDE; in main()
238 run->kvm_dirty_regs = KVM_SYNC_CRS; in main()