From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EF82EDE996 for ; Tue, 10 Sep 2024 01:39:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CE9C10E05C; Tue, 10 Sep 2024 01:39:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="EecDhhmu"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5257010E05C for ; Tue, 10 Sep 2024 01:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725932397; x=1757468397; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=04fFRC1QajYsXhtCzXfulrVBgcTMuBcE3EIz5t70mbQ=; b=EecDhhmuTiGA2GXh6T60hUnnFlQyn+UwUyak9Q+H2LKdufuLMTElYcAZ hyf0MenyUSkenf3yXSD98qnn7HnVmtM8u7oHKBHJfdJfSeXPvVhrHS4J7 nSLad7KrR7tJjgeR+/aKMX9s6mFmb6xZ24RwB4VFqW9t11YZIbR2u6KQZ 2fOpU1hptX053HGSb03Yvzei4NZfqKznSQkPTDvFYKvKpCMXZyGflSUTI WUgGVu+EUDHPswbPb7X/mHPrzbyLkh2XEzZ/rv9DU1PCcejBTMQ4aD9ss bTjRwzEI+FXkor5Xg15DI9G+/1rfANyM+eu6xN7GQVS0+bNi96dnXiKuK g==; X-CSE-ConnectionGUID: xMTWiE07R4ai14MR6rxlnA== X-CSE-MsgGUID: Y4vnwbzYTZK3WnPjuxvEUA== X-IronPort-AV: E=McAfee;i="6700,10204,11190"; a="24801758" X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="24801758" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 18:39:57 -0700 X-CSE-ConnectionGUID: CiSqYYUQRDCX2S8GSzCzyw== X-CSE-MsgGUID: tPazu8+0Rd6xMUorUA9Vzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,215,1719903600"; d="scan'208";a="66907854" Received: from orsosgc001.jf.intel.com ([10.165.21.138]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2024 18:39:56 -0700 From: Ashutosh Dixit To: intel-xe@lists.freedesktop.org Cc: Umesh Nerlige Ramappa Subject: [PATCH] drm/xe/oa: Insert wmb/sfence before enabling OA Date: Mon, 9 Sep 2024 18:39:48 -0700 Message-ID: <20240910013948.2665987-1-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" We are occasionally seeing that OA Buffer register is not programmed (has value 0) when OA is enabled. This means OA has been enabled before it has been fully configured. Or, the register write enabling OA has overtaken previous OA configuration register writes. Therefore, insert a wmb/sfence to preserve OA register write ordering before enabling OA. v2: s/wmb()/xe_device_wmb()/ Fixes: e936f885f1e9 ("drm/xe/oa/uapi: Expose OA stream fd") Reported-by: Guy Zadicario Signed-off-by: Ashutosh Dixit --- drivers/gpu/drm/xe/xe_oa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index 63286ed8457fa..4fb7aae37a94f 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -440,6 +440,9 @@ static void xe_oa_enable(struct xe_oa_stream *stream) val = __format_to_oactrl(format, regs->oa_ctrl_counter_select_mask) | __oa_ccs_select(stream) | OAG_OACONTROL_OA_COUNTER_ENABLE; + /* Flush previous writes to HW before enabling OA */ + xe_device_wmb(stream->oa->xe); + xe_mmio_write32(stream->gt, regs->oa_ctrl, val); } -- 2.41.0