Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Hafnium Authors. |
| 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <gmock/gmock.h> |
| 10 | |
| 11 | extern "C" { |
Daniel Boulby | 8435071 | 2021-11-26 11:13:20 +0000 | [diff] [blame] | 12 | #include "hf/check.h" |
J-Alves | 67f5ba3 | 2024-09-27 18:07:11 +0100 | [diff] [blame] | 13 | #include "hf/list.h" |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 14 | #include "hf/mpool.h" |
Madhukar Pappireddy | a067dc1 | 2024-10-16 22:20:44 -0500 | [diff] [blame] | 15 | #include "hf/timer_mgmt.h" |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 16 | #include "hf/vm.h" |
| 17 | } |
| 18 | |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 19 | #include <list> |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 20 | #include <memory> |
| 21 | #include <span> |
| 22 | #include <vector> |
| 23 | |
| 24 | #include "mm_test.hh" |
| 25 | |
| 26 | namespace |
| 27 | { |
| 28 | using namespace ::std::placeholders; |
| 29 | |
| 30 | using ::testing::AllOf; |
| 31 | using ::testing::Each; |
| 32 | using ::testing::SizeIs; |
| 33 | |
| 34 | using struct_vm = struct vm; |
Olivier Deprez | 181074b | 2023-02-02 14:53:23 +0100 | [diff] [blame] | 35 | using struct_vcpu = struct vcpu; |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 36 | using struct_vm_locked = struct vm_locked; |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 37 | |
Olivier Deprez | d5a5489 | 2023-02-02 16:45:59 +0100 | [diff] [blame] | 38 | constexpr size_t TEST_HEAP_SIZE = PAGE_SIZE * 64; |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 39 | const int TOP_LEVEL = arch_mm_stage2_max_level(); |
| 40 | |
| 41 | class vm : public ::testing::Test |
| 42 | { |
Olivier Deprez | d5a5489 | 2023-02-02 16:45:59 +0100 | [diff] [blame] | 43 | protected: |
| 44 | static std::unique_ptr<uint8_t[]> test_heap; |
| 45 | |
| 46 | struct mpool ppool; |
| 47 | |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 48 | void SetUp() override |
| 49 | { |
Olivier Deprez | d5a5489 | 2023-02-02 16:45:59 +0100 | [diff] [blame] | 50 | if (!test_heap) { |
| 51 | /* |
| 52 | * TODO: replace with direct use of stdlib allocator so |
| 53 | * sanitizers are more effective. |
| 54 | */ |
| 55 | test_heap = std::make_unique<uint8_t[]>(TEST_HEAP_SIZE); |
| 56 | mpool_init(&ppool, sizeof(struct mm_page_table)); |
| 57 | mpool_add_chunk(&ppool, test_heap.get(), |
| 58 | TEST_HEAP_SIZE); |
| 59 | } |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 60 | } |
| 61 | |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 62 | public: |
J-Alves | beeb6dc | 2021-12-08 18:21:32 +0000 | [diff] [blame] | 63 | static bool BootOrderSmallerThan(struct_vm *vm1, struct_vm *vm2) |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 64 | { |
J-Alves | beeb6dc | 2021-12-08 18:21:32 +0000 | [diff] [blame] | 65 | return vm1->boot_order < vm2->boot_order; |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 66 | } |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
Olivier Deprez | d5a5489 | 2023-02-02 16:45:59 +0100 | [diff] [blame] | 69 | std::unique_ptr<uint8_t[]> vm::test_heap; |
| 70 | |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 71 | /** |
| 72 | * If nothing is mapped, unmapping the hypervisor has no effect. |
| 73 | */ |
| 74 | TEST_F(vm, vm_unmap_hypervisor_not_mapped) |
| 75 | { |
| 76 | struct_vm *vm; |
| 77 | struct vm_locked vm_locked; |
| 78 | |
Olivier Deprez | 878bd5b | 2021-04-15 19:05:10 +0200 | [diff] [blame] | 79 | /* TODO: check ptable usage (security state?) */ |
Madhukar Pappireddy | 070f49e | 2024-01-12 13:02:27 -0600 | [diff] [blame] | 80 | EXPECT_TRUE(vm_init_next(1, &ppool, &vm, false, 0)); |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 81 | vm_locked = vm_lock(vm); |
Raghu Krishnamurthy | 0132b51 | 2021-02-03 14:13:26 -0800 | [diff] [blame] | 82 | ASSERT_TRUE(mm_vm_init(&vm->ptable, vm->id, &ppool)); |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 83 | EXPECT_TRUE(vm_unmap_hypervisor(vm_locked, &ppool)); |
| 84 | EXPECT_THAT( |
| 85 | mm_test::get_ptable(vm->ptable), |
| 86 | AllOf(SizeIs(4), Each(Each(arch_mm_absent_pte(TOP_LEVEL))))); |
| 87 | mm_vm_fini(&vm->ptable, &ppool); |
| 88 | vm_unlock(&vm_locked); |
| 89 | } |
| 90 | |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 91 | /** |
| 92 | * Validate the "boot_list" is created properly, according to vm's "boot_order" |
| 93 | * field. |
| 94 | */ |
| 95 | TEST_F(vm, vm_boot_order) |
| 96 | { |
| 97 | struct_vm *vm_cur; |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 98 | struct_vm *vm; |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 99 | std::list<struct_vm *> expected_final_order; |
| 100 | |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 101 | /* |
Olivier Deprez | 181074b | 2023-02-02 14:53:23 +0100 | [diff] [blame] | 102 | * Insertion when no call to "vcpu_update_boot" has been made yet. |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 103 | * The "boot_list" is expected to be empty. |
| 104 | */ |
Madhukar Pappireddy | 070f49e | 2024-01-12 13:02:27 -0600 | [diff] [blame] | 105 | EXPECT_TRUE(vm_init_next(1, &ppool, &vm_cur, false, 0)); |
J-Alves | beeb6dc | 2021-12-08 18:21:32 +0000 | [diff] [blame] | 106 | vm_cur->boot_order = 3; |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 107 | vm_update_boot(vm_cur); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 108 | expected_final_order.push_back(vm_cur); |
| 109 | |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 110 | EXPECT_EQ(vm_get_boot_vm()->id, vm_cur->id); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 111 | |
| 112 | /* Insertion at the head of the boot list */ |
Madhukar Pappireddy | 070f49e | 2024-01-12 13:02:27 -0600 | [diff] [blame] | 113 | EXPECT_TRUE(vm_init_next(1, &ppool, &vm_cur, false, 0)); |
J-Alves | beeb6dc | 2021-12-08 18:21:32 +0000 | [diff] [blame] | 114 | vm_cur->boot_order = 1; |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 115 | vm_update_boot(vm_cur); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 116 | expected_final_order.push_back(vm_cur); |
| 117 | |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 118 | EXPECT_EQ(vm_get_boot_vm()->id, vm_cur->id); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 119 | |
| 120 | /* Insertion of two in the middle of the boot list */ |
Olivier Deprez | 181074b | 2023-02-02 14:53:23 +0100 | [diff] [blame] | 121 | for (uint32_t i = 0; i < 2; i++) { |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 122 | EXPECT_TRUE(vm_init_next(MAX_CPUS, &ppool, &vm_cur, false, 0)); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 123 | vm_cur->boot_order = 2; |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 124 | vm_update_boot(vm_cur); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 125 | expected_final_order.push_back(vm_cur); |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | * Insertion in the end of the list. |
| 130 | * This tests shares the data with "vm_unmap_hypervisor_not_mapped". |
| 131 | * As such, a VM is expected to have been initialized before this |
| 132 | * test, with ID 1 and boot_order 0. |
| 133 | */ |
| 134 | vm_cur = vm_find(1); |
| 135 | EXPECT_FALSE(vm_cur == NULL); |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 136 | vm_update_boot(vm_cur); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 137 | expected_final_order.push_back(vm_cur); |
| 138 | |
| 139 | /* |
| 140 | * Number of VMs initialized should be the same as in the |
| 141 | * "expected_final_order", before the final verification. |
| 142 | */ |
| 143 | EXPECT_EQ(expected_final_order.size(), vm_get_count()) |
| 144 | << "Something went wrong with the test itself...\n"; |
| 145 | |
J-Alves | beeb6dc | 2021-12-08 18:21:32 +0000 | [diff] [blame] | 146 | /* Sort VMs from lower to higher "boot_order" field.*/ |
| 147 | expected_final_order.sort(vm::BootOrderSmallerThan); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 148 | |
| 149 | std::list<struct_vm *>::iterator it; |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 150 | vm = vm_get_boot_vm(); |
Olivier Deprez | 181074b | 2023-02-02 14:53:23 +0100 | [diff] [blame] | 151 | for (it = expected_final_order.begin(); |
| 152 | it != expected_final_order.end(); it++) { |
Madhukar Pappireddy | a49ba16 | 2024-11-25 09:40:45 -0600 | [diff] [blame] | 153 | EXPECT_TRUE(vm != NULL); |
| 154 | EXPECT_EQ((*it)->id, vm->id); |
| 155 | vm = vm_get_next_boot(vm); |
J-Alves | b37fd08 | 2020-10-22 12:29:21 +0100 | [diff] [blame] | 156 | } |
| 157 | } |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 158 | |
Madhukar Pappireddy | a067dc1 | 2024-10-16 22:20:44 -0500 | [diff] [blame] | 159 | TEST_F(vm, vcpu_arch_timer) |
| 160 | { |
| 161 | const cpu_id_t cpu_ids[2] = {0, 1}; |
| 162 | struct_vcpu *vm0_vcpu; |
| 163 | struct_vcpu *vm1_vcpu; |
| 164 | struct_vcpu *deadline_vcpu; |
| 165 | struct_vcpu *target_vcpu; |
| 166 | struct vcpu_locked vcpu_locked; |
| 167 | struct cpu *cpu0; |
| 168 | struct cpu *cpu1; |
| 169 | |
| 170 | /* Initialie CPU module with two physical CPUs. */ |
| 171 | cpu_module_init(cpu_ids, 2); |
| 172 | cpu0 = cpu_find_index(0); |
| 173 | cpu1 = cpu_find_index(1); |
| 174 | |
| 175 | /* Two UP endpoints are deployed for this test. */ |
| 176 | CHECK(vm_get_count() >= 2); |
| 177 | vm0_vcpu = vm_get_vcpu(vm_find_index(0), 0); |
| 178 | vm1_vcpu = vm_get_vcpu(vm_find_index(1), 0); |
| 179 | |
| 180 | /* The execution context of each VM is scheduled on CPU0. */ |
| 181 | vm0_vcpu->cpu = cpu0; |
| 182 | vm1_vcpu->cpu = cpu0; |
| 183 | |
| 184 | /* |
| 185 | * Enable the timer peripheral for each vCPU and setup an arbitraty |
| 186 | * countdown value. |
| 187 | */ |
| 188 | vm0_vcpu->regs.arch_timer.cval = 555555; |
| 189 | vm1_vcpu->regs.arch_timer.cval = 999999; |
| 190 | vm0_vcpu->regs.arch_timer.ctl = 1; |
| 191 | vm1_vcpu->regs.arch_timer.ctl = 1; |
| 192 | |
| 193 | /* No vCPU is being tracked through either timer list. */ |
| 194 | deadline_vcpu = timer_find_vcpu_nearest_deadline(cpu0); |
| 195 | EXPECT_TRUE(deadline_vcpu == NULL); |
| 196 | deadline_vcpu = timer_find_vcpu_nearest_deadline(cpu1); |
| 197 | EXPECT_TRUE(deadline_vcpu == NULL); |
| 198 | |
| 199 | /* vCPU of VM0 and VM1 are being added to the list. */ |
| 200 | timer_vcpu_manage(vm0_vcpu); |
| 201 | timer_vcpu_manage(vm1_vcpu); |
| 202 | |
| 203 | deadline_vcpu = timer_find_vcpu_nearest_deadline(cpu0); |
| 204 | EXPECT_EQ(deadline_vcpu, vm0_vcpu); |
| 205 | |
| 206 | /* Remove one of the vCPUs from the CPU0 list. */ |
| 207 | vm0_vcpu->regs.arch_timer.cval = 0; |
| 208 | vm0_vcpu->regs.arch_timer.ctl = 0; |
| 209 | timer_vcpu_manage(vm0_vcpu); |
| 210 | |
| 211 | /* This leaves one vCPU entry on CPU0 list. */ |
| 212 | deadline_vcpu = timer_find_vcpu_nearest_deadline(cpu0); |
| 213 | EXPECT_EQ(deadline_vcpu, vm1_vcpu); |
| 214 | |
| 215 | /* Attempt to migrate VM1 vCPU from CPU0 to CPU1. */ |
| 216 | vcpu_locked = vcpu_lock(vm1_vcpu); |
| 217 | timer_migrate_to_other_cpu(cpu1, vcpu_locked); |
| 218 | vcpu_unlock(&vcpu_locked); |
| 219 | |
| 220 | /* |
| 221 | * After migration, ensure the list is empty on CPU0 but non-empty on |
| 222 | * CPU1. |
| 223 | */ |
| 224 | deadline_vcpu = timer_find_vcpu_nearest_deadline(cpu0); |
| 225 | EXPECT_TRUE(deadline_vcpu == NULL); |
| 226 | |
| 227 | /* |
| 228 | * vCPU of VM1 is now running on CPU1. It must be the target vCPU when |
| 229 | * the timer has expired. |
| 230 | */ |
| 231 | target_vcpu = timer_find_target_vcpu(vm1_vcpu); |
| 232 | EXPECT_EQ(target_vcpu, vm1_vcpu); |
| 233 | } |
| 234 | |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 235 | /** |
| 236 | * Validates updates and check functions for binding notifications to endpoints. |
| 237 | */ |
| 238 | TEST_F(vm, vm_notifications_bind_diff_senders) |
| 239 | { |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 240 | struct_vm *current_vm = nullptr; |
| 241 | struct vm_locked current_vm_locked; |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 242 | std::vector<struct_vm *> dummy_senders; |
| 243 | ffa_notifications_bitmap_t bitmaps[] = { |
| 244 | 0x00000000FFFFFFFFU, 0xFFFFFFFF00000000U, 0x0000FFFFFFFF0000U}; |
| 245 | bool is_from_vm = true; |
| 246 | |
| 247 | /* For the subsequent tests three VMs are used. */ |
| 248 | CHECK(vm_get_count() >= 3); |
| 249 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 250 | current_vm = vm_find_index(0); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 251 | |
| 252 | dummy_senders.push_back(vm_find_index(1)); |
| 253 | dummy_senders.push_back(vm_find_index(2)); |
| 254 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 255 | current_vm_locked = vm_lock(current_vm); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 256 | |
| 257 | for (unsigned int i = 0; i < 2; i++) { |
| 258 | /* Validate bindings condition after initialization. */ |
| 259 | EXPECT_TRUE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 260 | current_vm_locked, is_from_vm, HF_INVALID_VM_ID, |
| 261 | bitmaps[i], false)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 262 | |
| 263 | /* |
| 264 | * Validate bind related operations. For this test considering |
| 265 | * only global notifications. |
| 266 | */ |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 267 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 268 | dummy_senders[i]->id, |
| 269 | bitmaps[i], false); |
| 270 | |
| 271 | EXPECT_TRUE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 272 | current_vm_locked, is_from_vm, dummy_senders[i]->id, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 273 | bitmaps[i], false)); |
| 274 | |
| 275 | EXPECT_FALSE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 276 | current_vm_locked, is_from_vm, dummy_senders[1 - i]->id, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 277 | bitmaps[i], false)); |
| 278 | |
| 279 | EXPECT_FALSE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 280 | current_vm_locked, is_from_vm, dummy_senders[i]->id, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 281 | bitmaps[1 - i], false)); |
| 282 | |
| 283 | EXPECT_FALSE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 284 | current_vm_locked, is_from_vm, dummy_senders[i]->id, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 285 | bitmaps[2], false)); |
| 286 | } |
| 287 | |
| 288 | /** Clean up bind for other tests. */ |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 289 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 290 | bitmaps[0], false); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 291 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 292 | bitmaps[1], false); |
| 293 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 294 | vm_unlock(¤t_vm_locked); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Validates updates and check functions for binding notifications, namely the |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 299 | * configuration of bindings of global and per-vCPU notifications. |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 300 | */ |
| 301 | TEST_F(vm, vm_notification_bind_per_vcpu_vs_global) |
| 302 | { |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 303 | struct_vm *current_vm; |
| 304 | struct vm_locked current_vm_locked; |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 305 | struct_vm *dummy_sender; |
| 306 | ffa_notifications_bitmap_t global = 0x00000000FFFFFFFFU; |
| 307 | ffa_notifications_bitmap_t per_vcpu = ~global; |
| 308 | bool is_from_vm = true; |
| 309 | |
| 310 | CHECK(vm_get_count() >= 2); |
| 311 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 312 | current_vm = vm_find_index(0); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 313 | |
| 314 | dummy_sender = vm_find_index(1); |
| 315 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 316 | current_vm_locked = vm_lock(current_vm); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 317 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 318 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 319 | dummy_sender->id, global, false); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 320 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 321 | dummy_sender->id, per_vcpu, true); |
| 322 | |
| 323 | /* Check validation of global notifications bindings. */ |
| 324 | EXPECT_TRUE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 325 | current_vm_locked, is_from_vm, dummy_sender->id, global, |
| 326 | false)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 327 | |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 328 | /* Check validation of per-vCPU notifications bindings. */ |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 329 | EXPECT_TRUE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 330 | current_vm_locked, is_from_vm, dummy_sender->id, per_vcpu, |
| 331 | true)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 332 | |
| 333 | /** |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 334 | * Check that global notifications are not validated as per-vCPU, and |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 335 | * vice-versa. |
| 336 | */ |
| 337 | EXPECT_FALSE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 338 | current_vm_locked, is_from_vm, dummy_sender->id, global, true)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 339 | EXPECT_FALSE(vm_notifications_validate_binding( |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 340 | current_vm_locked, is_from_vm, dummy_sender->id, per_vcpu, |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 341 | false)); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 342 | EXPECT_FALSE(vm_notifications_validate_binding( |
| 343 | current_vm_locked, is_from_vm, dummy_sender->id, |
| 344 | global | per_vcpu, true)); |
| 345 | EXPECT_FALSE(vm_notifications_validate_binding( |
| 346 | current_vm_locked, is_from_vm, dummy_sender->id, |
| 347 | global | per_vcpu, false)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 348 | |
| 349 | /** Undo the bindings */ |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 350 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0, |
| 351 | global, false); |
| 352 | EXPECT_TRUE(vm_notifications_validate_binding( |
| 353 | current_vm_locked, is_from_vm, 0, global, false)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 354 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 355 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0, |
| 356 | per_vcpu, false); |
| 357 | EXPECT_TRUE(vm_notifications_validate_binding( |
| 358 | current_vm_locked, is_from_vm, 0, per_vcpu, false)); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 359 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 360 | vm_unlock(¤t_vm_locked); |
J-Alves | 60eaff9 | 2021-05-27 14:54:41 +0100 | [diff] [blame] | 361 | } |
| 362 | |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 363 | /** |
| 364 | * Validates accesses to notifications bitmaps. |
| 365 | */ |
| 366 | TEST_F(vm, vm_notifications_set_and_get) |
| 367 | { |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 368 | struct_vm *current_vm; |
| 369 | struct vm_locked current_vm_locked; |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 370 | struct_vm *dummy_sender; |
| 371 | ffa_notifications_bitmap_t global = 0x00000000FFFFFFFFU; |
| 372 | ffa_notifications_bitmap_t per_vcpu = ~global; |
| 373 | ffa_notifications_bitmap_t ret; |
Raghu Krishnamurthy | 30aabd6 | 2022-09-17 21:41:00 -0700 | [diff] [blame] | 374 | const unsigned int vcpu_idx = 0; |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 375 | struct notifications *notifications; |
| 376 | const bool is_from_vm = true; |
| 377 | |
| 378 | CHECK(vm_get_count() >= 2); |
| 379 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 380 | current_vm = vm_find_index(0); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 381 | dummy_sender = vm_find_index(1); |
| 382 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 383 | notifications = ¤t_vm->notifications.from_vm; |
| 384 | current_vm_locked = vm_lock(current_vm); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 385 | |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 386 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 387 | dummy_sender->id, global, false); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 388 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 389 | dummy_sender->id, per_vcpu, true); |
| 390 | |
| 391 | /* |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 392 | * Validate get notifications bitmap for global notifications. |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 393 | */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 394 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 395 | global, 0ull, false); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 396 | |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 397 | EXPECT_EQ(notifications->global.pending, global); |
| 398 | |
| 399 | /* Counter should track pending notifications. */ |
| 400 | EXPECT_FALSE(vm_is_notifications_pending_count_zero()); |
| 401 | |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 402 | ret = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 403 | is_from_vm, 0ull); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 404 | EXPECT_EQ(ret, global); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 405 | EXPECT_EQ(notifications->global.pending, 0ull); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 406 | |
| 407 | /* |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 408 | * After getting the pending notifications, the pending count should |
| 409 | * be zeroed. |
| 410 | */ |
| 411 | EXPECT_TRUE(vm_is_notifications_pending_count_zero()); |
| 412 | |
| 413 | /* |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 414 | * Validate get notifications bitmap for per-vCPU notifications. |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 415 | */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 416 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 417 | per_vcpu, vcpu_idx, true); |
J-Alves | fc50ef7 | 2025-02-03 11:57:51 +0000 | [diff] [blame^] | 418 | |
| 419 | /* |
| 420 | * Duplicate call to check that the state of the counters doesn't alter |
| 421 | * because of it. |
| 422 | */ |
| 423 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 424 | per_vcpu, vcpu_idx, true); |
| 425 | |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 426 | EXPECT_FALSE(vm_is_notifications_pending_count_zero()); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 427 | |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 428 | ret = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 429 | is_from_vm, vcpu_idx); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 430 | EXPECT_EQ(ret, per_vcpu); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 431 | EXPECT_EQ(notifications->per_vcpu[vcpu_idx].pending, 0ull); |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 432 | EXPECT_TRUE(vm_is_notifications_pending_count_zero()); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 433 | |
| 434 | /* |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 435 | * Validate that getting notifications for a specific vCPU also returns |
| 436 | * global notifications. |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 437 | */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 438 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 439 | per_vcpu, vcpu_idx, true); |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 440 | |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 441 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 442 | global, 0ull, false); |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 443 | EXPECT_FALSE(vm_is_notifications_pending_count_zero()); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 444 | |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 445 | ret = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 446 | is_from_vm, vcpu_idx); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 447 | EXPECT_EQ(ret, per_vcpu | global); |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 448 | EXPECT_EQ(notifications->per_vcpu[vcpu_idx].pending, 0ull); |
| 449 | EXPECT_EQ(notifications->global.pending, 0ull); |
J-Alves | 8450ecb | 2025-02-03 11:51:39 +0000 | [diff] [blame] | 450 | EXPECT_TRUE(vm_is_notifications_pending_count_zero()); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 451 | |
| 452 | /** Undo the binding */ |
J-Alves | d3e8162 | 2021-10-05 14:55:57 +0100 | [diff] [blame] | 453 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0ull, |
| 454 | global, false); |
| 455 | vm_notifications_update_bindings(current_vm_locked, is_from_vm, 0ull, |
| 456 | per_vcpu, true); |
| 457 | vm_unlock(¤t_vm_locked); |
J-Alves | ce2f8d3 | 2021-06-10 18:30:21 +0100 | [diff] [blame] | 458 | } |
| 459 | |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 460 | /** |
| 461 | * Validates simple getting of notifications info for global notifications. |
| 462 | */ |
| 463 | TEST_F(vm, vm_notifications_info_get_global) |
| 464 | { |
| 465 | ffa_notifications_bitmap_t to_set = 0xFU; |
| 466 | ffa_notifications_bitmap_t got; |
| 467 | |
| 468 | /** |
| 469 | * Following set of variables that are also expected to be used when |
| 470 | * handling FFA_NOTIFICATION_INFO_GET. |
| 471 | */ |
| 472 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 473 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 474 | uint32_t ids_count = 0; |
| 475 | uint32_t lists_count = 0; |
| 476 | enum notifications_info_get_state current_state = INIT; |
| 477 | |
| 478 | CHECK(vm_get_count() >= 2); |
| 479 | |
| 480 | for (unsigned int i = 0; i < 2; i++) { |
| 481 | struct_vm *current_vm = vm_find_index(0); |
| 482 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 483 | struct notifications *notifications = |
| 484 | ¤t_vm->notifications.from_sp; |
| 485 | const bool is_from_vm = false; |
| 486 | |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 487 | vm_notifications_partition_set_pending( |
| 488 | current_vm_locked, is_from_vm, to_set, 0, false); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 489 | |
| 490 | vm_notifications_info_get_pending( |
| 491 | current_vm_locked, is_from_vm, ids, &ids_count, |
| 492 | lists_sizes, &lists_count, |
| 493 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, ¤t_state); |
| 494 | |
| 495 | /* |
| 496 | * Here the number of IDs and list count should be the same. |
| 497 | * As we are testing with Global notifications, this is |
| 498 | * expected. |
| 499 | */ |
| 500 | EXPECT_EQ(ids_count, i + 1); |
| 501 | EXPECT_EQ(lists_count, i + 1); |
| 502 | EXPECT_EQ(lists_sizes[i], 0); |
| 503 | EXPECT_EQ(to_set, notifications->global.info_get_retrieved); |
| 504 | |
| 505 | /* Action must be reset to initial state for each VM. */ |
| 506 | current_state = INIT; |
| 507 | |
| 508 | /* |
| 509 | * Check that getting pending notifications gives the expected |
| 510 | * return and cleans the 'pending' and 'info_get_retrieved' |
| 511 | * bitmaps. |
| 512 | */ |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 513 | got = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 514 | is_from_vm, 0); |
| 515 | EXPECT_EQ(got, to_set); |
| 516 | |
| 517 | EXPECT_EQ(notifications->global.info_get_retrieved, 0U); |
| 518 | EXPECT_EQ(notifications->global.pending, 0U); |
| 519 | |
| 520 | vm_unlock(¤t_vm_locked); |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | /** |
| 525 | * Validates simple getting of notifications info for per-vCPU notifications. |
| 526 | */ |
| 527 | TEST_F(vm, vm_notifications_info_get_per_vcpu) |
| 528 | { |
| 529 | const ffa_notifications_bitmap_t per_vcpu = 0xFU; |
| 530 | ffa_notifications_bitmap_t got; |
| 531 | |
| 532 | /* |
| 533 | * Following set of variables that are also expected to be used when |
| 534 | * handling ffa_notification_info_get. |
| 535 | */ |
| 536 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 537 | uint32_t ids_count = 0; |
| 538 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 539 | uint32_t lists_count = 0; |
| 540 | enum notifications_info_get_state current_state = INIT; |
| 541 | |
| 542 | CHECK(vm_get_count() >= 2); |
| 543 | |
| 544 | for (unsigned int i = 0; i < 2; i++) { |
| 545 | struct_vm *current_vm = vm_find_index(0); |
| 546 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 547 | struct notifications *notifications = |
| 548 | ¤t_vm->notifications.from_sp; |
| 549 | const bool is_from_vm = false; |
| 550 | |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 551 | vm_notifications_partition_set_pending( |
| 552 | current_vm_locked, is_from_vm, per_vcpu, 0, true); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 553 | |
| 554 | vm_notifications_info_get_pending( |
| 555 | current_vm_locked, is_from_vm, ids, &ids_count, |
| 556 | lists_sizes, &lists_count, |
| 557 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, ¤t_state); |
| 558 | |
| 559 | /* |
| 560 | * Here the number of IDs and list count should be the same. |
| 561 | * As we are testing with Global notifications, this is |
| 562 | * expected. |
| 563 | */ |
| 564 | EXPECT_EQ(ids_count, (i + 1) * 2); |
| 565 | EXPECT_EQ(lists_count, i + 1); |
| 566 | EXPECT_EQ(lists_sizes[i], 1); |
| 567 | EXPECT_EQ(per_vcpu, |
| 568 | notifications->per_vcpu[0].info_get_retrieved); |
| 569 | |
| 570 | /* Action must be reset to initial state for each VM. */ |
| 571 | current_state = INIT; |
| 572 | |
| 573 | /* |
| 574 | * Check that getting pending notifications gives the expected |
| 575 | * return and cleans the 'pending' and 'info_get_retrieved' |
| 576 | * bitmaps. |
| 577 | */ |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 578 | got = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 579 | is_from_vm, 0); |
| 580 | EXPECT_EQ(got, per_vcpu); |
| 581 | |
| 582 | EXPECT_EQ(notifications->per_vcpu[0].info_get_retrieved, 0U); |
| 583 | EXPECT_EQ(notifications->per_vcpu[0].pending, 0U); |
| 584 | |
| 585 | vm_unlock(¤t_vm_locked); |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | /** |
| 590 | * Validate getting of notifications information if all VCPUs have notifications |
| 591 | * pending. |
| 592 | */ |
| 593 | TEST_F(vm, vm_notifications_info_get_per_vcpu_all_vcpus) |
| 594 | { |
| 595 | struct_vm *current_vm = nullptr; |
| 596 | struct vm_locked current_vm_locked; |
| 597 | const ffa_vcpu_count_t vcpu_count = MAX_CPUS; |
| 598 | ffa_notifications_bitmap_t got; |
| 599 | const ffa_notifications_bitmap_t global = 0xF0000; |
| 600 | |
| 601 | /* |
| 602 | * Following set of variables that are also expected to be used when |
| 603 | * handling ffa_notification_info_get. |
| 604 | */ |
| 605 | struct notifications *notifications; |
| 606 | const bool is_from_sp = false; |
| 607 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 608 | uint32_t ids_count = 0; |
| 609 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 610 | uint32_t lists_count = 0; |
| 611 | enum notifications_info_get_state current_state = INIT; |
| 612 | |
Madhukar Pappireddy | 070f49e | 2024-01-12 13:02:27 -0600 | [diff] [blame] | 613 | EXPECT_TRUE(vm_init_next(vcpu_count, &ppool, ¤t_vm, false, 0)); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 614 | current_vm_locked = vm_lock(current_vm); |
| 615 | notifications = ¤t_vm->notifications.from_sp; |
| 616 | |
| 617 | for (unsigned int i = 0; i < vcpu_count; i++) { |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 618 | vm_notifications_partition_set_pending( |
| 619 | current_vm_locked, is_from_sp, FFA_NOTIFICATION_MASK(i), |
| 620 | i, true); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | /* |
| 624 | * Adding a global notification should not change the list of IDs, |
| 625 | * because global notifications only require the VM ID to be included in |
| 626 | * the list, at least once. |
| 627 | */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 628 | vm_notifications_partition_set_pending(current_vm_locked, is_from_sp, |
| 629 | global, 0, false); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 630 | |
| 631 | vm_notifications_info_get_pending(current_vm_locked, is_from_sp, ids, |
| 632 | &ids_count, lists_sizes, &lists_count, |
| 633 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 634 | ¤t_state); |
| 635 | |
| 636 | /* |
| 637 | * This test has been conceived for the expected MAX_CPUS 4. |
| 638 | * All VCPUs have notifications of the same VM, to be broken down in 2 |
| 639 | * lists with 3 VCPU IDs, and 1 VCPU ID respectively. |
| 640 | * The list of IDs should look like: {<vm_id>, 0, 1, 2, <vm_id>, 3}. |
| 641 | */ |
| 642 | CHECK(MAX_CPUS == 4); |
| 643 | EXPECT_EQ(ids_count, 6U); |
| 644 | EXPECT_EQ(lists_count, 2U); |
| 645 | EXPECT_EQ(lists_sizes[0], 3); |
| 646 | EXPECT_EQ(lists_sizes[1], 1); |
| 647 | |
| 648 | for (unsigned int i = 0; i < vcpu_count; i++) { |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 649 | got = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 650 | is_from_sp, i); |
| 651 | |
| 652 | /* |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 653 | * The first call to |
| 654 | * vm_notifications_partition_get_pending should also |
| 655 | * include the global notifications on the return. |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 656 | */ |
| 657 | ffa_notifications_bitmap_t to_check = |
| 658 | (i != 0) ? FFA_NOTIFICATION_MASK(i) |
| 659 | : FFA_NOTIFICATION_MASK(i) | global; |
| 660 | |
| 661 | EXPECT_EQ(got, to_check); |
| 662 | |
| 663 | EXPECT_EQ(notifications->per_vcpu[i].pending, 0); |
| 664 | EXPECT_EQ(notifications->per_vcpu[i].info_get_retrieved, 0); |
| 665 | } |
| 666 | |
| 667 | vm_unlock(¤t_vm_locked); |
| 668 | } |
| 669 | |
| 670 | /** |
| 671 | * Validate change of state from 'vm_notifications_info_get_pending', when the |
| 672 | * list of IDs is full. |
| 673 | */ |
| 674 | TEST_F(vm, vm_notifications_info_get_full_per_vcpu) |
| 675 | { |
| 676 | struct_vm *current_vm = vm_find_index(0); |
| 677 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 678 | struct notifications *notifications = |
| 679 | ¤t_vm->notifications.from_sp; |
| 680 | const bool is_from_vm = false; |
| 681 | ffa_notifications_bitmap_t got = 0; |
| 682 | |
| 683 | /* |
| 684 | * Following set of variables that are also expected to be used when |
| 685 | * handling ffa_notification_info_get. |
| 686 | * For this 'ids_count' has been initialized such that it indicates |
| 687 | * there is no space in the list for a per-vCPU notification (VM ID and |
| 688 | * VCPU ID). |
| 689 | */ |
| 690 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 691 | uint32_t ids_count = FFA_NOTIFICATIONS_INFO_GET_MAX_IDS - 1; |
| 692 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 693 | uint32_t lists_count = 10; |
| 694 | enum notifications_info_get_state current_state = INIT; |
| 695 | CHECK(vm_get_count() >= 2); |
| 696 | |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 697 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 698 | FFA_NOTIFICATION_MASK(1), 0, |
| 699 | true); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 700 | |
| 701 | /* Call function to get notifications info, with only per-vCPU set. */ |
| 702 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 703 | &ids_count, lists_sizes, &lists_count, |
| 704 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 705 | ¤t_state); |
| 706 | |
| 707 | /* |
| 708 | * Verify that as soon as there isn't space to do the required |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 709 | * insertion in the list, the |
| 710 | * 'vm_notifications_partition_get_pending' returns and changes |
| 711 | * list state to FULL. In this case returning, because it would need to |
| 712 | * add two IDs (VM ID and VCPU ID). |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 713 | */ |
| 714 | EXPECT_EQ(current_state, FULL); |
| 715 | EXPECT_EQ(ids_count, FFA_NOTIFICATIONS_INFO_GET_MAX_IDS - 1); |
| 716 | EXPECT_EQ(notifications->per_vcpu[0].info_get_retrieved, 0U); |
| 717 | |
| 718 | /* |
| 719 | * At this point there is still room for the information of a global |
| 720 | * notification (only VM ID to be added). Reset 'current_state' |
| 721 | * for the insertion to happen at the last position of the array. |
| 722 | */ |
| 723 | current_state = INIT; |
| 724 | |
| 725 | /* Setting global notification */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 726 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 727 | FFA_NOTIFICATION_MASK(2), 0, |
| 728 | false); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 729 | |
| 730 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 731 | &ids_count, lists_sizes, &lists_count, |
| 732 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 733 | ¤t_state); |
| 734 | |
| 735 | /* |
| 736 | * Now List must be full, the set global notification must be part of |
| 737 | * 'info_get_retrieved', and the 'current_state' should be set to FULL |
| 738 | * due to the pending per-vCPU notification in VCPU 0. |
| 739 | */ |
| 740 | EXPECT_EQ(ids_count, FFA_NOTIFICATIONS_INFO_GET_MAX_IDS); |
| 741 | EXPECT_EQ(current_state, FULL); |
| 742 | EXPECT_EQ(notifications->global.info_get_retrieved, |
| 743 | FFA_NOTIFICATION_MASK(2)); |
| 744 | |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 745 | got = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 746 | is_from_vm, 0); |
| 747 | EXPECT_EQ(got, FFA_NOTIFICATION_MASK(1) | FFA_NOTIFICATION_MASK(2)); |
| 748 | |
| 749 | vm_unlock(¤t_vm_locked); |
| 750 | } |
| 751 | |
| 752 | TEST_F(vm, vm_notifications_info_get_full_global) |
| 753 | { |
| 754 | struct_vm *current_vm = vm_find_index(0); |
| 755 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 756 | ffa_notifications_bitmap_t got; |
| 757 | struct notifications *notifications; |
| 758 | const bool is_from_vm = false; |
| 759 | /* |
| 760 | * Following set of variables that are also expected to be used when |
| 761 | * handling ffa_notification_info_get. |
| 762 | * For this 'ids_count' has been initialized such that it indicates |
| 763 | * there is no space in the list for a global notification (VM ID only). |
| 764 | */ |
| 765 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 766 | uint32_t ids_count = FFA_NOTIFICATIONS_INFO_GET_MAX_IDS; |
| 767 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 768 | uint32_t lists_count = 10; |
| 769 | enum notifications_info_get_state current_state = INIT; |
| 770 | |
| 771 | CHECK(vm_get_count() >= 1); |
| 772 | |
| 773 | current_vm = vm_find_index(0); |
| 774 | |
| 775 | notifications = ¤t_vm->notifications.from_sp; |
| 776 | |
| 777 | /* Set global notification. */ |
J-Alves | 5a16c96 | 2022-03-25 12:32:51 +0000 | [diff] [blame] | 778 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 779 | FFA_NOTIFICATION_MASK(10), 0, |
| 780 | false); |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 781 | |
| 782 | /* Get notifications info for the given notifications. */ |
| 783 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 784 | &ids_count, lists_sizes, &lists_count, |
| 785 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 786 | ¤t_state); |
| 787 | |
| 788 | /* Expect 'info_get_retrieved' bitmap to be 0. */ |
| 789 | EXPECT_EQ(notifications->global.info_get_retrieved, 0U); |
| 790 | EXPECT_EQ(notifications->global.pending, FFA_NOTIFICATION_MASK(10)); |
| 791 | EXPECT_EQ(ids_count, FFA_NOTIFICATIONS_INFO_GET_MAX_IDS); |
| 792 | EXPECT_EQ(current_state, FULL); |
| 793 | |
J-Alves | 5136dda | 2022-03-25 12:26:38 +0000 | [diff] [blame] | 794 | got = vm_notifications_partition_get_pending(current_vm_locked, |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 795 | is_from_vm, 0); |
J-Alves | 9f74b93 | 2021-10-11 14:20:05 +0100 | [diff] [blame] | 796 | EXPECT_EQ(got, FFA_NOTIFICATION_MASK(10)); |
| 797 | |
J-Alves | 96f6e29 | 2021-06-08 17:32:40 +0100 | [diff] [blame] | 798 | vm_unlock(¤t_vm_locked); |
| 799 | } |
| 800 | |
J-Alves | f31940e | 2022-03-25 17:24:00 +0000 | [diff] [blame] | 801 | TEST_F(vm, vm_notifications_info_get_from_framework) |
| 802 | { |
| 803 | struct vm_locked vm_locked = vm_lock(vm_find_index(0)); |
| 804 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 805 | uint32_t ids_count = 0; |
| 806 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 807 | uint32_t lists_count = 0; |
| 808 | |
| 809 | vm_notifications_framework_set_pending(vm_locked, 0x1U); |
| 810 | |
| 811 | /* Get notifications info for the given notifications. */ |
| 812 | vm_notifications_info_get(vm_locked, ids, &ids_count, lists_sizes, |
| 813 | &lists_count, |
| 814 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS); |
| 815 | |
| 816 | EXPECT_EQ(ids[0], vm_locked.vm->id); |
| 817 | EXPECT_EQ(ids_count, 1); |
| 818 | EXPECT_EQ(lists_sizes[0], 0); |
| 819 | EXPECT_EQ(lists_count, 1); |
| 820 | |
| 821 | EXPECT_EQ(vm_notifications_framework_get_pending(vm_locked), 0x1U); |
| 822 | |
| 823 | vm_unlock(&vm_locked); |
| 824 | } |
| 825 | |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 826 | /** |
| 827 | * Validates simple getting of notifications info for pending IPI. |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 828 | * Also checks that vCPUs with pending IPIs are only reported if the |
| 829 | * vCPU is in the waiting state. |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 830 | */ |
| 831 | TEST_F(vm, vm_notifications_info_get_ipi) |
| 832 | { |
| 833 | /* |
| 834 | * Following set of variables that are also expected to be used when |
| 835 | * handling ffa_notification_info_get. |
| 836 | */ |
| 837 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 838 | uint32_t ids_count = 0; |
| 839 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 840 | uint32_t lists_count = 0; |
| 841 | enum notifications_info_get_state current_state = INIT; |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 842 | struct_vm *current_vm = vm_find_index(4); |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 843 | struct vcpu *target_vcpu = vm_get_vcpu(current_vm, 1); |
| 844 | struct interrupts *interrupts = &target_vcpu->interrupts; |
| 845 | const bool is_from_vm = false; |
| 846 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 847 | |
| 848 | EXPECT_TRUE(current_vm->vcpu_count >= 2); |
| 849 | |
| 850 | vcpu_virt_interrupt_set_pending(interrupts, HF_IPI_INTID); |
| 851 | |
| 852 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 853 | &ids_count, lists_sizes, &lists_count, |
| 854 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 855 | ¤t_state); |
| 856 | |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 857 | EXPECT_EQ(ids_count, 0); |
| 858 | EXPECT_EQ(lists_count, 0); |
| 859 | |
| 860 | target_vcpu->state = VCPU_STATE_WAITING; |
| 861 | |
| 862 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 863 | &ids_count, lists_sizes, &lists_count, |
| 864 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 865 | ¤t_state); |
| 866 | |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 867 | EXPECT_EQ(ids_count, 2); |
| 868 | EXPECT_EQ(lists_count, 1); |
| 869 | EXPECT_EQ(lists_sizes[0], 1); |
| 870 | EXPECT_EQ(ids[0], current_vm->id); |
| 871 | EXPECT_EQ(ids[1], 1); |
| 872 | EXPECT_EQ(target_vcpu->ipi_info_get_retrieved, true); |
| 873 | |
| 874 | /* Check it is not retrieved multiple times. */ |
| 875 | current_state = INIT; |
| 876 | ids[0] = 0; |
| 877 | ids[1] = 0; |
| 878 | ids_count = 0; |
| 879 | lists_sizes[0] = 0; |
| 880 | lists_count = 0; |
| 881 | |
| 882 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 883 | &ids_count, lists_sizes, &lists_count, |
| 884 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 885 | ¤t_state); |
| 886 | EXPECT_EQ(ids_count, 0); |
| 887 | EXPECT_EQ(lists_count, 0); |
| 888 | EXPECT_EQ(lists_sizes[0], 0); |
| 889 | |
| 890 | vm_unlock(¤t_vm_locked); |
| 891 | } |
| 892 | |
| 893 | /** |
| 894 | * Validates simple getting of notifications info for pending with IPI when |
| 895 | * notification for the same vcpu is also pending. |
| 896 | */ |
| 897 | TEST_F(vm, vm_notifications_info_get_ipi_with_per_vcpu) |
| 898 | { |
| 899 | /* |
| 900 | * Following set of variables that are also expected to be used when |
| 901 | * handling ffa_notification_info_get. |
| 902 | */ |
| 903 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 904 | uint32_t ids_count = 0; |
| 905 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 906 | uint32_t lists_count = 0; |
| 907 | enum notifications_info_get_state current_state = INIT; |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 908 | struct_vm *current_vm = vm_find_index(4); |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 909 | struct vcpu *target_vcpu = vm_get_vcpu(current_vm, 1); |
| 910 | struct interrupts *interrupts = &target_vcpu->interrupts; |
| 911 | const bool is_from_vm = false; |
| 912 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 913 | |
| 914 | EXPECT_TRUE(current_vm->vcpu_count >= 2); |
| 915 | |
| 916 | vcpu_virt_interrupt_set_pending(interrupts, HF_IPI_INTID); |
| 917 | |
| 918 | vm_notifications_partition_set_pending(current_vm_locked, is_from_vm, |
| 919 | true, 1, true); |
| 920 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 921 | &ids_count, lists_sizes, &lists_count, |
| 922 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 923 | ¤t_state); |
| 924 | |
| 925 | EXPECT_EQ(ids_count, 2); |
| 926 | EXPECT_EQ(lists_count, 1); |
| 927 | EXPECT_EQ(lists_sizes[0], 1); |
| 928 | EXPECT_EQ(ids[0], current_vm->id); |
| 929 | EXPECT_EQ(ids[1], 1); |
| 930 | EXPECT_EQ(target_vcpu->ipi_info_get_retrieved, true); |
| 931 | |
| 932 | /* Reset the state and values. */ |
| 933 | current_state = INIT; |
| 934 | ids[0] = 0; |
| 935 | ids[1] = 0; |
| 936 | ids_count = 0; |
| 937 | lists_sizes[0] = 0; |
| 938 | lists_count = 0; |
| 939 | |
| 940 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 941 | &ids_count, lists_sizes, &lists_count, |
| 942 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 943 | ¤t_state); |
| 944 | EXPECT_EQ(ids_count, 0); |
| 945 | EXPECT_EQ(lists_count, 0); |
| 946 | EXPECT_EQ(lists_sizes[0], 0); |
| 947 | |
| 948 | vm_unlock(¤t_vm_locked); |
| 949 | } |
| 950 | |
| 951 | /** |
| 952 | * Validate that a mix of a pending IPI and notifcations are correctly |
| 953 | * reported across vcpus. |
| 954 | */ |
| 955 | TEST_F(vm, vm_notifications_info_get_per_vcpu_all_vcpus_and_ipi) |
| 956 | { |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 957 | struct_vm *current_vm = vm_find_index(4); |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 958 | ffa_vcpu_count_t vcpu_count = current_vm->vcpu_count; |
| 959 | CHECK(vcpu_count > 1); |
| 960 | |
| 961 | struct vm_locked current_vm_locked = vm_lock(current_vm); |
| 962 | |
| 963 | /* |
| 964 | * Following set of variables that are also expected to be used when |
| 965 | * handling ffa_notification_info_get. |
| 966 | */ |
| 967 | const bool is_from_vm = false; |
| 968 | uint16_t ids[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 969 | uint32_t ids_count = 0; |
| 970 | uint32_t lists_sizes[FFA_NOTIFICATIONS_INFO_GET_MAX_IDS] = {0}; |
| 971 | uint32_t lists_count = 0; |
| 972 | enum notifications_info_get_state current_state = INIT; |
| 973 | struct vcpu *target_vcpu = vm_get_vcpu(current_vm, 0); |
| 974 | struct interrupts *interrupts = &target_vcpu->interrupts; |
| 975 | |
Daniel Boulby | 6c2aa33 | 2024-11-13 13:54:08 +0000 | [diff] [blame] | 976 | target_vcpu->state = VCPU_STATE_WAITING; |
| 977 | |
Daniel Boulby | 8be2651 | 2024-09-03 19:41:11 +0100 | [diff] [blame] | 978 | vcpu_virt_interrupt_set_pending(interrupts, HF_IPI_INTID); |
| 979 | |
| 980 | for (unsigned int i = 1; i < vcpu_count; i++) { |
| 981 | vm_notifications_partition_set_pending( |
| 982 | current_vm_locked, is_from_vm, FFA_NOTIFICATION_MASK(i), |
| 983 | i, true); |
| 984 | } |
| 985 | |
| 986 | vm_notifications_info_get_pending(current_vm_locked, is_from_vm, ids, |
| 987 | &ids_count, lists_sizes, &lists_count, |
| 988 | FFA_NOTIFICATIONS_INFO_GET_MAX_IDS, |
| 989 | ¤t_state); |
| 990 | |
| 991 | /* |
| 992 | * This test has been conceived for the expected MAX_CPUS 4. |
| 993 | * All VCPUs have notifications of the same VM, to be broken down in 2 |
| 994 | * lists with 3 VCPU IDs, and 1 VCPU ID respectively. |
| 995 | * The list of IDs should look like: {<vm_id>, 0, 1, 2, <vm_id>, 3}. |
| 996 | */ |
| 997 | EXPECT_EQ(ids_count, 6U); |
| 998 | EXPECT_EQ(lists_count, 2U); |
| 999 | EXPECT_EQ(lists_sizes[0], 3); |
| 1000 | EXPECT_EQ(lists_sizes[1], 1); |
| 1001 | EXPECT_EQ(ids[0], current_vm->id); |
| 1002 | EXPECT_EQ(ids[1], 0); |
| 1003 | EXPECT_EQ(ids[2], 1); |
| 1004 | EXPECT_EQ(ids[3], 2); |
| 1005 | EXPECT_EQ(ids[4], current_vm->id); |
| 1006 | EXPECT_EQ(ids[5], 3); |
| 1007 | |
| 1008 | vm_unlock(¤t_vm_locked); |
| 1009 | } |
Andrew Scull | 3c25745 | 2019-11-26 13:32:50 +0000 | [diff] [blame] | 1010 | } /* namespace */ |