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 1ABF6C77B78 for ; Wed, 12 Apr 2023 18:48:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBA4110E923; Wed, 12 Apr 2023 18:48:44 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8AE310E921 for ; Wed, 12 Apr 2023 18:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681325322; x=1712861322; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cXReASyCGIRFBIJA9auzndeQeIpGpVyujPCdBLdP7mw=; b=H9uSyYrGP2Yb+RtYuW6aLdpS1Fnfy+VSzG7+HNeVS7F2tsXuVvfX8x6G /6vvWiajGzGQ+Kq7xfRRyfH83i/prgx0/z7qifiWBzSMX0ylPTD0ctw+s xahq/IdoX0MRo0LDqzTp3aZ85hUVx/Phg1hUOV/7mqcDHrjLlTrOU8vyg YaaDVhJWeBxtoascvwMDvy33ssCNwZORtF1jRwigHBXbcK+lweVmqgPmv s1KjqvJOlIeffUfe3hAY9m4pH/kom6J5klHZvjCkHt0PhlCv49Kvxw3wb Qp499AYHtMN+gfR97VAvNJlnedY+FKTgMHAbf46gozmDTZ6mi8JS4paKM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="430276546" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="430276546" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 11:48:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="691638623" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="691638623" Received: from mdroper-desk1.fm.intel.com ([10.1.27.134]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 11:48:41 -0700 From: Matt Roper To: intel-xe@lists.freedesktop.org Date: Wed, 12 Apr 2023 11:48:34 -0700 Message-Id: <20230412184835.3157780-6-matthew.d.roper@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412184835.3157780-1-matthew.d.roper@intel.com> References: <20230412184835.3157780-1-matthew.d.roper@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH 5/6] 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: 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 --- 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 ee71b969bcbf..ac2151f28788 100644 --- a/drivers/gpu/drm/xe/xe_guc.c +++ b/drivers/gpu/drm/xe/xe_guc.c @@ -561,12 +561,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, REG_FIELD_PREP(ENGINE1_MASK, GUC_INTR_GUC2HOST)); - if (xe_gt_is_media_type(gt)) - xe_mmio_rmw32(gt, GUC_SG_INTR_MASK.reg, events, 0); - else - xe_mmio_write32(gt, GUC_SG_INTR_MASK.reg, ~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.reg, events, 0); } int xe_guc_enable_communication(struct xe_guc *guc) -- 2.39.2