04 Sep, 2020

1 commit

  • Static analyzer is not happy about intel_iommu_gfx_mapped declaration:

    .../drivers/iommu/intel/iommu.c:364:5: warning: symbol 'intel_iommu_gfx_mapped' was not declared. Should it be static?

    Move its declaration to Intel IOMMU header file.

    Signed-off-by: Andy Shevchenko
    Reviewed-by: Lu Baolu
    Link: https://lore.kernel.org/r/20200828161212.71294-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Joerg Roedel

    Andy Shevchenko
     

02 Jan, 2019

1 commit

  • intel-gtt.h uses kernel and agp pointers, make it self-contained by
    including the relevant headers. This prepares for dropping drmP.h from
    files including intel-gtt.h.

    [Updated commit message per Laurent's review while applying.]

    Cc: Sam Ravnborg
    Cc: Daniel Vetter
    Cc: Laurent Pinchart
    Reviewed-by: Daniel Vetter
    Signed-off-by: Jani Nikula
    Link: https://patchwork.freedesktop.org/patch/msgid/9414800f89d6f326c6e9173233bf6c4dee254d9a.1545915059.git.jani.nikula@intel.com

    Jani Nikula
     

12 Dec, 2017

2 commits

  • Keeps things consistent now that we make use of struct resource. This
    should keep us covered in case we ever get huge amounts of stolen
    memory.

    v2: bunch of missing conversions (Chris)

    Signed-off-by: Matthew Auld
    Cc: Joonas Lahtinen
    Cc: Chris Wilson
    Cc: Paulo Zanoni
    Reviewed-by: Chris Wilson
    Signed-off-by: Joonas Lahtinen
    Link: https://patchwork.freedesktop.org/patch/msgid/20171211151822.20953-10-matthew.auld@intel.com

    Matthew Auld
     
  • Now that we are using struct resource to track the stolen region, it is
    more convenient if we track dsm in a resource as well.

    v2: check range_overflow when writing to 32b registers (Chris)
    pepper in some comments (Chris)
    v3: refit i915_stolen_to_dma()
    v4: kill ggtt->stolen_size
    v5: some more polish

    Signed-off-by: Matthew Auld
    Cc: Joonas Lahtinen
    Cc: Chris Wilson
    Cc: Paulo Zanoni
    Reviewed-by: Chris Wilson
    Signed-off-by: Joonas Lahtinen
    Link: https://patchwork.freedesktop.org/patch/msgid/20171211151822.20953-6-matthew.auld@intel.com

    Matthew Auld
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Jan, 2017

1 commit

  • Stolen memory is a hardware resource of known size, so use an accurate
    fixed integer type rather than the ambiguous variable size_t. This was
    motivated by the next patch spotting inconsistencies in our types.

    Signed-off-by: Chris Wilson
    Reviewed-by: Tvrtko Ursulin
    Link: http://patchwork.freedesktop.org/patch/msgid/20170106152013.24684-3-chris@chris-wilson.co.uk

    Chris Wilson
     

13 Jun, 2016

1 commit

  • Introduced a new vm specfic callback insert_page() to program a single pte in
    ggtt or ppgtt. This allows us to map a single page in to the mappable aperture
    space. This can be iterated over to access the whole object by using space as
    meagre as page size.

    v2: Added low level rpm assertions to insert_page routines (Chris)

    v3: Added POSTING_READ post register write (Tvrtko)

    v4: Rebase (Ankit)

    v5: Removed wmb() and FLUSH_CTL from insert_page, caller to take care
    of it (Chris)

    v6: insert_page not working correctly without FLSH_CNTL write, added the
    write again.

    Signed-off-by: Chris Wilson
    Signed-off-by: Ankitprasad Sharma
    Reviewed-by: Tvrtko Ursulin
    Signed-off-by: Tvrtko Ursulin

    Chris Wilson
     

26 Jun, 2015

1 commit


15 Feb, 2013

1 commit

  • When I refactored the code initially, I forgot that gen2 uses a
    different bar for the CPU mappable aperture. The agp-less code knows
    nothing of generations less than 5, so we have to expand the gtt_probe
    function to include the mappable base and end.

    It was originally broken by me:
    commit baa09f5fd8a6d033ec075355dda99a65b7f6a0f3
    Author: Ben Widawsky
    Date: Thu Jan 24 13:49:57 2013 -0800

    drm/i915: Add probe and remove to the gtt ops

    Reported-by: Chris Wilson
    Signed-off-by: Ben Widawsky
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     

31 Jan, 2013

1 commit

  • With the probe call in our dispatch table, we can now cut away the
    last three remaining members in the intel_gtt shared struct and so
    remove it completely.

    v2: Rebased on top of Daniel's series

    Signed-off-by: Ben Widawsky
    Reviewed-by: Damien Lespiau
    [danvet: bikeshed commit message a bit.]
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     

20 Jan, 2013

4 commits

  • It is no longer used in the i915 code, so isolate it from the shared
    struct.

    This was originally part of:
    commit 0e275518f325418d559c05327775bff894b237f7
    Author: Ben Widawsky
    Date: Mon Jan 14 13:35:33 2013 -0800

    agp/intel: decouple more of the agp-i915 sharing

    Reviewed-by: Rodrigo Vivi
    Signed-off-by: Ben Widawsky

    That commit had some other hunks which can't be used due to issues
    Daniel found in previous commits.

    Signed-off-by: Ben Widawsky
    [danvet: drop squash notice from the commit since it's imo ok to keep
    this one separate.]
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     
  • The reasoning behind our code taking two paths depending upon whether or
    not we may have been configured for IOMMU isn't clear to me. It should
    always be safe to use the pci mapping functions as they are designed to
    abstract the decision we were handling in i915.

    Aside from simpler code, removing another member for the intel_gtt
    struct is a nice motivation.

    I ran this by Chris, and he wasn't concerned about the extra kzalloc,
    and memory references vs. page_to_phys calculation in the case without
    IOMMU.

    v2: Update commit message

    v3: Remove needs_dmar addition from Zhenyu upstream

    This reverts (and then other stuff)
    commit 20652097dadd9a7fb4d652f25466299974bc78f9
    Author: Zhenyu Wang
    Date: Thu Dec 13 23:47:47 2012 +0800

    drm/i915: Fix missed needs_dmar setting

    Reviewed-by: Rodrigo Vivi (v2)
    Cc: Zhenyu Wang
    Signed-off-by: Ben Widawsky
    [danvet: Squash in follow-up fix to remove the bogus hunk which
    deleted the dma_mask configuration for gen6+.]
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     
  • We already had a mapping in both (minus the phys_addr in AGP).

    Reviewed-by: Rodrigo Vivi
    Signed-off-by: Ben Widawsky
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     
  • And, move it to where the rest of the logic is.

    There is some slight functionality changes. There was extra paranoid
    checks in AGP code making sure we never do idle maps on gen2 parts. That
    was not duplicated as the simple PCI id check should do the right thing.

    v2: use IS_GEN5 && IS_MOBILE check instead. For now, this is the same as
    IS_IRONLAKE_M but is more future proof. The workaround docs hint that
    more than one platform may be effected, but we've never seen such a
    platform in the wild. (Rodrigo, Daniel)

    Reviewed-by: Rodrigo Vivi (v1)
    Cc: Dave Airlie
    Signed-off-by: Ben Widawsky
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     

20 Dec, 2012

1 commit

  • This removes an unused field from the AGP structure and moves it into
    the dev_priv structure (with a slightly better name). This builds upon
    the kill-agp series already merged.

    GSM is a well defined term in the bspec:
    GSM: Graphics Stolen Memory

    GTT stolen space is defined for storage of the GFX GTT entries in
    physical memory. IA can not access GSM directly , it can only access via
    GTTMMADR. GT can access GSM directly or through GTTMMADR.

    This is not the entire stolen space.

    Signed-off-by: Ben Widawsky
    Reviewed-by: Mika Kuoppala
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     

12 Nov, 2012

2 commits

  • v2: Accidently removed an ILK case in i9xx_setup (Nicely found by Chris)

    CC: Chris Wilson
    Reviewed-by [v1] : Jesse Barnes
    Signed-off-by: Ben Widawsky
    Reviewed-by: Chris Wilson
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     
  • As a quick hack we make the old intel_gtt structure mutable so we can
    fool a bunch of the existing code which depends on elements in that data
    structure. We can/should try to remove this in a subsequent patch.

    This should preserve the old gtt init behavior which upon writing these
    patches seems incorrect. The next patch will fix these things.

    The one exception is VLV which doesn't have the preserved flush control
    write behavior. Since we want to do that for all GEN6+ stuff, we'll
    handle that in a later patch. Mainstream VLV support doesn't actually
    exist yet anyway.

    v2: Update the comment to remove the "voodoo"
    Check that the last pte written matches what we readback

    v3: actually kill cache_level_to_agp_type since most of the flags will
    disappear in an upcoming patch

    v4: v3 was actually not what we wanted (Daniel)
    Make the ggtt bind assertions better and stricter (Chris)
    Fix some uncaught errors at gtt init (Chris)
    Some other random stuff that Chris wanted

    v5: check for i==0 in gen6_ggtt_bind_object to shut up gcc (Ben)

    Signed-off-by: Ben Widawsky
    Reviewed-by [v4]: Chris Wilson
    [danvet: Make the cache_level -> agp_flags conversion for pre-gen6 a
    tad more robust by mapping everything != CACHE_NONE to the cached agp
    flag - we have a 1:1 uncached mapping, but different modes of
    cacheable (at least on later generations). Suggested by Chris Wilson.]
    Signed-off-by: Daniel Vetter

    Ben Widawsky
     

20 Sep, 2012

1 commit

  • Rather than have multiple data structures for describing our page layout
    in conjunction with the array of pages, we can migrate all users over to
    a scatterlist.

    One major advantage, other than unifying the page tracking structures,
    this offers is that we replace the vmalloc'ed array (which can be up to
    a megabyte in size) with a chain of individual pages which helps reduce
    memory pressure.

    The disadvantage is that we then do not have a simple array to iterate,
    or to access randomly. The common case for this is in the relocation
    processing, which will typically fit within a single scatterlist page
    and so be almost the same cost as the simple array. For iterating over
    the array, the extra function call could be optimised away, but in
    reality is an insignificant cost of either binding the pages, or
    performing the pwrite/pread.

    v2: Fix drm_clflush_sg() to not invoke wbinvd as well! And fix the
    trivial compile error from rebasing.

    Signed-off-by: Chris Wilson
    Signed-off-by: Daniel Vetter

    Chris Wilson
     

