From patchwork Tue Sep 30 10:05:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jike Song X-Patchwork-Id: 5001841 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9846BBEEA7 for ; Tue, 30 Sep 2014 10:11:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5BA4201B4 for ; Tue, 30 Sep 2014 10:11:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D07312017D for ; Tue, 30 Sep 2014 10:11:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C0EC6EBA6; Tue, 30 Sep 2014 03:11:42 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 905246E8A3 for ; Tue, 30 Sep 2014 03:11:40 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by fmsmga103.fm.intel.com with ESMTP; 30 Sep 2014 03:02:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,625,1406617200"; d="scan'208";a="480959939" Received: from kvmgt.bj.intel.com ([10.238.154.64]) by azsmga001.ch.intel.com with ESMTP; 30 Sep 2014 03:11:38 -0700 From: Jike Song To: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org Date: Tue, 30 Sep 2014 18:05:36 +0800 Message-Id: <1412071538-19059-7-git-send-email-jike.song@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412071538-19059-1-git-send-email-jike.song@intel.com> References: <1412071538-19059-1-git-send-email-jike.song@intel.com> Subject: [Intel-gfx] [RFC PATCH 6/8] drm/i915: redirect GTT accesses to vgt if enabled X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jike Song --- drivers/gpu/drm/i915/i915_drv.h | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 051442e..742fe8a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3077,27 +3077,54 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val); #define GTT_READ32(addr) \ ({ \ - u32 ret = readl(addr); \ - ret; \ + off_t reg = (unsigned long)(addr) - \ + (unsigned long)(dev_priv->gtt.gsm); \ + u32 __ret = 0; \ + if (i915.enable_vgt) \ + vgt_emulate_host_read(reg, &__ret, sizeof(u32), \ + true, false); \ + else \ + __ret = readl(addr); \ + __ret; \ }) #define GTT_READ64(addr) \ ({ \ - u64 ret = readq(addr); \ - ret; \ + off_t reg = (unsigned long)(addr) - \ + (unsigned long)(dev_priv->gtt.gsm); \ + u64 __ret = 0; \ + if (i915.enable_vgt) \ + vgt_emulate_host_read(reg, &__ret, sizeof(u64), \ + true, false); \ + else \ + __ret = readq(addr); \ + __ret; \ }) #define GTT_WRITE32(val, addr) \ ({ \ - writel((val), (addr)); \ + off_t reg = (unsigned long)(addr) - \ + (unsigned long)(dev_priv->gtt.gsm); \ + u32 __val = (val); \ + if (i915.enable_vgt) \ + vgt_emulate_host_write(reg, &__val, sizeof(u32), \ + true, false); \ + else \ + writel((val), (addr)); \ }) #define GTT_WRITE64(val, addr) \ ({ \ - writeq((val), (addr)); \ + off_t reg = (unsigned long)(addr) - \ + (unsigned long)(dev_priv->gtt.gsm); \ + u64 __val = (val); \ + if (i915.enable_vgt) \ + vgt_emulate_host_write(reg, &__val, sizeof(u64), \ + true, false); \ + else \ + writeq((val), (addr)); \ }) - /* "Broadcast RGB" property */ #define INTEL_BROADCAST_RGB_AUTO 0 #define INTEL_BROADCAST_RGB_FULL 1