1 // SPDX-License-Identifier: GPL-2.0
3 * vgic init sequence tests
5 * Copyright (C) 2020, Red Hat, Inc.
8 #include <linux/kernel.h>
9 #include <sys/syscall.h>
11 #include <asm/kvm_para.h>
13 #include "test_util.h"
15 #include "processor.h"
19 #define REDIST_REGION_ATTR_ADDR(count, base, flags, index) (((uint64_t)(count) << 52) | \
20 ((uint64_t)((base) >> 16) << 16) | ((uint64_t)(flags) << 12) | index)
21 #define REG_OFFSET(vcpu, offset) (((uint64_t)vcpu << 32) | offset)
23 #define GICR_TYPER 0x8
30 static int max_ipa_bits;
32 /* helper to access a redistributor register */
33 static int access_redist_reg(int gicv3_fd, int vcpu, int offset,
34 uint32_t *val, bool write)
36 uint64_t attr = REG_OFFSET(vcpu, offset);
38 return _kvm_device_access(gicv3_fd, KVM_DEV_ARM_VGIC_GRP_REDIST_REGS,
42 /* dummy guest code */
43 static void guest_code(void)
51 /* we don't want to assert on run execution, hence that helper */
52 static int run_vcpu(struct kvm_vm *vm, uint32_t vcpuid)
55 int ret = _vcpu_ioctl(vm, vcpuid, KVM_RUN, NULL);
61 static struct vm_gic vm_gic_create(void)
65 v.vm = vm_create_default_with_vcpus(NR_VCPUS, 0, 0, guest_code, NULL);
66 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
71 static void vm_gic_destroy(struct vm_gic *v)
78 * Helper routine that performs KVM device tests in general and
79 * especially ARM_VGIC_V3 ones. Eventually the ARM_VGIC_V3
80 * device gets created, a legacy RDIST region is set at @0x0
81 * and a DIST region is set @0x60000
83 static void subtest_dist_rdist(struct vm_gic *v)
88 /* Check existing group/attributes */
89 kvm_device_check_attr(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
90 KVM_VGIC_V3_ADDR_TYPE_DIST);
92 kvm_device_check_attr(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
93 KVM_VGIC_V3_ADDR_TYPE_REDIST);
95 /* check non existing attribute */
96 ret = _kvm_device_check_attr(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR, 0);
97 TEST_ASSERT(ret && errno == ENXIO, "attribute not supported");
99 /* misaligned DIST and REDIST address settings */
101 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
102 KVM_VGIC_V3_ADDR_TYPE_DIST, &addr, true);
103 TEST_ASSERT(ret && errno == EINVAL, "GICv3 dist base not 64kB aligned");
105 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
106 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
107 TEST_ASSERT(ret && errno == EINVAL, "GICv3 redist base not 64kB aligned");
109 /* out of range address */
111 addr = 1ULL << max_ipa_bits;
112 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
113 KVM_VGIC_V3_ADDR_TYPE_DIST, &addr, true);
114 TEST_ASSERT(ret && errno == E2BIG, "dist address beyond IPA limit");
116 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
117 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
118 TEST_ASSERT(ret && errno == E2BIG, "redist address beyond IPA limit");
121 /* set REDIST base address @0x0*/
123 kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
124 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
126 /* Attempt to create a second legacy redistributor region */
128 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
129 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
130 TEST_ASSERT(ret && errno == EEXIST, "GICv3 redist base set again");
132 /* Attempt to mix legacy and new redistributor regions */
133 addr = REDIST_REGION_ATTR_ADDR(NR_VCPUS, 0x100000, 0, 0);
134 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
135 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
136 TEST_ASSERT(ret && errno == EINVAL, "attempt to mix GICv3 REDIST and REDIST_REGION");
139 * Set overlapping DIST / REDIST, cannot be detected here. Will be detected
140 * on first vcpu run instead.
142 addr = 3 * 2 * 0x10000;
143 kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR, KVM_VGIC_V3_ADDR_TYPE_DIST,
147 /* Test the new REDIST region API */
148 static void subtest_redist_regions(struct vm_gic *v)
150 uint64_t addr, expected_addr;
153 ret = kvm_device_check_attr(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
154 KVM_VGIC_V3_ADDR_TYPE_REDIST);
155 TEST_ASSERT(!ret, "Multiple redist regions advertised");
157 addr = REDIST_REGION_ATTR_ADDR(NR_VCPUS, 0x100000, 2, 0);
158 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
159 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
160 TEST_ASSERT(ret && errno == EINVAL, "redist region attr value with flags != 0");
162 addr = REDIST_REGION_ATTR_ADDR(0, 0x100000, 0, 0);
163 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
164 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
165 TEST_ASSERT(ret && errno == EINVAL, "redist region attr value with count== 0");
167 addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 1);
168 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
169 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
170 TEST_ASSERT(ret && errno == EINVAL,
171 "attempt to register the first rdist region with index != 0");
173 addr = REDIST_REGION_ATTR_ADDR(2, 0x201000, 0, 1);
174 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
175 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
176 TEST_ASSERT(ret && errno == EINVAL, "rdist region with misaligned address");
178 addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 0);
179 kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
180 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
182 addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 1);
183 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
184 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
185 TEST_ASSERT(ret && errno == EINVAL, "register an rdist region with already used index");
187 addr = REDIST_REGION_ATTR_ADDR(1, 0x210000, 0, 2);
188 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
189 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
190 TEST_ASSERT(ret && errno == EINVAL,
191 "register an rdist region overlapping with another one");
193 addr = REDIST_REGION_ATTR_ADDR(1, 0x240000, 0, 2);
194 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
195 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
196 TEST_ASSERT(ret && errno == EINVAL, "register redist region with index not +1");
198 addr = REDIST_REGION_ATTR_ADDR(1, 0x240000, 0, 1);
199 kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
200 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
202 addr = REDIST_REGION_ATTR_ADDR(1, 1ULL << max_ipa_bits, 0, 2);
203 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
204 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
205 TEST_ASSERT(ret && errno == E2BIG,
206 "register redist region with base address beyond IPA range");
209 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
210 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
211 TEST_ASSERT(ret && errno == EINVAL,
212 "Mix KVM_VGIC_V3_ADDR_TYPE_REDIST and REDIST_REGION");
215 * Now there are 2 redist regions:
216 * region 0 @ 0x200000 2 redists
217 * region 1 @ 0x240000 1 redist
218 * Attempt to read their characteristics
221 addr = REDIST_REGION_ATTR_ADDR(0, 0, 0, 0);
222 expected_addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 0);
223 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
224 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, false);
225 TEST_ASSERT(!ret && addr == expected_addr, "read characteristics of region #0");
227 addr = REDIST_REGION_ATTR_ADDR(0, 0, 0, 1);
228 expected_addr = REDIST_REGION_ATTR_ADDR(1, 0x240000, 0, 1);
229 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
230 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, false);
231 TEST_ASSERT(!ret && addr == expected_addr, "read characteristics of region #1");
233 addr = REDIST_REGION_ATTR_ADDR(0, 0, 0, 2);
234 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
235 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, false);
236 TEST_ASSERT(ret && errno == ENOENT, "read characteristics of non existing region");
239 kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
240 KVM_VGIC_V3_ADDR_TYPE_DIST, &addr, true);
242 addr = REDIST_REGION_ATTR_ADDR(1, 0x260000, 0, 2);
243 ret = _kvm_device_access(v->gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
244 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
245 TEST_ASSERT(ret && errno == EINVAL, "register redist region colliding with dist");
249 * VGIC KVM device is created and initialized before the secondary CPUs
252 static void test_vgic_then_vcpus(void)
257 v.vm = vm_create_default(0, 0, guest_code);
258 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
260 subtest_dist_rdist(&v);
262 /* Add the rest of the VCPUs */
263 for (i = 1; i < NR_VCPUS; ++i)
264 vm_vcpu_add_default(v.vm, i, guest_code);
266 ret = run_vcpu(v.vm, 3);
267 TEST_ASSERT(ret == -EINVAL, "dist/rdist overlap detected on 1st vcpu run");
272 /* All the VCPUs are created before the VGIC KVM device gets initialized */
273 static void test_vcpus_then_vgic(void)
280 subtest_dist_rdist(&v);
282 ret = run_vcpu(v.vm, 3);
283 TEST_ASSERT(ret == -EINVAL, "dist/rdist overlap detected on 1st vcpu run");
288 static void test_new_redist_regions(void)
296 subtest_redist_regions(&v);
297 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
298 KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true);
300 ret = run_vcpu(v.vm, 3);
301 TEST_ASSERT(ret == -ENXIO, "running without sufficient number of rdists");
307 subtest_redist_regions(&v);
309 addr = REDIST_REGION_ATTR_ADDR(1, 0x280000, 0, 2);
310 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
311 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
313 ret = run_vcpu(v.vm, 3);
314 TEST_ASSERT(ret == -EBUSY, "running without vgic explicit init");
321 subtest_redist_regions(&v);
323 _kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
324 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, dummy, true);
325 TEST_ASSERT(ret && errno == EFAULT,
326 "register a third region allowing to cover the 4 vcpus");
328 addr = REDIST_REGION_ATTR_ADDR(1, 0x280000, 0, 2);
329 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
330 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
332 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
333 KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true);
335 ret = run_vcpu(v.vm, 3);
336 TEST_ASSERT(!ret, "vcpu run");
341 static void test_typer_accesses(void)
348 v.vm = vm_create_default(0, 0, guest_code);
350 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
352 vm_vcpu_add_default(v.vm, 3, guest_code);
354 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
355 TEST_ASSERT(ret && errno == EINVAL, "attempting to read GICR_TYPER of non created vcpu");
357 vm_vcpu_add_default(v.vm, 1, guest_code);
359 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
360 TEST_ASSERT(ret && errno == EBUSY, "read GICR_TYPER before GIC initialized");
362 vm_vcpu_add_default(v.vm, 2, guest_code);
364 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
365 KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true);
367 for (i = 0; i < NR_VCPUS ; i++) {
368 ret = access_redist_reg(v.gic_fd, 0, GICR_TYPER, &val, false);
369 TEST_ASSERT(!ret && !val, "read GICR_TYPER before rdist region setting");
372 addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 0);
373 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
374 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
376 /* The 2 first rdists should be put there (vcpu 0 and 3) */
377 ret = access_redist_reg(v.gic_fd, 0, GICR_TYPER, &val, false);
378 TEST_ASSERT(!ret && !val, "read typer of rdist #0");
380 ret = access_redist_reg(v.gic_fd, 3, GICR_TYPER, &val, false);
381 TEST_ASSERT(!ret && val == 0x310, "read typer of rdist #1");
383 addr = REDIST_REGION_ATTR_ADDR(10, 0x100000, 0, 1);
384 ret = _kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
385 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
386 TEST_ASSERT(ret && errno == EINVAL, "collision with previous rdist region");
388 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
389 TEST_ASSERT(!ret && val == 0x100,
390 "no redist region attached to vcpu #1 yet, last cannot be returned");
392 ret = access_redist_reg(v.gic_fd, 2, GICR_TYPER, &val, false);
393 TEST_ASSERT(!ret && val == 0x200,
394 "no redist region attached to vcpu #2, last cannot be returned");
396 addr = REDIST_REGION_ATTR_ADDR(10, 0x20000, 0, 1);
397 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
398 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
400 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
401 TEST_ASSERT(!ret && val == 0x100, "read typer of rdist #1");
403 ret = access_redist_reg(v.gic_fd, 2, GICR_TYPER, &val, false);
404 TEST_ASSERT(!ret && val == 0x210,
405 "read typer of rdist #1, last properly returned");
411 * Test GICR_TYPER last bit with new redist regions
412 * rdist regions #1 and #2 are contiguous
413 * rdist region #0 @0x100000 2 rdist capacity
414 * rdists: 0, 3 (Last)
415 * rdist region #1 @0x240000 2 rdist capacity
416 * rdists: 5, 4 (Last)
417 * rdist region #2 @0x200000 2 rdist capacity
420 static void test_last_bit_redist_regions(void)
422 uint32_t vcpuids[] = { 0, 3, 5, 4, 1, 2 };
428 v.vm = vm_create_default_with_vcpus(6, 0, 0, guest_code, vcpuids);
430 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
432 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
433 KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true);
435 addr = REDIST_REGION_ATTR_ADDR(2, 0x100000, 0, 0);
436 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
437 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
439 addr = REDIST_REGION_ATTR_ADDR(2, 0x240000, 0, 1);
440 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
441 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
443 addr = REDIST_REGION_ATTR_ADDR(2, 0x200000, 0, 2);
444 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
445 KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION, &addr, true);
447 ret = access_redist_reg(v.gic_fd, 0, GICR_TYPER, &val, false);
448 TEST_ASSERT(!ret && val == 0x000, "read typer of rdist #0");
450 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
451 TEST_ASSERT(!ret && val == 0x100, "read typer of rdist #1");
453 ret = access_redist_reg(v.gic_fd, 2, GICR_TYPER, &val, false);
454 TEST_ASSERT(!ret && val == 0x200, "read typer of rdist #2");
456 ret = access_redist_reg(v.gic_fd, 3, GICR_TYPER, &val, false);
457 TEST_ASSERT(!ret && val == 0x310, "read typer of rdist #3");
459 ret = access_redist_reg(v.gic_fd, 5, GICR_TYPER, &val, false);
460 TEST_ASSERT(!ret && val == 0x500, "read typer of rdist #5");
462 ret = access_redist_reg(v.gic_fd, 4, GICR_TYPER, &val, false);
463 TEST_ASSERT(!ret && val == 0x410, "read typer of rdist #4");
468 /* Test last bit with legacy region */
469 static void test_last_bit_single_rdist(void)
471 uint32_t vcpuids[] = { 0, 3, 5, 4, 1, 2 };
477 v.vm = vm_create_default_with_vcpus(6, 0, 0, guest_code, vcpuids);
479 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
481 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
482 KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true);
485 kvm_device_access(v.gic_fd, KVM_DEV_ARM_VGIC_GRP_ADDR,
486 KVM_VGIC_V3_ADDR_TYPE_REDIST, &addr, true);
488 ret = access_redist_reg(v.gic_fd, 0, GICR_TYPER, &val, false);
489 TEST_ASSERT(!ret && val == 0x000, "read typer of rdist #0");
491 ret = access_redist_reg(v.gic_fd, 3, GICR_TYPER, &val, false);
492 TEST_ASSERT(!ret && val == 0x300, "read typer of rdist #1");
494 ret = access_redist_reg(v.gic_fd, 5, GICR_TYPER, &val, false);
495 TEST_ASSERT(!ret && val == 0x500, "read typer of rdist #2");
497 ret = access_redist_reg(v.gic_fd, 1, GICR_TYPER, &val, false);
498 TEST_ASSERT(!ret && val == 0x100, "read typer of rdist #3");
500 ret = access_redist_reg(v.gic_fd, 2, GICR_TYPER, &val, false);
501 TEST_ASSERT(!ret && val == 0x210, "read typer of rdist #3");
506 void test_kvm_device(void)
511 v.vm = vm_create_default_with_vcpus(NR_VCPUS, 0, 0, guest_code, NULL);
513 /* try to create a non existing KVM device */
514 ret = _kvm_create_device(v.vm, 0, true, &fd);
515 TEST_ASSERT(ret && errno == ENODEV, "unsupported device");
517 /* trial mode with VGIC_V3 device */
518 ret = _kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, true, &fd);
520 print_skip("GICv3 not supported");
523 v.gic_fd = kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false);
525 ret = _kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, false, &fd);
526 TEST_ASSERT(ret && errno == EEXIST, "create GICv3 device twice");
528 kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V3, true);
530 if (!_kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V2, true, &fd)) {
531 ret = _kvm_create_device(v.vm, KVM_DEV_TYPE_ARM_VGIC_V2, false, &fd);
532 TEST_ASSERT(ret && errno == EINVAL, "create GICv2 while v3 exists");
538 int main(int ac, char **av)
540 max_ipa_bits = kvm_check_cap(KVM_CAP_ARM_VM_IPA_SIZE);
543 test_vcpus_then_vgic();
544 test_vgic_then_vcpus();
545 test_new_redist_regions();
546 test_typer_accesses();
547 test_last_bit_redist_regions();
548 test_last_bit_single_rdist();