1. 19 Dec, 2016 1 commit
  2. 26 Oct, 2016 18 commits
    • Abhiram Balasubramanian's avatar
      Add ioremap functions to liblcd interface · bacb8330
      Abhiram Balasubramanian authored
      
      
      - rename functions
      - add them to mem.h
      Signed-off-by: Abhiram Balasubramanian's avatarAbhiram Balasubramanian <abhiram@cs.utah.edu>
      bacb8330
    • Charlie Jacobsen's avatar
      test-v2: Update address -> cptr to return offset into memory object. · 5bc7d324
      Charlie Jacobsen authored
      Updated kliblcd, liblcd, and string example.
      5bc7d324
    • Charlie Jacobsen's avatar
      test-v2: Add virt to resource node translation. · 3d4c0fb8
      Charlie Jacobsen authored
      This allows me to get all information - base address, size,
      cptr, and so on.
      3d4c0fb8
    • Charles Jacobsen's avatar
      test-v2: LCD module create functioning. · 38d3c5d0
      Charles Jacobsen authored
      Host can successfully load LCD, using new interval tree/memory
      object logic. (Still get EPT fault while booting LCD.)
      
      Some fixes/changes:
      
          1 - Need to use page-level granularity for memory objects.
              Unlike alloc_pages, vmalloc is page-granularity (rather
              than power-of-2 page granularity).
          2 - The kernel module region base virtual address needs to
              match the host's upper 2GB address, because of how address
              calculations are done internally and because we use the
              host module loader with no linkage changes (it's possible,
              but not worth it right now). Add assertion to make sure
              this is the case.
          3 - Needed to make LCD the owner of its cspace (set owner
              pointer).
      38d3c5d0
    • Charles Jacobsen's avatar
      4ca91d0c
    • Charles Jacobsen's avatar
      build-refactor-2: Fix build errors. Microkernel and kliblcd build. · 088970e6
      Charles Jacobsen authored
      Now that microkernel libcap build is separated from microkernel build
      itself, when we trigger a top-level microkernel build, it doesn't
      rebuild the whole thing every time. Kind of nice.
      088970e6
    • Charlie Jacobsen's avatar
      liblcd-v2: Low-level mmap done. Tweaked low-level mmap interface. · 9829af71
      Charlie Jacobsen authored
      Easier to have caller pass memory object order and gpa base for
      _lcd_mmap and _lcd_munmap, since in liblcd we can look those
      things up easily.
      9829af71
    • Charlie Jacobsen's avatar
      liblcd-v2: Fix kliblcd mapping, address -> cptr translation. · 89df5958
      Charlie Jacobsen authored
      I needed to clarify this part of the liblcd interface and ensure
      I have it right.
      
      Non-isolated code *must* invoke lcd_map_phys, lcd_map_virt, or
      _lcd_mmap on memory objects it either volunteers or is granted.
      This gives kliblcd an opportunity to insert the memory object
      into one of the two resource trees used for address -> cptr
      translation.
      
      I changed the names of the two trees to clarify what is stored
      in there - contiguous vs non-contiguous. (This is only a kliblcd
      internal thing.) It doesn't matter if you map contiguous memory
      via lcd_map_phys or lcd_map_virt; it always goes in the contiguous
      resource tree. Similar or non-contiguous (e.g. vmalloc) mem.
      89df5958
    • Charlie Jacobsen's avatar
      liblcd-v2: Add memory itree code, simple LCD create code. · c99648ed
      Charlie Jacobsen authored
      Memory itree code initializes resource tree needed for
      address -> cptr translation. Provides interface for other liblcd
      code to add/remove from tree (page allocator will use that).
      
      Removed redundant nr_pages_order field from resource tree node. Its
      size can be computed from the interval tree node.
      
      Filled in some simple functions that are part of the liblcd
      interface. Some are no-ops for isolated code.
      c99648ed
    • Charles Jacobsen's avatar
      build-refactor: New arch directory, header shuffling. · 1abb5ae7
      Charles Jacobsen authored
      Following the Linux kernel src layout, moved the vt-x code
      into a separate arch folder. Moved headers around:
      
         -- Microkernel/kliblcd arch-independent headers are in
            include/lcd_domains
         -- Microkernel arch-dependent headers are in arch/x86/include
         -- liblcd headers are in include/liblcd
      
      Switched some file/dir names to use `_` instead of `-`.
      1abb5ae7
    • Charles Jacobsen's avatar
      libcap-integration: Microkernel and kliblcd build bug fixes. · c94e9745
      Charles Jacobsen authored
      Microkernel and kliblcd compile. Some linker errors due to
      missing resource tree and create objects. Going to refactor
      build now, more code shuffling fun.
      c94e9745
    • Charlie Jacobsen's avatar
      lcd-create-v2: Add low- and high-level vmalloc to kliblcd. · cf3f9e4c
      Charlie Jacobsen authored
      Similar to alloc pages. Call into the microkernel to vmalloc
      memory. Then, add it to the vmalloc resource tree so we can
      do address -> cptr translation.
      cf3f9e4c
    • Charlie Jacobsen's avatar
      b49acd30
    • Charlie Jacobsen's avatar
      host-resource-trees: Volunteer host memory. · ac556704
      Charlie Jacobsen authored
      When non-isolated code wants to "volunteer" host memory to the
      microkernel's capability system, it invokes lcd_volunteer_pages,
      lcd_volunteer_dev_mem, or lcd_volunteer_vmalloc_mem, depending on
      the type of memory.
      
      Internally, these check to see if the memory has already been
      volunteered (so we don't get duplicates -- this is checked via the
      global memory interval tree). If not, it inserts the memory into
      the caller's cspace. The caller can subsequently share the memory
      with e.g. an isolated LCD via the capability mediated interfaces.
      
      I had support for this before, but there was no checking for
      duplicate inserts (and this is a real problem with the pmfs example
      for string sharing): Non-isolated code has no way of knowing
      (without implementing data structures on its own) whether it inserted
      host memory already or not, or whether some other non-isolated
      code has.
      
      Furthermore, now we have full support for address -> cptr translation
      in the non-isolated side. This is also needed for the pmfs example
      with string sharing: before, the non-isolated code just always
      inserted memory every time to share strings, even if this lead
      to duplicate inserts.
      
      I think this is one of the "friction points" of embedding a
      capability system inside a kernel: translation from host objects
      to capabilities and back. For some objects, you can just embed
      the cptr in the object itself (our "container structs"). But for
      some things -- like memory -- it's not so easy. (For device memory,
      the host kernel doesn't use a struct page to represent it. So we're
      faced with creating our own giant array of data structures to
      represent each page of device memory, and embedding the cptr in
      that. Or instead -- as I have done -- use a data structure like
      a tree to do a reverse lookup.)
      ac556704
    • Charlie Jacobsen's avatar
      host-resource-trees: Add/remove resource nodes from trees in kliblcd. · d39579d0
      Charlie Jacobsen authored
      Motivation: An LCD needs to keep track of address -> cptr
      correspondences. The resource trees fulfill that role. Each
      kLCD has two resource trees: one for physical memory (RAM, dev mem,
      etc.) and one for vmalloc memory (non-contiguous physical
      memory that is contiguous in the virtual address space).
      
      To mirror isolated code, when the kLCD maps/unmaps a memory
      object in host physical, we update its resource trees. (Of course,
      we don't bother / can't modify the host's physical mappings, so
      this is all that happens.) It gives kliblcd a chance to update
      the trees.
      d39579d0
    • Charlie Jacobsen's avatar
      generalized-allocator: Add code for metadata allocation. · b24caca1
      Charlie Jacobsen authored
      I'm no longer providing the option of embedding resource nodes in
      the metadata. The caller can just reserve a static array of the
      appropriate size (shouldn't be too big in common cases). Makes
      the metadata size calculation simpler. And the caller will most likely
      need to do tuning regardless.
      b24caca1
    • Charlie Jacobsen's avatar
      libcap-integration: Re-factor kliblcd page alloc and mapping. · fc7f2e63
      Charlie Jacobsen authored
      Mostly complete except for the bits that need the rb tree I'm
      planning to put in place for translating physical addresses
      to cptr's.
      
      This may seem like silly refactoring, but it's cleaning up
      and unifying a bunch of crap (including the more recent
      feature for passing strings back and forth).
      fc7f2e63
    • Charlie Jacobsen's avatar
      libcap-integration: Add some headers for liblcd v2. · 7dadddf3
      Charlie Jacobsen authored
      I wanted to do this first before re-factoring kliblcd, so I know
      what I need to do.
      
      This is a step toward unifying the old isolated and non-isolated
      interfaces. The semantics of each function will be a bit different
      depending on the execution context.
      
        -- address_spaces.h: from old types.h, with few changes
        -- boot_info.h: bootstrap page data; from old types.h; small
                        changes to struct
        -- create.h: LCD and kLCD creation; from old kliblcd.h; doc cleaned
                     up and interface
        -- mem.h: unified memory interface; coalesces functions from old
                  liblcd.h and kliblcd.h
        -- sync_ipc.h: unifies ipc and utcb headers
        -- syscall.h: same as before
      
      Removes old capability and data store crap.
      
      Also, fixes small bug for edge case in cap types.
      7dadddf3