From: Zhenyu Wang Subject: implement 'wait' instruction Date: Tue, 29 Jun 2010 11:04:09 +0800 Message-ID: <20100629030409.GG10521@zhen-devel.sh.intel.com> Reply-To: Zhenyu Wang Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0191572651==" Return-path: Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C9EC9E710 for ; Mon, 28 Jun 2010 20:04:11 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx List-Id: intel-gfx@lists.freedesktop.org --===============0191572651== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cf0hFtnykp6aONGL" Content-Disposition: inline --cf0hFtnykp6aONGL Content-Type: multipart/mixed; boundary="xHbokkKX1kTiQeDC" Content-Disposition: inline --xHbokkKX1kTiQeDC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 'Wait' instruction allows EU to stop and wait notification register state clear to continue the execution. And we can clear the notifications through MMIO, so we can track EU execution step by step. I use below patch for implement 'wait' in mesa, and attach 'intel_eu_cont.c' program to kick EU to continue. This is useful in debugging sandybridge for me. =46rom 34d96de16228013802ca577bb1007c5877ac5279 Mon Sep 17 00:00:00 2001 =46rom: Zhenyu Wang Date: Fri, 25 Jun 2010 16:05:24 +0800 Subject: [PATCH] i965: Add 'wait' instruction support When EU executes 'wait' instruction, it stalls and sets notification register state. Host can issue MMIO write to clear notification register state to allow EU continue on executing again. Signed-off-by: Zhenyu Wang --- src/mesa/drivers/dri/i965/brw_eu.h | 16 ++++++++++++++++ src/mesa/drivers/dri/i965/brw_eu_emit.c | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965= /brw_eu.h index a6fcd83..3a01000 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -520,6 +520,20 @@ static INLINE struct brw_reg brw_acc_reg( void ) 0); } =20 +static INLINE struct brw_reg brw_notification_1_reg(void) +{ + + return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE, + BRW_ARF_NOTIFICATION_COUNT, + 1, + BRW_REGISTER_TYPE_UD, + BRW_VERTICAL_STRIDE_0, + BRW_WIDTH_1, + BRW_HORIZONTAL_STRIDE_0, + BRW_SWIZZLE_XXXX, + WRITEMASK_X); +} + =20 static INLINE struct brw_reg brw_flag_reg( void ) { @@ -919,6 +933,8 @@ void brw_land_fwd_jump(struct brw_compile *p, =20 void brw_NOP(struct brw_compile *p); =20 +void brw_WAIT(struct brw_compile *p); + /* Special case: there is never a destination, execution size will be * taken from src0: */ diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri= /i965/brw_eu_emit.c index 34dfe10..10e9ebc 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -906,6 +906,20 @@ void brw_CMP(struct brw_compile *p, } } =20 +/* Issue 'wait' instruction for n1, host could program MMIO + to wake up thread. */ +void brw_WAIT (struct brw_compile *p) +{ + struct brw_instruction *insn =3D next_insn(p, BRW_OPCODE_WAIT); + struct brw_reg src =3D brw_notification_1_reg(); + + brw_set_dest(insn, src); + brw_set_src0(insn, src); + brw_set_src1(insn, brw_null_reg()); + insn->header.execution_size =3D 0; /* must */ + insn->header.predicate_control =3D 0; + insn->header.compression_control =3D 0; +} =20 =20 /*********************************************************************** --=20 1.7.0.4 --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --xHbokkKX1kTiQeDC Content-Type: text/x-csrc; charset=iso-8859-1 Content-Disposition: attachment; filename="intel_eu_cont.c" Content-Transfer-Encoding: quoted-printable /* * Copyright =A9 2009 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"= ), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH= ER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: * Zhenyu Wang * */ #define _GNU_SOURCE #include #include #include #include #include #include "intel_gpu_tools.h" static uint32_t devid; #define EU_ATT_CLR 0x7830 #define EU_ATT_CLR_2 0x7834 int main(int argc, char **argv) { struct pci_device *pci_dev; pci_dev =3D intel_get_pci_device(); devid =3D pci_dev->device_id; /* XXX not true when mapping! */ intel_get_mmio(pci_dev); printf("Clear EU wait attention.\n"); OUTREG(EU_ATT_CLR, 0xffffffff); OUTREG(EU_ATT_CLR_2, 0xffffffff); OUTREG(EU_ATT_CLR, 0); OUTREG(EU_ATT_CLR_2, 0); return 0; } --xHbokkKX1kTiQeDC-- --cf0hFtnykp6aONGL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkwpYqkACgkQsQQaM014GCfWgwCfaKN7AEUFp5f07FkKzvnQEp5a 4sEAnA/p2IGZrTgMANNDfjgITvivgdGW =DSh3 -----END PGP SIGNATURE----- --cf0hFtnykp6aONGL-- --===============0191572651== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0191572651==--