diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 73af536772fc20..4a180821442329 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -326,6 +326,14 @@ struct apple_dart { * rather than the DART's. */ u64 locked_window[DART_MAX_STREAMS]; + /* + * First error of a TLB invalidate that failed while retiring a locked + * root, per stream. The hardware may still cache translations through + * the retired page tables, so apple_dart_domain_free() keeps the page + * tables of every domain on such a stream. It is never cleared: only + * the hardware could show that the TLB no longer holds those entries. + */ + int locked_retire_err[DART_MAX_STREAMS]; }; /* @@ -668,6 +676,24 @@ static bool apple_dart_fw_mapping_matches(phys_addr_t phys, int prot, return phys == expected && (prot & mask) == (required & mask); } +/* + * Whether the firmware leaf behind root @slot of a three-level stream already + * translates the page at @addr to @paddr with the protection Linux asks for. + */ +static bool apple_dart_fw_page_matches(const struct apple_dart *dart, + const struct apple_dart_fw_root *fw, + u64 slot, u64 addr, phys_addr_t paddr, + int prot) +{ + u64 leaf = (addr / dart->pgsize) % (dart->pgsize / sizeof(u64)); + phys_addr_t phys; + int fw_prot; + + return apple_dart_fw_leaf_decode(READ_ONCE(fw->leaf[slot][leaf]), addr, + &phys, &fw_prot) && + apple_dart_fw_mapping_matches(phys, fw_prot, paddr, prot); +} + /* * A root slot firmware already uses can still back Linux mappings when the * firmware's leaf table translates every page Linux mapped there to the same @@ -912,28 +938,39 @@ apple_dart_hw_map_locked_ttbr(struct apple_dart_stream_map *stream_map, u8 idx) return 0; } +/* + * Retire the locked roots @idx of @stream_map's streams. Returns the first + * error of the TLB invalidate that retiring needs, which is also remembered + * per stream for apple_dart_domain_free(): a consumer release or an attach + * rollback can retire the root before the domain is freed. + */ static int apple_dart_hw_unmap_locked_ttbr(struct apple_dart_stream_map *stream_map, u8 idx) { struct apple_dart *dart = stream_map->dart; - int sid; + int sid, ret = 0; for_each_set_bit(sid, stream_map->sidmap, dart->num_streams) { u64 *live = dart->locked_ttbr[sid][idx]; u64 *owned = dart->locked_owned[sid][idx]; struct apple_dart_fw_root *fw; unsigned long flags; + int err = 0; if (!live) continue; apple_dart_retire_root(live, owned, dart->pgsize / sizeof(*live)); - if (dart->fw_mirror && dart->version >= 0x0202 && !idx) { + if ((dart->fw_mirror || dart->fw_handoff) && + dart->version >= 0x0202 && !idx) { struct apple_dart_stream_map stream = { .dart = dart }; __set_bit(sid, stream.sidmap); - (void)apple_dart_fw_invalidate(&stream, 0, U64_MAX); + err = apple_dart_fw_invalidate(&stream, 0, U64_MAX); + ret = ret ?: err; } spin_lock_irqsave(&dart->lock, flags); + if (err && !dart->locked_retire_err[sid]) + dart->locked_retire_err[sid] = err; fw = dart->locked_fw[sid][idx]; dart->locked_fw[sid][idx] = NULL; dart->locked_ttbr[sid][idx] = NULL; @@ -943,7 +980,24 @@ apple_dart_hw_unmap_locked_ttbr(struct apple_dart_stream_map *stream_map, u8 idx devm_kfree(dart->dev, owned); dart->locked_owned[sid][idx] = NULL; } - return 0; + return ret; +} + +/* The remembered retire-time invalidate error of @stream_map's streams, or 0. */ +static int apple_dart_retire_error(struct apple_dart_stream_map *stream_map) +{ + struct apple_dart *dart = stream_map->dart; + unsigned long flags; + int sid, ret = 0; + + spin_lock_irqsave(&dart->lock, flags); + for_each_set_bit(sid, stream_map->sidmap, dart->num_streams) { + ret = dart->locked_retire_err[sid]; + if (ret) + break; + } + spin_unlock_irqrestore(&dart->lock, flags); + return ret; } static int @@ -1240,7 +1294,9 @@ apple_dart_t8020_hw_invalidate_tlb(struct apple_dart_stream_map *stream_map) static int apple_dart_t8110_hw_invalidate_tlb(struct apple_dart_stream_map *stream_map) { - if (stream_map->dart->fw_mirror && stream_map->dart->version >= 0x0202) + /* Keep out of firmware-held slots; see apple_dart_fw_invalidate(). */ + if ((stream_map->dart->fw_mirror || stream_map->dart->fw_handoff) && + stream_map->dart->version >= 0x0202) return apple_dart_fw_invalidate(stream_map, 0, U64_MAX); return apple_dart_t8110_hw_tlb_command_range( stream_map, DART_T8110_TLB_CMD_OP_FLUSH_SID, false, 0, 0); @@ -1535,6 +1591,15 @@ static bool apple_dart_domain_uses_fw(struct apple_dart_domain *domain, int i, /* * Hardware continues to use every firmware-owned slot. Its entire IOVA * span is excluded from Linux allocation, including currently unmapped holes. + * + * Linux may still repeat a page the firmware leaf already translates, with + * the same physical address and protection. That happens when one domain + * spans several DARTs and only some of them inherited a reserved region: + * the J700 display subsystem uses disp0 and dispext0, and only disp0 scans + * out the boot framebuffer. apple_dart_inherited_phys() cannot report the + * region as mapped for the whole domain, so the core maps it, and the copy + * must be accepted on disp0 while dispext0 gets it in a vacant slot. + * apple_dart_publish_root() never writes the firmware slot itself. */ static int apple_dart_check_fw_map(struct apple_dart_domain *domain, u64 dva, phys_addr_t paddr, size_t size, int prot) @@ -1556,6 +1621,7 @@ static int apple_dart_check_fw_map(struct apple_dart_domain *domain, u64 dva, u64 addr = dva + off; for (sid = 0; sid < dart->num_streams; sid++) { + const struct apple_dart_fw_root *fw; bool four; u64 idx, slot; const u64 *live, *owned; @@ -1563,12 +1629,6 @@ static int apple_dart_check_fw_map(struct apple_dart_domain *domain, u64 dva, if (!apple_dart_domain_uses_fw(domain, i, map, sid)) continue; if (!dart->fw_handoff) { - const struct apple_dart_fw_root *fw; - phys_addr_t phys; - u64 pte; - int fw_prot; - u64 leaf = (addr >> pgshift) & (entries - 1); - slot = (addr >> (pgshift + bits)) & (entries - 1); idx = addr >> (pgshift + 2 * bits); if (idx >= DART_MAX_TTBR) @@ -1577,10 +1637,8 @@ static int apple_dart_check_fw_map(struct apple_dart_domain *domain, u64 dva, live = dart->locked_ttbr[sid][idx]; if (!live || !apple_dart_fw_slot_owned(fw, live, slot)) continue; - pte = READ_ONCE(fw->leaf[slot][leaf]); - if (!apple_dart_fw_leaf_decode(pte, addr, &phys, &fw_prot) || - !apple_dart_fw_mapping_matches(phys, fw_prot, - paddr + off, prot)) { + if (!apple_dart_fw_page_matches(dart, fw, slot, addr, + paddr + off, prot)) { ret = -EBUSY; goto unlock; } @@ -1595,8 +1653,17 @@ static int apple_dart_check_fw_map(struct apple_dart_domain *domain, u64 dva, continue; live = dart->locked_ttbr[sid][idx]; owned = dart->locked_owned[sid][idx]; - /* All pages of an inherited slot remain firmware's. */ - if (live && apple_dart_fw_slot_foreign(live, owned, slot)) { + if (!live || !apple_dart_fw_slot_foreign(live, owned, slot)) + continue; + /* + * All pages of an inherited slot remain firmware's; + * only a page its firmware leaf already maps the + * same way may be repeated. + */ + fw = dart->locked_fw[sid][idx]; + if (four || !apple_dart_fw_slot_owned(fw, live, slot) || + !apple_dart_fw_page_matches(dart, fw, slot, addr, + paddr + off, prot)) { ret = -EBUSY; goto unlock; } @@ -2131,7 +2198,7 @@ static void apple_dart_domain_free(struct iommu_domain *domain) struct apple_dart_domain *dart_domain = to_dart_domain(domain); struct apple_dart_atomic_stream_map *map; struct apple_dart_stream_map stream; - int i, j, idx; + int i, j, idx, ret; for_each_stream_map(i, dart_domain, map) { if (!map->dart->locked) @@ -2147,14 +2214,22 @@ static void apple_dart_domain_free(struct iommu_domain *domain) "retaining page tables after power failure: %d\n", j); return; } - for (idx = 0; idx < stream.dart->hw->ttbr_count; idx++) - apple_dart_hw_unmap_locked_ttbr(&stream, idx); + ret = 0; + for (idx = 0; idx < stream.dart->hw->ttbr_count; idx++) { + j = apple_dart_hw_unmap_locked_ttbr(&stream, idx); + ret = ret ?: j; + } j = stream.dart->hw->invalidate_tlb(&stream); + ret = ret ?: j; pm_runtime_put(stream.dart->dev); - /* Do not free page tables that hardware may still cache. */ - if (j) { + /* + * Do not free page tables that hardware may still cache, also + * when a consumer release or an attach rollback retired the root. + */ + ret = ret ?: apple_dart_retire_error(&stream); + if (ret) { dev_err_ratelimited(stream.dart->dev, - "retaining page tables after TLB invalidation failure: %d\n", j); + "retaining page tables after TLB invalidation failure: %d\n", ret); return; } } diff --git a/tools/asahi/apple-dart-fw-tests.py b/tools/asahi/apple-dart-fw-tests.py index f54dff336a0562..99e54a7dd33d4b 100644 --- a/tools/asahi/apple-dart-fw-tests.py +++ b/tools/asahi/apple-dart-fw-tests.py @@ -4,8 +4,8 @@ from pathlib import Path import argparse, hashlib, json, re, subprocess ROOT=Path(__file__).resolve().parents[2] -NAMES=('apple_dart_fw_handoff_enabled','apple_dart_pte_to_paddr','apple_dart_fw_table_ram','apple_dart_fw_table_decode','apple_dart_fw_slot_owned','apple_dart_fw_leaf_decode','apple_dart_fw_mapping_matches','apple_dart_fw_slot_mirrors','apple_dart_publish_root','apple_dart_retire_root','apple_dart_free_fw_root','apple_dart_snapshot_fw_root','apple_dart_fw_slot_foreign','apple_dart_domain_uses_fw','apple_dart_check_fw_map','apple_dart_inherited_phys','apple_dart_fw_slot_range','apple_dart_get_fw_resv_regions','apple_dart_fw_invalidate') -CASES=("legacy-map-match","legacy-map-mismatch","legacy-lookup","legacy-snapshot",'mirror','changed-leaf','wrong-permission','wrong-physical','malformed-leaf','vacant','changed-owner','retire','reserved-ram','unreserved','mmio','misalignment','address-width','root-encoding','leaf-as-table','snapshot','snapshot-malformed','snapshot-unreserved','snapshot-root-change','snapshot-map-failure','snapshot-allocation-failure','range-three','range-offset','range-width','range-overflow','range-underflow','range-four','range-four-last','map-firmware','map-hole','map-host','map-owned','map-unmatched','map-attached','lookup-inherited','lookup-changed-leaf','lookup-changed-root','lookup-unmatched','reserve-firmware','reserve-teardown','reserve-unmatched','reserve-owned','invalidate-three','invalidate-four','invalidate-changed-root','invalidate-error','core-inherited','core-hole','core-changed-leaf','snapshot-unmatched','snapshot-four','range-four-width','range-three-last','handoff-matched','handoff-missing','handoff-duplicate','handoff-zero','handoff-unlocked','handoff-other-soc') +NAMES=('apple_dart_fw_handoff_enabled','apple_dart_pte_to_paddr','apple_dart_fw_table_ram','apple_dart_fw_table_decode','apple_dart_fw_slot_owned','apple_dart_fw_leaf_decode','apple_dart_fw_mapping_matches','apple_dart_fw_page_matches','apple_dart_fw_slot_mirrors','apple_dart_publish_root','apple_dart_retire_root','apple_dart_free_fw_root','apple_dart_snapshot_fw_root','apple_dart_fw_slot_foreign','apple_dart_domain_uses_fw','apple_dart_check_fw_map','apple_dart_inherited_phys','apple_dart_fw_slot_range','apple_dart_get_fw_resv_regions','apple_dart_fw_invalidate','apple_dart_hw_unmap_locked_ttbr','apple_dart_retire_error','apple_dart_t8110_hw_invalidate_tlb','apple_dart_release_device','apple_dart_domain_free') +CASES=("legacy-map-match","legacy-map-mismatch","legacy-lookup","legacy-snapshot",'mirror','changed-leaf','wrong-permission','wrong-physical','malformed-leaf','vacant','changed-owner','retire','reserved-ram','unreserved','mmio','misalignment','address-width','root-encoding','leaf-as-table','snapshot','snapshot-malformed','snapshot-unreserved','snapshot-root-change','snapshot-map-failure','snapshot-allocation-failure','range-three','range-offset','range-width','range-overflow','range-underflow','range-four','range-four-last','map-firmware','map-hole','map-host','map-owned','map-unmatched','map-attached','map-wrong-physical','map-wrong-permission','map-changed-root','map-four','lookup-inherited','lookup-changed-leaf','lookup-changed-root','lookup-unmatched','reserve-firmware','reserve-teardown','reserve-unmatched','reserve-owned','invalidate-three','invalidate-four','invalidate-changed-root','invalidate-error','core-inherited','core-hole','core-changed-leaf','core-second-dart','snapshot-unmatched','snapshot-four','range-four-width','range-three-last','handoff-matched','handoff-missing','handoff-duplicate','handoff-zero','handoff-unlocked','handoff-other-soc','retire-free','retire-free-timeout','retire-release','retire-release-timeout','retire-rollback-timeout') def function(s,name): match=re.search(r'^static[^;{}]*\b'+re.escape(name)+r'\([^;{}]*\)\s*\{',s,re.M) if not match:return None diff --git a/tools/asahi/apple-dart-fw/fixture.c b/tools/asahi/apple-dart-fw/fixture.c index cd3ade12ae769d..65727266dc2ccd 100644 --- a/tools/asahi/apple-dart-fw/fixture.c +++ b/tools/asahi/apple-dart-fw/fixture.c @@ -6,7 +6,7 @@ #include #include #include -typedef uint32_t u32;typedef uint64_t u64;typedef uint64_t phys_addr_t;typedef uint64_t dma_addr_t; +typedef uint8_t u8;typedef uint32_t u32;typedef uint64_t u64;typedef uint64_t phys_addr_t;typedef uint64_t dma_addr_t; #define BIT_ULL(n) (1ULL<<(n)) #define GENMASK_ULL(h,l) ((~0ULL>>(63-(h)))&(~0ULL<<(l))) #define SZ_16K 16384 @@ -28,7 +28,8 @@ typedef uint32_t u32;typedef uint64_t u64;typedef uint64_t phys_addr_t;typedef u #define ERR_PTR(x) ((void*)(intptr_t)(x)) #define IS_ERR(x) ((uintptr_t)(x)>=(uintptr_t)-4095) #define PTR_ERR(x) ((intptr_t)(x)) -struct apple_dart_hw {int fmt;unsigned tcr_4level,ttbr_count;}; +struct apple_dart_stream_map;struct iommu_domain; +struct apple_dart_hw {int fmt;unsigned tcr_4level,ttbr_count;int(*invalidate_tlb)(struct apple_dart_stream_map*);}; #define DART_MAX_TTBR 4 #define DART_MAX_ROOT_ENTRIES 2048 #define U64_MAX UINT64_MAX @@ -49,10 +50,10 @@ static unsigned lock_depth; static size_t find_next_bit(unsigned long*p,size_t n,size_t a){for(;astream_maps[i])->dart;(i)++) #define DART_T8110_TLB_CMD_OP_FLUSH_SID 1 @@ -87,6 +88,16 @@ static void memunmap(void*p){assert(p==firmware_leaf);unmap_calls++;} static void*phys_to_virt(u64 phys){assert(phys==0x4000);return ours_leaf;} static u64 compare(u64*p,u64 old,u64 next){u64 before=*p;if(before==old)*p=next;return before;} #define cmpxchg(p,o,n) compare(p,o,n) +#define BITS_TO_LONGS(n) (((n)+63)/64) +#define bitmap_empty(p,n) (!((p)[0]&((n)>=64?~0UL:(1UL<<(n))-1))) +#define devm_memunmap(d,p) ((void)(p)) +#define devm_kfree(d,p) ((void)(p)) +#define to_dart_domain(d) ((struct apple_dart_domain*)(void*)(d)) +static int pm_gets,pm_puts,errors_logged,pgtable_frees; +static int pm_runtime_resume_and_get(struct device*d){pm_gets++;return 0;} +static void pm_runtime_put(struct device*d){pm_puts++;} +#define dev_err_ratelimited(d,...) (errors_logged++,fprintf(stderr,__VA_ARGS__)) +static void free_io_pgtable_ops(void*ops){assert(ops);pgtable_frees++;} /* PRODUCTION */ #define IOMMU_RESV_DIRECT 1 #define IOMMU_RESV_DIRECT_RELAXABLE 2 @@ -140,9 +151,16 @@ int main(int argc,char**argv){ regions[1]=(struct iommu_resv_region){.start=0x8000,.dva=0,.length=SZ_16K,.type=IOMMU_RESV_TRANSLATED};region_count=2; if(!strcmp(c,"core-hole"))firmware_leaf[0]=0; if(!strcmp(c,"core-changed-leaf"))firmware_leaf[0]=leaf(0xc000); + /* A second DART of the domain whose root slot is vacant cannot inherit + * the region, so the core maps it and the first DART accepts the copy. */ + static u64 vacant_root[2048],vacant_shadow[2048];struct apple_dart d2=d; + if(!strcmp(c,"core-second-dart")){ + d2.locked_ttbr[0][0]=vacant_root;d2.locked_owned[0][0]=vacant_shadow;d2.locked_fw[0][0]=NULL; + domain.stream_maps[1].dart=&d2;domain.fw_sidmap[1][0]=1;regions[1].prot=IOMMU_READ|IOMMU_WRITE|IOMMU_CACHE; + } int result=iommu_create_device_fw_mappings(&io_domain,&dev); assert(io.require_translated&&result==(!strcmp(c,"core-hole")?-EBUSY:0)); - assert(core_maps==(!strcmp(c,"core-hole")?1:0)); + assert(core_maps==(!strcmp(c,"core-hole")||!strcmp(c,"core-second-dart")?1:0)); } else if(!strncmp(c,"range-",6)){ u64 start=0,length=0;bool four=!strncmp(c,"range-four",10);u64 window=1ULL<<40;size_t slot=four?16:1; @@ -161,12 +179,20 @@ int main(int argc,char**argv){ } else if(!strncmp(c,"map-",4)){ root[0]=0x1401;u64 addr=0; + u64 paddr=0x8000;int prot=IOMMU_READ|IOMMU_WRITE|IOMMU_CACHE; if(!strcmp(c,"map-host")){addr=1ULL<<25;root[1]=0;} if(!strcmp(c,"map-owned"))shadow[0]=root[0]; if(!strcmp(c,"map-unmatched"))d.fw_handoff=0; if(!strcmp(c,"map-attached")){domain.fw_sidmap[0][0]=0;domain.stream_maps[0].sidmap[0]=1;} - int expected=!strcmp(c,"map-host")||!strcmp(c,"map-owned")||!strcmp(c,"map-unmatched")?0:-EBUSY; - assert(apple_dart_check_fw_map(&domain,addr,0x8000,SZ_16K,IOMMU_READ|IOMMU_WRITE|IOMMU_CACHE)==expected); + /* Only a page the firmware leaf already maps the same way is repeated. */ + if(!strcmp(c,"map-hole"))firmware_leaf[0]=0; + if(!strcmp(c,"map-wrong-physical"))paddr=0xc000; + if(!strcmp(c,"map-wrong-permission"))prot&=~IOMMU_CACHE; + if(!strcmp(c,"map-changed-root"))root[0]=0x1801; + if(!strcmp(c,"map-four"))d.tcr=1; + int expected=!strcmp(c,"map-host")||!strcmp(c,"map-owned")||!strcmp(c,"map-unmatched")|| + !strcmp(c,"map-firmware")||!strcmp(c,"map-attached")?0:-EBUSY; + assert(apple_dart_check_fw_map(&domain,addr,paddr,SZ_16K,prot)==expected); } else if(!strncmp(c,"lookup-",7)){ root[0]=0x1401;assert(apple_dart_inherited_phys(&domain,0)==0x8000); @@ -195,6 +221,31 @@ int main(int argc,char**argv){ assert(apple_dart_fw_invalidate(&stream,base,base+2*span-1)==(command_error?-ETIMEDOUT:0)); assert(commands==1&&command_start[0]==base+span&&command_end[0]==base+2*span-1); } + else if(!strncmp(c,"retire-",7)){ + /* A TLB timeout while retiring a root keeps the domain's page tables, + * whether the domain free, a consumer release or an attach rollback + * retired it first. */ + root[0]=0x1401;root[1]=shadow[1]=0x801;d.locked_window[0]=1ULL<<40;d.locked_fw[0][0]=NULL;d.version=0x0202;hw.invalidate_tlb=apple_dart_t8110_hw_invalidate_tlb; + struct apple_dart_domain*dom=calloc(1,sizeof(*dom));assert(dom);dom->stream_maps[0].dart=&d;dom->stream_maps[0].sidmap[0]=1;dom->pgtbl_ops=&d; + bool timeout=!!strstr(c,"timeout");if(timeout)command_error=-ETIMEDOUT; + if(!strncmp(c,"retire-release",14)){ + struct apple_dart_master_cfg*owner=calloc(1,sizeof(*owner));assert(owner);*owner=cfg;dev.cfg=owner; + apple_dart_release_device(&dev);assert(pm_gets==1&&pm_puts==1); + }else if(!strcmp(c,"retire-rollback-timeout")){ + struct apple_dart_stream_map stream={.dart=&d,.sidmap={1}}; + assert(apple_dart_hw_unmap_locked_ttbr(&stream,0)==-ETIMEDOUT); + }else assert(!strcmp(c,"retire-free")||!strcmp(c,"retire-free-timeout")); + if(strncmp(c,"retire-free",11)){ + /* Retired first: the free sees no root left and issues no command. */ + assert(!d.locked_ttbr[0][0]&&commands==1&&d.locked_retire_err[0]==(timeout?-ETIMEDOUT:0)); + command_error=0; + } + apple_dart_domain_free((struct iommu_domain*)dom); + assert(!d.locked_ttbr[0][0]&&root[0]==0x1401&&!root[1]&&!shadow[1]); + assert(commands==1&&command_start[0]==(1ULL<<40)+(1ULL<<25)&&command_end[0]==(1ULL<<40)+(1ULL<<36)-1); + assert(d.locked_retire_err[0]==(timeout?-ETIMEDOUT:0)); + assert(pgtable_frees==!timeout&&errors_logged==timeout); + } else if(!strcmp(c,"mirror")){assert(!apple_dart_publish_root(&d,live,owned,ours,&fw,2));assert(live[0]==0x1401&&owned[0]==0);} else if(!strcmp(c,"changed-leaf")){assert(!apple_dart_publish_root(&d,live,owned,ours,&fw,2));firmware_leaf[0]=leaf(0xc000);assert(apple_dart_publish_root(&d,live,owned,ours,&fw,2)==-EBUSY);} else if(!strcmp(c,"wrong-permission")){firmware_leaf[0]|=4;assert(apple_dart_publish_root(&d,live,owned,ours,&fw,2)==-EBUSY);} diff --git a/tools/aurora-sep/tests/test_t8112_sep_dma.py b/tools/aurora-sep/tests/test_t8112_sep_dma.py index 45fdae561ead39..c2a3f8a80ee0f5 100644 --- a/tools/aurora-sep/tests/test_t8112_sep_dma.py +++ b/tools/aurora-sep/tests/test_t8112_sep_dma.py @@ -130,6 +130,11 @@ def setUpClass(cls): static bool apple_dart_fw_mapping_matches(phys_addr_t phys, int prot, phys_addr_t expected, int required) { abort(); } +static bool apple_dart_fw_page_matches(const struct apple_dart *dart, + const struct apple_dart_fw_root *fw, + u64 slot, u64 addr, phys_addr_t paddr, + int prot) +{ abort(); } static bool apple_dart_fw_handoff_page_busy(struct apple_dart *dart, struct apple_dart_domain *domain, int i, struct apple_dart_atomic_stream_map *map,