Tuesday, November 29, 2016

Notes on ARMv8 MMU Facts for Training Class


  1. Explain Access Flag and DirtyBitModifier (bit 51) use cases
  2. For fun and dreams of the future,  Point of Persistency, and Common Not Private (FCM training of pages 9 and 10)
  3. Explain SMMUv3 call flow

Saturday, November 19, 2016

Week #47 Reviews and Plans

Reviews:
    Two things disappointed me. Should I channel my energy towards My Next Move?
  1.      Review was only 5 out of 7. I do not think it is fair, comparing my expertise and contributions to what Vipul Gandhi or others contributed. They claim my problem is with "communications", but that is mostly due to poor impressons in the past.
  2.      The QC Windows / Sys Arch leads (Beth and Ryan), and especially Bob Rychlic did not return my support with the support. They did not include me in the performance discussions regarding memory attributes. I felt rejected and judged. Bob even gave me / us a lecture on how things should be communicated through "sys architects". 

Plans:

  • Family:  
One Goal: by 2017 Thanksgiving, reach $1200K combine Fidelity and Etrade with a handful of passive index ETFs
    1. First step in the 7 Monthly-steps Easy Family Investment
      1. 2016/11: a) Sell PSP, OAKIX (done) b) buy $26K of HD at market (done) c) Move QCOM stocks in E-trade to regular account (done);  e) (done) Change 401K and 529 new contributions to SP500 Index funds  (done) f) Put $50K cash to IVV and IJR (done) g) put Fid cash to FDLO (done)
      2. 2016/12/10: On 10th of each month a) Buy ONEQ (~$20K) done; b) move Canadian Monthly Income to the XFN ETF;  done c) In e-trade, Sell losers for tax gain d) put QCOM stop e) Buy IJR (~$20K) f) move NBS Sci and Tech to cash and move TD cash $2600 to TDB903 Dow Jones  index mutual fund with 0.8% fees or less 
      3. 2017/1/10: a) Buy IJR (~$20K); b) Move existing 2025 target retirement funds to brokerage link c) put new money in brokerage link to 50% ONEQ and 50% IJR 
      4. 2017/2: Buy IVV (~$20K);     Keep APPL, BABA, GLD and NXP, but move the other individual stocks / ETFs to Index ETFs: VBR in Etrade and TDAmeritrade;  c)sell 401K target fund d) move the said cash to brokerage link to buy half IJR and ONEQ
      5. 2017/3: Buy IJR $20K
      6. 2017/4: Buy IJR $20K a) Sell all international fund FIENX; b) Buy IVV $20K Move the proceeds from #6 to 50% IVV and 50% IJR
      7. 2017/5: Buy ONEQ $20 to $40 K
    2. Backpack Camping trip done 
    3. Fuel for Primus stove
    4. On Windows 10 machines, add Tracy and Taylor as Child Accounts
    5. Prepare SWIFT quiz / mid term project
    6. Get tracy Canadian citizenship:  http://www.cic.gc.ca/english/information/applications/certif.asp
  • Sharpen the saw
    1. ARMv8 training materials
    2. Send resumes for my next move: Laura and Will Deacon 
    3. Send LinkedIn file to Suresh Sugumar for MediaTek opportunity 
    4. Read Transforming technical experts to technical trainers
  • Serve My Life Lead
    1. Talk to dad about "Where are my Sins?"
    2. Read "Speaking Truth in Love"

  • Serve My Work Lead

    1. Add list of ecosystems Conf to go
    2. ARB on Stage 1 for Google
    3. Align with Christophe Not Done  and Paul Ellis Done
    4. Prepare class material on "SMMU and Snapdragon Master-side Access Control"
    5. File IDF SOC Multi-VM memory access control done 
    6. Pray for reconciling with JM Tran done

Sunday, November 13, 2016

Where Are My Sins?

Dad recommended me to Rev Ryle Bishop, where are your sins?

3. My last word shall be an exhortation. I address it to all who have been taught by the Spirit to feel their sins, and have fled to the hope set before them in the Gospel; I address it to all who have discovered the grand truth that they are guilty sinners, and have washed in the blood of Christ in order to have their sins cleansed away. That exhortation shall be short and simple. I bid them “cling to Christ.”

