Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a9991bc authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-intel-next-2017-12-14' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

- Fix documentation build issues (Randy, Markus)
- Fix timestamp frequency calculation for perf on CNL (Lionel)
- New DMC firmware for Skylake (Anusha)
- GTT flush fixes and other GGTT write track and refactors (Chris)
- Taint kernel when GPU reset fails (Chris)
- Display workarounds organization (Lucas)
- GuC and HuC initialization clean-up and fixes (Michal)
- Other fixes around GuC submission (Michal)
- Execlist clean-ups like caching ELSP reg offset and improving log readability (Chri\
s)
- Many other improvements on our logs and dumps (Chris)
- Restore GT performance in headless mode with DMC loaded (Tvrtko)
- Stop updating legacy fb parameters since FBC is not using anymore (Daniel)
- More selftest improvements (Chris)
- Preemption fixes and improvements (Chris)
- x86/early-quirks improvements for Intel graphics stolen memory. (Joonas, Matthew)
- Other improvements on Stolen Memory code to be resource centric. (Matthew)
- Improvements and fixes on fence allocation/release (Chris).

GVT:

- fixes for two coverity scan errors (Colin)
- mmio switch code refine (Changbin)
- more virtual display dmabuf fixes (Tina/Gustavo)
- misc cleanups (Pei)
- VFIO mdev display dmabuf interface and gvt support (Tina)
- VFIO mdev opregion support/fixes (Tina/Xiong/Chris)
- workload scheduling optimization (Changbin)
- preemption fix and temporal workaround (Zhenyu)
- and misc fixes after refactor (Chris)

* tag 'drm-intel-next-2017-12-14' of git://anongit.freedesktop.org/drm/drm-intel: (87 commits)
  drm/i915: Update DRIVER_DATE to 20171214
  drm/i915: properly init lockdep class
  drm/i915: Show engine state when hangcheck detects a stall
  drm/i915: make CS frequency read support missing more obvious
  drm/i915/guc: Extract doorbell verification into a function
  drm/i915/guc: Extract clients allocation to submission_init
  drm/i915/guc: Extract doorbell creation from client allocation
  drm/i915/guc: Call invalidate after changing the vfunc
  drm/i915/guc: Extract guc_init from guc_init_hw
  drm/i915/guc: Move GuC workqueue allocations outside of the mutex
  drm/i915/guc: Move shared data allocation away from submission path
  drm/i915: Unwind i915_gem_init() failure
  drm/i915: Ratelimit request allocation under oom
  drm/i915: Allow fence allocations to fail
  drm/i915: Mark up potential allocation paths within i915_sw_fence as might_sleep
  drm/i915: Don't check #active_requests from i915_gem_wait_for_idle()
  drm/i915/fence: Use rcu to defer freeing of irq_work
  drm/i915: Dump the engine state before declaring wedged from wait_for_engines()
  drm/i915: Bump timeout for wait_for_engines()
  drm/i915: Downgrade misleading "Memory usable" message
  ...
parents 6b7dcb53 ee5b5bf3
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -341,10 +341,7 @@ GuC
GuC-specific firmware loader
----------------------------

.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_loader.c
   :doc: GuC-specific firmware loader

.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_loader.c
.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_fw.c
   :internal:

GuC-based command submission
+47 −39
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ static void __init intel_remapping_check(int num, int slot, int func)
#define KB(x)	((x) * 1024UL)
#define MB(x)	(KB (KB (x)))

static size_t __init i830_tseg_size(void)
static resource_size_t __init i830_tseg_size(void)
{
	u8 esmramc = read_pci_config_byte(0, 0, 0, I830_ESMRAMC);

@@ -256,7 +256,7 @@ static size_t __init i830_tseg_size(void)
		return KB(512);
}

static size_t __init i845_tseg_size(void)
static resource_size_t __init i845_tseg_size(void)
{
	u8 esmramc = read_pci_config_byte(0, 0, 0, I845_ESMRAMC);
	u8 tseg_size = esmramc & I845_TSEG_SIZE_MASK;
@@ -273,7 +273,7 @@ static size_t __init i845_tseg_size(void)
	return 0;
}

static size_t __init i85x_tseg_size(void)
static resource_size_t __init i85x_tseg_size(void)
{
	u8 esmramc = read_pci_config_byte(0, 0, 0, I85X_ESMRAMC);

@@ -283,12 +283,12 @@ static size_t __init i85x_tseg_size(void)
	return MB(1);
}

static size_t __init i830_mem_size(void)
static resource_size_t __init i830_mem_size(void)
{
	return read_pci_config_byte(0, 0, 0, I830_DRB3) * MB(32);
}

static size_t __init i85x_mem_size(void)
static resource_size_t __init i85x_mem_size(void)
{
	return read_pci_config_byte(0, 0, 1, I85X_DRB3) * MB(32);
}
@@ -297,36 +297,36 @@ static size_t __init i85x_mem_size(void)
 * On 830/845/85x the stolen memory base isn't available in any
 * register. We need to calculate it as TOM-TSEG_SIZE-stolen_size.
 */
