1/* 2 * Copyright (c) 2013, 2018-2019 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 591 unchanged lines hidden (view full) --- 600 601 602 // Establish stage 2 context first since 603 // Context Descriptors can be in IPA space. 604 if (tc.stage2Enable) { 605 tc.httb = ste.dw3.s2ttb << STE_S2TTB_SHIFT; 606 tc.vmid = ste.dw2.s2vmid; 607 tc.stage2TranslGranule = ste.dw2.s2tg; |
608 tc.s2t0sz = ste.dw2.s2t0sz; |
609 } else { 610 tc.httb = 0xdeadbeef; 611 tc.vmid = 0; 612 tc.stage2TranslGranule = TRANS_GRANULE_INVALID; |
613 tc.s2t0sz = 0; |
614 } 615 616 617 // Now fetch stage 1 config. 618 if (context.stage1Enable) { 619 ContextDescriptor cd; 620 doReadCD(yield, cd, ste, request.sid, request.ssid); 621 622 tc.ttb0 = cd.dw1.ttb0 << CD_TTB_SHIFT; 623 tc.ttb1 = cd.dw2.ttb1 << CD_TTB_SHIFT; 624 tc.asid = cd.dw0.asid; 625 tc.stage1TranslGranule = cd.dw0.tg0; |
626 tc.t0sz = cd.dw0.t0sz; |
627 } else { 628 tc.ttb0 = 0xcafebabe; 629 tc.ttb1 = 0xcafed00d; 630 tc.asid = 0; 631 tc.stage1TranslGranule = TRANS_GRANULE_INVALID; |
632 tc.t0sz = 0; |
633 } 634 635 return true; 636} 637 638void 639SMMUTranslationProcess::walkCacheLookup( 640 Yield &yield, --- 233 unchanged lines hidden (view full) --- 874 smmu.getPageTableOps(context.stage1TranslGranule); 875 876 const WalkCache::Entry *walk_ep = NULL; 877 unsigned level; 878 879 // Level here is actually (level+1) so we can count down 880 // to 0 using unsigned int. 881 for (level = pt_ops->lastLevel() + 1; |
882 level > pt_ops->firstLevel(context.t0sz); |
883 level--) 884 { 885 walkCacheLookup(yield, walk_ep, addr, 886 context.asid, context.vmid, 1, level-1); 887 888 if (walk_ep) 889 break; 890 } --- 16 unchanged lines hidden (view full) --- 907 if (context.stage2Enable) { 908 TranslResult s2tr = translateStage2(yield, table_addr, false); 909 if (s2tr.fault != FAULT_NONE) 910 return s2tr; 911 912 table_addr = s2tr.addr; 913 } 914 |
915 tr = walkStage1And2(yield, addr, pt_ops, 916 pt_ops->firstLevel(context.t0sz), |
917 table_addr); 918 } 919 920 if (tr.fault == FAULT_NONE) 921 DPRINTF(SMMUv3, "Translated vaddr %#x to paddr %#x\n", addr, tr.addr); 922 923 return tr; 924} --- 24 unchanged lines hidden (view full) --- 949 950 return tr; 951 } else if (smmu.ipaCacheEnable) { 952 DPRINTF(SMMUv3, " IPACache miss ipa=%#x vmid=%#x\n", 953 addr, context.vmid); 954 } 955 956 const WalkCache::Entry *walk_ep = NULL; |
957 unsigned level = pt_ops->firstLevel(context.s2t0sz); |
958 959 if (final_tr || smmu.walkCacheNonfinalEnable) { 960 // Level here is actually (level+1) so we can count down 961 // to 0 using unsigned int. 962 for (level = pt_ops->lastLevel() + 1; |
963 level > pt_ops->firstLevel(context.s2t0sz); |
964 level--) 965 { 966 walkCacheLookup(yield, walk_ep, addr, 967 0, context.vmid, 2, level-1); 968 969 if (walk_ep) 970 break; 971 } --- 9 unchanged lines hidden (view full) --- 981 tr.addr = walk_ep->pa + (addr & ~walk_ep->vaMask); 982 tr.addrMask = walk_ep->vaMask; 983 tr.writable = walk_ep->permissions; 984 } else { 985 tr = walkStage2(yield, addr, final_tr, pt_ops, 986 level + 1, walk_ep->pa); 987 } 988 } else { |
989 tr = walkStage2(yield, addr, final_tr, pt_ops, 990 pt_ops->firstLevel(context.s2t0sz), |
991 context.httb); 992 } 993 994 if (tr.fault == FAULT_NONE) 995 DPRINTF(SMMUv3, " Translated %saddr %#x to paddr %#x\n", 996 context.stage1Enable ? "ip" : "v", addr, tr.addr); 997 998 if (smmu.ipaCacheEnable) { --- 468 unchanged lines hidden --- |