Cling to Christ, I say: and never forget your debt to Him. Sinners you were, when you were first called by the Holy Ghost, and fled to Jesus. Sinners you have been, even at your bed, from the day of your conversion. Sinners you will find yourselves to your dying hour, having nothing to boast of in yourselves. Then cling to Christ.

Cling to Christ, I say: and make use of His atoning blood every day. Go to Him every morning as your morning sacrifice, and confess your need of His salvation. Go to Him every night, after the bustle of the day, and plead for fresh absolution. Wash in the great Fountain every evening, after all the defilement of contact with the world. “He that is washed, needeth not save to wash his feet.” But his feet he needs to wash. (John xiii. 10.)

Cling to Christ, I say: and show the world how you love Him. Show it by obedience to His commandments. Show it by conformity to His image. Show it by following His example. Make your Master’s cause lovely and beautiful before men, by your own holiness of temper and conversation. Let all the world see, that he who is much forgiven is the man who loves much, and that he who loves most is the man who does most for Christ. (Luke vii. 47.)


Friday, November 11, 2016

Week #46 Reviews and Plans

Plans:


  1. Family:  
    1. Bio metrics for $700
    2. Backpack Camping trip
      1. 2 or 3 backpacks
      2. Fuel for Primus stove
      3. Portable coffee press
    3. Get tracy Canadian citizenship:  http://www.cic.gc.ca/english/information/applications/certif.asp
  2. Sharpen the saw
    1. Memory management training materials
    2. Read Transforming technical experts to technical trainers
  3. Serve My Life Lead
    1. Help Charles Shi
  4. Serve My Work Lead
    1. Prepare slides for Jim T
    2. Pray for reconciling with Scott Yee

Monday, November 7, 2016

week #45 Reviews and Plans


