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 C3C4DE81817 for ; Tue, 26 Sep 2023 04:19:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6159310E34B; Tue, 26 Sep 2023 04:19:07 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C48D10E34B for ; Tue, 26 Sep 2023 04:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695701944; x=1727237944; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=FDPl7a1E8Ho8uFqp0Msv3OFE8kCP6o9lNAyIEqshlbs=; b=kzVcKVYtRM6v8KoQeMN/60OvQxjFGUaFQiP6mKLlB54/4cbuhpjvFRIg bIIfmjXz+6gUrrfI7S2ZKq3EuZqE8JTwI3SkJnImPQrKQbK67wgbWqg+g jRMtOe4++7hl3CeuKZpExCzbDpIIefPp2WRGP0Qk542p+raZmsO7QuIY9 YYBNwuhOQwxh+KNYuGrUuDQa6pXM2Bq8KBAXdbMrV/4Bih3SdLS2pboTH Ut/CRrUI1mvu3VPVPVUsn9TMM/V7ppQ3akqSl882RjRCmTgFgTRGrWMJm S4FiuDpJWyPnObLnzuPDFLrWf6VvQKdThDYhcxMtVHJGupmISnF+YyJrW w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="360857250" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="360857250" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 21:19:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="864262227" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="864262227" Received: from aravind-dev.iind.intel.com (HELO [10.145.162.146]) ([10.145.162.146]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 21:19:02 -0700 Message-ID: <9d63f599-3cf5-f1c4-8ade-a4a808c78cd2@linux.intel.com> Date: Tue, 26 Sep 2023 09:51:49 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Himal Prasad Ghimiray , intel-xe@lists.freedesktop.org References: <20230823085842.1440523-1-himal.prasad.ghimiray@intel.com> <20230823085842.1440523-5-himal.prasad.ghimiray@intel.com> From: Aravind Iddamsetty In-Reply-To: <20230823085842.1440523-5-himal.prasad.ghimiray@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Intel-xe] [PATCH v5 4/4] drm/xe: Process fatal hardware errors. 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: Matt Roper , Rodrigo Vivi Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On 23/08/23 14:28, Himal Prasad Ghimiray wrote: > Fatal errors are reported as PCIe errors. When a PCIe error is asserted, > the OS will perform a device warm reset which causes the driver to reload. > The error registers are sticky and the values are maintained through a > warm reset. We read these registers during the boot flow of the driver and > increment the respective error counters. > > Bspec: 53076 please mention 50875 as well. > > Cc: Rodrigo Vivi > Cc: Aravind Iddamsetty > Cc: Matthew Brost > Cc: Matt Roper > Cc: Joonas Lahtinen > Signed-off-by: Himal Prasad Ghimiray > --- > drivers/gpu/drm/xe/regs/xe_regs.h | 3 +++ > drivers/gpu/drm/xe/xe_hw_error.c | 37 ++++++++++++++++++++++++++++++- > drivers/gpu/drm/xe/xe_hw_error.h | 3 ++- > drivers/gpu/drm/xe/xe_irq.c | 2 +- > 4 files changed, 42 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/xe/regs/xe_regs.h b/drivers/gpu/drm/xe/regs/xe_regs.h > index e223975a5acf..b8f2b1762d3f 100644 > --- a/drivers/gpu/drm/xe/regs/xe_regs.h > +++ b/drivers/gpu/drm/xe/regs/xe_regs.h > @@ -90,5 +90,8 @@ > #define GT_DW_IRQ(x) REG_BIT(x) > #define XE_ERROR_IRQ(x) REG_BIT(26 + (x)) > > +#define DEV_PCIEERR_STATUS XE_REG(0x100180) > +#define DEV_PCIEERR_IS_FATAL(x) REG_BIT(x * 4 + 2) place it as per the address. > + > #define PVC_RP_STATE_CAP XE_REG(0x281014) > #endif > diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c > index deb020a509d2..9595e3369656 100644 > --- a/drivers/gpu/drm/xe/xe_hw_error.c > +++ b/drivers/gpu/drm/xe/xe_hw_error.c > @@ -183,7 +183,7 @@ static const struct err_msg_cntr_pair err_stat_gt_correctable_vectr_reg[] = { > [2 ... 3] = {"L3BANK", XE_GT_HW_ERR_L3BANK_CORR}, > }; > > -void xe_assign_hw_err_regs(struct xe_device *xe) > +static void xe_assign_hw_err_regs(struct xe_device *xe) change it in the patch that introduced it. > { > const struct err_msg_cntr_pair **dev_err_stat = xe->hw_err_regs.dev_err_stat; > const struct err_msg_cntr_pair **err_stat_gt = xe->hw_err_regs.err_stat_gt; > @@ -417,3 +417,38 @@ xe_hw_error_irq_handler(struct xe_tile *tile, const u32 master_ctl) > xe_hw_error_source_handler(tile, hw_err); > } > } > + > +/** > + * process_hw_errors - checks for the occurrence of HW errors > + * > + * This checks for the HW Errors including FATAL errors that might > + * have occurred in the previous boot of the driver which will > + * initiate PCIe FLR reset of the device and cause the this is not right, in fact it is better to rephrase as: "fatal will result in a card warm reset and driver will be reloaded." > + * driver to reload. > + */ > +void xe_process_hw_errors(struct xe_device *xe) > +{ > + struct xe_tile *root_tile = xe_device_get_root_tile(xe); > + struct xe_gt *root_mmio = root_tile->primary_gt; > + > + u32 dev_pcieerr_status, master_ctl; > + struct xe_tile *tile; > + int i; > + > + xe_assign_hw_err_regs(xe); lets still have this in xe_irq_install, as it serves for a different purpose. > + > + dev_pcieerr_status = xe_mmio_read32(root_mmio, DEV_PCIEERR_STATUS); > + > + for_each_tile(tile, xe, i) { > + struct xe_gt *mmio = tile->primary_gt; > + > + if (dev_pcieerr_status & DEV_PCIEERR_IS_FATAL(i)) > + xe_hw_error_source_handler(tile, HARDWARE_ERROR_FATAL); > + > + master_ctl = xe_mmio_read32(mmio, GFX_MSTR_IRQ); > + xe_hw_error_irq_handler(tile, master_ctl); > + xe_mmio_write32(mmio, GFX_MSTR_IRQ, master_ctl); > + } > + if (dev_pcieerr_status) > + xe_mmio_write32(root_mmio, DEV_PCIEERR_STATUS, dev_pcieerr_status); > +} > diff --git a/drivers/gpu/drm/xe/xe_hw_error.h b/drivers/gpu/drm/xe/xe_hw_error.h > index 3fcbbcc338fe..2812407dd4bf 100644 > --- a/drivers/gpu/drm/xe/xe_hw_error.h > +++ b/drivers/gpu/drm/xe/xe_hw_error.h > @@ -104,5 +104,6 @@ struct xe_device; > struct xe_tile; > > void xe_hw_error_irq_handler(struct xe_tile *tile, const u32 master_ctl); > -void xe_assign_hw_err_regs(struct xe_device *xe); > +void xe_process_hw_errors(struct xe_device *xe); > + > #endif > diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c > index 48b933234342..be152ebd6ce9 100644 > --- a/drivers/gpu/drm/xe/xe_irq.c > +++ b/drivers/gpu/drm/xe/xe_irq.c > @@ -573,7 +573,7 @@ int xe_irq_install(struct xe_device *xe) > return -EINVAL; > } > > - xe_assign_hw_err_regs(xe); > + xe_process_hw_errors(xe); this shall be called before xe_irq_reset. > > xe->irq.enabled = true; > Thanks, Aravind.