static phys_addr_t __init i830_stolen_base(int num, int slot, int func,
					   size_t stolen_size)
static resource_size_t __init i830_stolen_base(int num, int slot, int func,
					       resource_size_t stolen_size)
{
	return (phys_addr_t)i830_mem_size() - i830_tseg_size() - stolen_size;
	return i830_mem_size() - i830_tseg_size() - stolen_size;
}

static phys_addr_t __init i845_stolen_base(int num, int slot, int func,
					   size_t stolen_size)
static resource_size_t __init i845_stolen_base(int num, int slot, int func,
					       resource_size_t stolen_size)
{
	return (phys_addr_t)i830_mem_size() - i845_tseg_size() - stolen_size;
	return i830_mem_size() - i845_tseg_size() - stolen_size;
}

static phys_addr_t __init i85x_stolen_base(int num, int slot, int func,
					   size_t stolen_size)
static resource_size_t __init i85x_stolen_base(int num, int slot, int func,
					       resource_size_t stolen_size)
{
	return (phys_addr_t)i85x_mem_size() - i85x_tseg_size() - stolen_size;
	return i85x_mem_size() - i85x_tseg_size() - stolen_size;
}

static phys_addr_t __init i865_stolen_base(int num, int slot, int func,
					   size_t stolen_size)
static resource_size_t __init i865_stolen_base(int num, int slot, int func,
					       resource_size_t stolen_size)
{
	u16 toud = 0;

	toud = read_pci_config_16(0, 0, 0, I865_TOUD);

	return (phys_addr_t)(toud << 16) + i845_tseg_size();
	return toud * KB(64) + i845_tseg_size();
}

static phys_addr_t __init gen3_stolen_base(int num, int slot, int func,
					   size_t stolen_size)
static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
					       resource_size_t stolen_size)
{
	u32 bsm;

@@ -337,10 +337,10 @@ static phys_addr_t __init gen3_stolen_base(int num, int slot, int func,
	 */
	bsm = read_pci_config(num, slot, func, INTEL_BSM);

	return (phys_addr_t)bsm & INTEL_BSM_MASK;
	return bsm & INTEL_BSM_MASK;
}

static size_t __init i830_stolen_size(int num, int slot, int func)
static resource_size_t __init i830_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -361,7 +361,7 @@ static size_t __init i830_stolen_size(int num, int slot, int func)
	return 0;
}

static size_t __init gen3_stolen_size(int num, int slot, int func)
static resource_size_t __init gen3_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -390,7 +390,7 @@ static size_t __init gen3_stolen_size(int num, int slot, int func)
	return 0;
}

static size_t __init gen6_stolen_size(int num, int slot, int func)
static resource_size_t __init gen6_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -398,10 +398,10 @@ static size_t __init gen6_stolen_size(int num, int slot, int func)
	gmch_ctrl = read_pci_config_16(num, slot, func, SNB_GMCH_CTRL);
	gms = (gmch_ctrl >> SNB_GMCH_GMS_SHIFT) & SNB_GMCH_GMS_MASK;

	return (size_t)gms * MB(32);
	return gms * MB(32);
}

static size_t __init gen8_stolen_size(int num, int slot, int func)
static resource_size_t __init gen8_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -409,10 +409,10 @@ static size_t __init gen8_stolen_size(int num, int slot, int func)
	gmch_ctrl = read_pci_config_16(num, slot, func, SNB_GMCH_CTRL);
	gms = (gmch_ctrl >> BDW_GMCH_GMS_SHIFT) & BDW_GMCH_GMS_MASK;

	return (size_t)gms * MB(32);
	return gms * MB(32);
}

static size_t __init chv_stolen_size(int num, int slot, int func)
static resource_size_t __init chv_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -426,14 +426,14 @@ static size_t __init chv_stolen_size(int num, int slot, int func)
	 * 0x17 to 0x1d: 4MB increments start at 36MB
	 */
	if (gms < 0x11)
		return (size_t)gms * MB(32);
		return gms * MB(32);
	else if (gms < 0x17)
		return (size_t)(gms - 0x11 + 2) * MB(4);
		return (gms - 0x11) * MB(4) + MB(8);
	else
		return (size_t)(gms - 0x17 + 9) * MB(4);
		return (gms - 0x17) * MB(4) + MB(36);
}

static size_t __init gen9_stolen_size(int num, int slot, int func)
static resource_size_t __init gen9_stolen_size(int num, int slot, int func)
{
	u16 gmch_ctrl;
	u16 gms;
@@ -444,14 +444,15 @@ static size_t __init gen9_stolen_size(int num, int slot, int func)
	/* 0x0  to 0xef: 32MB increments starting at 0MB */
	/* 0xf0 to 0xfe: 4MB increments starting at 4MB */
	if (gms < 0xf0)
		return (size_t)gms * MB(32);
		return gms * MB(32);
	else
		return (size_t)(gms - 0xf0 + 1) * MB(4);
		return (gms - 0xf0) * MB(4) + MB(4);
}

