From patchwork Tue Feb 28 21:58:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Argenziano X-Patchwork-Id: 9597005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A39E4600CB for ; Tue, 28 Feb 2017 21:58:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 968DD284FF for ; Tue, 28 Feb 2017 21:58:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B81F28595; Tue, 28 Feb 2017 21:58:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36A29284FF for ; Tue, 28 Feb 2017 21:58:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0EDF6E801; Tue, 28 Feb 2017 21:58:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 187346E801 for ; Tue, 28 Feb 2017 21:58:52 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 28 Feb 2017 13:58:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,221,1484035200"; d="scan'208";a="829474849" Received: from relo-linux-2.fm.intel.com ([10.1.27.122]) by FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2017 13:58:42 -0800 From: Antonio Argenziano To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Feb 2017 13:58:23 -0800 Message-Id: <20170228215824.6423-1-antonio.argenziano@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] lib/intel_batchbuffer: Add secure batch buffer flushing on ring X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP Added functions for flushing a batch buffer as privileged. Signed-off-by: Antonio Argenziano --- lib/intel_batchbuffer.c | 45 +++++++++++++++++++++++++++++++++++++++++---- lib/intel_batchbuffer.h | 4 +++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index f1353901..38ce3b69 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -158,15 +158,35 @@ flush_on_ring_common(struct intel_batchbuffer *batch, int ring) } /** - * intel_batchbuffer_flush_on_ring: + * intel_batchbuffer_flush_on_ring_secure: * @batch: batchbuffer object * @ring: execbuf ring flag * * Submits the batch for execution on @ring. */ void -intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int ring) +intel_batchbuffer_flush_on_ring_secure(struct intel_batchbuffer *batch, int ring) +{ + int flags = 0; + + flags |= ring; + flags |= I915_EXEC_SECURE; + + intel_batchbuffer_flush_on_ring(batch, flags); + +} + +/** + * intel_batchbuffer_flush_on_ring: + * @batch: batchbuffer object + * @flags: execbuf ring flag, plus additional submission flags + * + * Submits the batch for execution on the engine set in @flags. + */ +void +intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int flags) { + int ring = flags & I915_EXEC_RING_MASK; unsigned int used = flush_on_ring_common(batch, ring); drm_intel_context *ctx; @@ -179,9 +199,10 @@ intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int ring) /* XXX bad kernel API */ ctx = batch->ctx; - if (ring != I915_EXEC_RENDER) + if ((ring) != I915_EXEC_RENDER) ctx = NULL; - do_or_die(drm_intel_gem_bo_context_exec(batch->bo, ctx, used, ring)); + + do_or_die(drm_intel_gem_bo_context_exec(batch->bo, ctx, used, flags)); intel_batchbuffer_reset(batch); } @@ -224,6 +245,22 @@ intel_batchbuffer_flush_with_context(struct intel_batchbuffer *batch, } /** + * intel_batchbuffer_flush_secure: + * @batch: batchbuffer object + * + * Submits the batch, as a secure batch, for execution on the blitter engine, + * selecting the right ring depending upon the hardware platform. + */ +void +intel_batchbuffer_flush_secure(struct intel_batchbuffer *batch) +{ + int ring = 0; + if (HAS_BLT_RING(batch->devid)) + ring = I915_EXEC_BLT; + intel_batchbuffer_flush_on_ring_secure(batch, ring); +} + +/** * intel_batchbuffer_flush: * @batch: batchbuffer object * diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index 869747db..0ed2055a 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -35,7 +35,9 @@ void intel_batchbuffer_free(struct intel_batchbuffer *batch); void intel_batchbuffer_flush(struct intel_batchbuffer *batch); -void intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int ring); +void intel_batchbuffer_flush_secure(struct intel_batchbuffer *batch); +void intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int flags); +void intel_batchbuffer_flush_on_ring_secure(struct intel_batchbuffer *batch, int ring); void intel_batchbuffer_flush_with_context(struct intel_batchbuffer *batch, drm_intel_context *context);