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 C0B97C87FE4 for ; Tue, 30 May 2023 21:16:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 99DF210E447; Tue, 30 May 2023 21:16:21 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64F0910E43B for ; Tue, 30 May 2023 21:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685481371; x=1717017371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NBlOTvEdqeNQS1bCbCDzstnVpeZ/EUpbxuMHMN5CMhM=; b=YBHWTJNO7HAEAW63BRsiLQXf8ebeaXbLJUPWwQ+S3i/v7j1/4yKesgQP kBEktKiVTIHpWUeDKJWbTQvJiyVurPrts95gsrAUZwBl2MV5tx6kYU409 8Mhe0Gze9WbbSCTYx9MUBvIuXfMM+uL3xvUL1DqunDsLHdkplJWCpWln3 8VEHajXjtQ0raSL+jP8LuMZUnk9l9x8cjYPavuCXNBHwwiK/wiFv7tlJS 4nnK5I8zfqO4G6wONPK+7J9z6H2l4GapVUd5oks8nvf+EFfCvTvN6Cwgb 02rXCnEsgUKRJNeuON0H08V+kzNCBPiaZFIxNtpARakiuPZKTH+LlEbNO w==; X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="383311962" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="383311962" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 14:16:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10726"; a="684139468" X-IronPort-AV: E=Sophos;i="6.00,205,1681196400"; d="scan'208";a="684139468" Received: from mdroper-desk1.fm.intel.com ([10.1.27.134]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 14:16:10 -0700 From: Matt Roper To: intel-xe@lists.freedesktop.org Date: Tue, 30 May 2023 14:15:41 -0700 Message-Id: <20230530211549.2632538-24-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230530211549.2632538-1-matthew.d.roper@intel.com> References: <20230530211549.2632538-1-matthew.d.roper@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH v3 23/31] drm/xe/irq: Ensure primary GuC won't clobber media GuC's interrupt mask 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: , Cc: Lucas De Marchi , matthew.d.roper@intel.com Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Although primary and media GuC share a single interrupt enable bit, they each have distinct bits in the mask register. Although we always enable interrupts for the primary GuC before the media GuC today (and never disable either of them), this might not always be the case in the future, so use a RMW when updating the mask register to ensure the other GuC's mask doesn't get clobbered. Signed-off-by: Matt Roper Reviewed-by: Lucas De Marchi --- drivers/gpu/drm/xe/xe_guc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c index ecc843d91f62..04a57af85d9e 100644 --- a/drivers/gpu/drm/xe/xe_guc.c +++ b/drivers/gpu/drm/xe/xe_guc.c @@ -532,12 +532,15 @@ static void guc_enable_irq(struct xe_guc *guc) REG_FIELD_PREP(ENGINE0_MASK, GUC_INTR_GUC2HOST) : REG_FIELD_PREP(ENGINE1_MASK, GUC_INTR_GUC2HOST); + /* Primary GuC and media GuC share a single enable bit */ xe_mmio_write32(gt, GUC_SG_INTR_ENABLE, REG_FIELD_PREP(ENGINE1_MASK, GUC_INTR_GUC2HOST)); - if (xe_gt_is_media_type(gt)) - xe_mmio_rmw32(gt, GUC_SG_INTR_MASK, events, 0); - else - xe_mmio_write32(gt, GUC_SG_INTR_MASK, ~events); + + /* + * There are separate mask bits for primary and media GuCs, so use + * a RMW operation to avoid clobbering the other GuC's setting. + */ + xe_mmio_rmw32(gt, GUC_SG_INTR_MASK, events, 0); } int xe_guc_enable_communication(struct xe_guc *guc) -- 2.40.1