Family
  1. Translate Richardson's chapter on Practicing God's Healing Presence for Pastor Angela to review: ongoing
  2. Fix andorra toilet leaks: ongoing
  3. Install activity monitor on Game Machine: ongoing
  4. Ask Taylor to arrange his own affairs and schedule things with phone calls
  5. Get with Shaolin Kong re college educations: ongoing
  6. talk to Lucy re college prep: done
  7. Talk to Petry about ARM job: ongoing
    Faithful at Work:

    1. Prototype TAC SHM Bridge module
    2. Summarize TAC SHM for Bobby: ongoing
    3. Summarize SMMU for Crypto DMA for Bobby: ongoing
      1. Finished Crypto HPG and produce 3 slides on Crypto Without BAM or scatter-gather
      2. Daneh's Crypto classes: not done
    4. Compile the table of Napali-Q SMMU requirements: done
    5.  Put together changes to my network:
      1. Reach out to NVidia 
      2. Reach out to Colin? But he and I are different...
      3. Laura A
      4. Reach out to Gil?

    6. W3. Prepare Audio call flows for training: Follow up Arun Mirpuri / Banajit: done
    7. W4. Reimburse trip / interview lunch
    8. W4. Compete SMMU workshop actions on clocking and DMA VM: waiting for agreement with ARM
    1. Write my own ARMv8 classes
      1. describe different v8.2 Instruction Cache types: AIVIPT/VIPT/PIPT/ VMID Aware PIPT
      2. Explain Error Synchronization Barrier
    Career Self-improve:

    1. Learn vim and cscope: try it on trusty code: ongoing 
    2. Prepare Trip of Apology: Done
    3.  
    4. Read sections on MemTypes of ARMv8 ARM rev.J: done
    5. Read sections on Point of Persistency ARMv8 and 8.2
    6.  
    7. -- Study exclusive page-frame patches 
    8. -- take Moneh Crypto classes 
    9.  

      Friday, November 4, 2016

      Awaiting redemption's opportunity of a life time

      I'm here in the lobby of the Community Conference Center in Santa Fe NM, waiting to talk to Marc Zynier.  Jens Wiklander just walked in the lobby. I must go say hi to him too.

      Lord what will happen? Will you be by my side?

      https://dareesinsights.files.wordpress.com/2013/04/tumblr_ldsn2tvb0r1qbpwzeo1_500.png





      Awaiting redemption's opportunity of a life

      I'm here in the lobby of the Community Conference Center in Santa Fe NM, waiting to talk to Marc Zynier.  Jens Wiklander just walked in the lobby. I must go say hi to him too.

      Lord what will happen? Will you be by my side?

      https://dareesinsights.files.wordpress.com/2013/04/tumblr_ldsn2tvb0r1qbpwzeo1_500.png





      Wednesday, November 2, 2016

      optee exposed to TA indirect attacking NSEL1

      This in optee_os/core/tee/tee_svc.c has a potential security hole:


      static TEE_Result tee_svc_copy_param(struct tee_ta_session *sess,
                                           struct tee_ta_session *called_sess,
                                           struct utee_params *callee_params,
                                           struct tee_ta_param *param,
                                           void *tmp_buf_va[TEE_NUM_PARAMS],
                                           tee_mm_entry_t **mm)
      {
              size_t n;
              TEE_Result res;
              size_t req_mem = 0;
              size_t s;
              uint8_t *dst = 0;
              tee_paddr_t dst_pa, src_pa = 0;
              bool ta_private_memref[TEE_NUM_PARAMS];
              struct user_ta_ctx *utc = to_user_ta_ctx(sess->ctx);
              const uint32_t sec_ddr_attr = TEE_MATTR_CACHE_CACHED;

              /* fill 'param' input struct with caller params description buffer */
              if (!callee_params) {
                      memset(param, 0, sizeof(*param));
              } else {
                      res = tee_mmu_check_access_rights(utc,
                              TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER,
                              (tee_uaddr_t)callee_params, sizeof(struct utee_params));
                      if (res != TEE_SUCCESS)
                              return res;
                      utee_param_to_param(param, callee_params);
              }

              if (called_sess && is_static_ta_ctx(called_sess->ctx)) {
                      /*
                       * static TA, borrow the mapping of the calling
                       * during this call.
                       */
                      return TEE_SUCCESS;
              }
                                         

        for (n = 0; n < TEE_NUM_PARAMS; n++) {

                      ta_private_memref[n] = false;

                      switch (TEE_PARAM_TYPE_GET(param->types, n)) {
                      case TEE_PARAM_TYPE_MEMREF_INPUT:
                      case TEE_PARAM_TYPE_MEMREF_OUTPUT:
                      case TEE_PARAM_TYPE_MEMREF_INOUT:
                              if (param->params[n].memref.buffer == NULL) {
                                      if (param->params[n].memref.size != 0)
                                              return TEE_ERROR_BAD_PARAMETERS;
                                      break;
                              }
                              /* uTA cannot expose its private memory */
                              if (tee_mmu_is_vbuf_inside_ta_private(utc,
                                          param->params[n].memref.buffer,
                                          param->params[n].memref.size)) {

                                      s = ROUNDUP(param->params[n].memref.size,
                                                      sizeof(uint32_t));
                                      /* Check overflow */
                                      if (req_mem + s < req_mem)
                                              return TEE_ERROR_BAD_PARAMETERS;
                                      req_mem += s;
                                      ta_private_memref[n] = true;
                                      break;
                              }
                              if (tee_mmu_is_vbuf_intersect_ta_private(utc,
                                          param->params[n].memref.buffer,
                                          param->params[n].memref.size))
                                      return TEE_ERROR_BAD_PARAMETERS;

                              src_pa = virt_to_phys(param->params[n].memref.buffer);
                              if (!src_pa)
                                      return TEE_ERROR_BAD_PARAMETERS;

                              param->param_attr[n] = tee_mmu_user_get_cache_attr(
                                      utc, (void *)param->params[n].memref.buffer);

                              param->params[n].memref.buffer = (void *)src_pa;
                              break;

                      default:
                              break;
                      }
              }

      Items to discuss this Friday


      1. With Mr. W
        1. What is the "outer cache" in Enable/Disable L2CC commands? Why do you need a mutex in a page in SHM? Is it only with HYP, or else How does it work with multi Guests (Guest Client IDs)?
        2. Should SHM validation happen in  tee_mmu_check_access_rights() in optee_os/core/arch/arm/mm/tee_mmu.c?
        3. Is the entire DDR mapped in SEL1 page table (secure TTBR1)?
      2. With Mr. D and Mr. Z:
        1. fault model to register events from S1 PTW faults in S2
        2. Driver model in EL2
        3. Ownership transfer of device "objects"