struct intel_early_ops {
	size_t (*stolen_size)(int num, int slot, int func);
	phys_addr_t (*stolen_base)(int num, int slot, int func, size_t size);
	resource_size_t (*stolen_size)(int num, int slot, int func);
	resource_size_t (*stolen_base)(int num, int slot, int func,
				       resource_size_t size);
};

static const struct intel_early_ops i830_early_ops __initconst = {
@@ -531,12 +532,15 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
	INTEL_CNL_IDS(&gen9_early_ops),
};

struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0);
EXPORT_SYMBOL(intel_graphics_stolen_res);

static void __init
intel_graphics_stolen(int num, int slot, int func,
		      const struct intel_early_ops *early_ops)
{
	phys_addr_t base, end;
	size_t size;
	resource_size_t base, size;
	resource_size_t end;

	size = early_ops->stolen_size(num, slot, func);
	base = early_ops->stolen_base(num, slot, func, size);
@@ -545,8 +549,12 @@ intel_graphics_stolen(int num, int slot, int func,
		return;

	end = base + size - 1;
	printk(KERN_INFO "Reserving Intel graphics memory at %pa-%pa\n",
	       &base, &end);

	intel_graphics_stolen_res.start = base;
	intel_graphics_stolen_res.end = end;

	printk(KERN_INFO "Reserving Intel graphics memory at %pR\n",
	       &intel_graphics_stolen_res);

	/* Mark this space as reserved */
	e820__range_add(base, size, E820_TYPE_RESERVED);
+8 −8
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ static struct _intel_private {
	unsigned int needs_dmar : 1;
	phys_addr_t gma_bus_addr;
	/*  Size of memory reserved for graphics by the BIOS */
	unsigned int stolen_size;
	resource_size_t stolen_size;
	/* Total number of gtt entries. */
	unsigned int gtt_total_entries;
	/* Part of the gtt that is mappable by the cpu, for those chips where
@@ -333,13 +333,13 @@ static void i810_write_entry(dma_addr_t addr, unsigned int entry,
	writel_relaxed(addr | pte_flags, intel_private.gtt + entry);
}

static unsigned int intel_gtt_stolen_size(void)
static resource_size_t intel_gtt_stolen_size(void)
{
	u16 gmch_ctrl;
	u8 rdct;
	int local = 0;
	static const int ddt[4] = { 0, 16, 32, 64 };
	unsigned int stolen_size = 0;
	resource_size_t stolen_size = 0;

	if (INTEL_GTT_GEN == 1)
		return 0; /* no stolen mem on i81x */
@@ -417,8 +417,8 @@ static unsigned int intel_gtt_stolen_size(void)
	}

	if (stolen_size > 0) {
		dev_info(&intel_private.bridge_dev->dev, "detected %dK %s memory\n",
		       stolen_size / KB(1), local ? "local" : "stolen");
		dev_info(&intel_private.bridge_dev->dev, "detected %lluK %s memory\n",
		       (u64)stolen_size / KB(1), local ? "local" : "stolen");
	} else {
		dev_info(&intel_private.bridge_dev->dev,
		       "no pre-allocated video memory detected\n");
@@ -872,6 +872,8 @@ void intel_gtt_insert_sg_entries(struct sg_table *st,
		}
	}
	wmb();
	if (intel_private.driver->chipset_flush)
		intel_private.driver->chipset_flush();
}
EXPORT_SYMBOL(intel_gtt_insert_sg_entries);

@@ -1422,12 +1424,10 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
EXPORT_SYMBOL(intel_gmch_probe);

void intel_gtt_get(u64 *gtt_total,
		   u32 *stolen_size,
		   phys_addr_t *mappable_base,
		   u64 *mappable_end)
		   resource_size_t *mappable_end)
{
	*gtt_total = intel_private.gtt_total_entries << PAGE_SHIFT;
	*stolen_size = intel_private.stolen_size;
	*mappable_base = intel_private.gma_bus_addr;
	*mappable_end = intel_private.gtt_mappable_entries << PAGE_SHIFT;
}
+2 −1
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@
GVT_DIR := gvt
GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
	interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \
	execlist.o scheduler.o sched_policy.o render.o cmd_parser.o debugfs.o
	execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o debugfs.o \
	fb_decoder.o dmabuf.o

ccflags-y				+= -I$(src) -I$(src)/$(GVT_DIR)
i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
+2 −1
Original line number Diff line number Diff line
@@ -335,7 +335,8 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset,
	case INTEL_GVT_PCI_OPREGION:
		if (WARN_ON(!IS_ALIGNED(offset, 4)))
			return -EINVAL;
		ret = intel_vgpu_init_opregion(vgpu, *(u32 *)p_data);
		ret = intel_vgpu_opregion_base_write_handler(vgpu,
						   *(u32 *)p_data);
		if (ret)
			return ret;

Loading