13 Jun, 2012

3 commits

  • When drm/i915 is in control of the gtt, we need to call
    the enable function at all the relevant places ourselves.

    Reviewed-by: Jani Nikula
    Signed-off-by: Daniel Vetter

    Daniel Vetter
     
  • To be able to directly set up the intel-gtt code from drm/i915 and
    avoid setting up the fake-agp driver we need to prepare a few things:
    - pass both the bridge and gpu pci_dev to the probe function and add
    code to handle the gpu pdev both being present (for drm/i915) and
    not present (fake agp).
    - add refcounting to the remove function so that unloading drm/i915
    doesn't kill the fake agp driver

    v2: Fix up the cleanup and refcount, noticed by Jani Nikula.

    Reviewed-by: Jani Nikula
    Signed-Off-by: Daniel Vetter

    Daniel Vetter
     
  • For that to work we need to export the base address of the gtt
    mmio window from intel-gtt. Also replace all other uses of
    dev->agp by values we already have at hand.

    Reviewed-by: Jani Nikula
    Signed-off-by: Daniel Vetter

    Daniel Vetter
     

02 Apr, 2012

1 commit

  • Totally unexpected that this regressed. Luckily it sounds like we just
    need to have dmar disable on the igfx, not the entire system. At least
    that's what a few days of testing between Tony Vroon and me indicates.

    Reported-by: Tony Vroon
    Cc: Tony Vroon
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43024
    Acked-by: Chris Wilson
    Signed-Off-by: Daniel Vetter

    Daniel Vetter
     

10 Feb, 2012

2 commits


21 Oct, 2011

1 commit

  • Idle the GPU before doing any unmaps. We know if VT-d is in use through
    an exported variable from iommu code.

    This should avoid a known HW issue.

    Signed-off-by: Ben Widawsky
    Reviewed-by: Daniel Vetter
    Signed-off-by: Keith Packard

    Ben Widawsky
     

24 Nov, 2010

3 commits


23 Nov, 2010

1 commit


21 Sep, 2010

1 commit


09 Sep, 2010

2 commits

  • Use the detection from intel-gtt.ko instead. Hooray!

    Also move the stolen mem allocator to the other gtt stuff in dev_prv->mem.

    v2: Chris Wilson noted that my error handling was crap. Fix it. He also
    said that this fixes a problem on his i845. Indeed, i915_probe_agp
    misses a special case for i830/i845 stolen mem detection.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25476
    Cc: stable@kernel.org
    Signed-off-by: Daniel Vetter
    Signed-off-by: Chris Wilson

    Daniel Vetter
     
  • Add a few definitions to it that are already shared and that will
    be shared in the future (like the number of stolen entries).
    No functional changes in here.

    Signed-off-by: Daniel Vetter
    Signed-off-by: Chris Wilson

    Daniel Vetter