From patchwork Fri May 21 20:41:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12273743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B2EC4707E for ; Fri, 21 May 2021 20:41:43 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7B2FD61028 for ; Fri, 21 May 2021 20:41:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B2FD61028 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C1526F900; Fri, 21 May 2021 20:41:41 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E02B6F8FF; Fri, 21 May 2021 20:41:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILaGWG0CePYgCYlHkbmZwaYR4aJsYUjPUqgrLUC7YoxOHrvEaUQztoTWZJhbnmrafM27PoZg4Bab8Q5BRFrNclh+eKg5ralVtnonCUUFmt0JSxkZeQDH0Z/bGdwSvN2epTHj83BaV5S85rx3k4Wu1Q9mFJEPSLfMxhNdVjG41ALBYbVx1z5GdnP0U8ZLvCIrfHnXcB5ecgcKtTLmyFAS38VLaZFLDkw8SritLvu1ooDuMbPhL0QRlX8eZwomzu+OsbYl+FQi7g/Rfy+/K74EOvdkfP1SUefbL2bgoJP9Hlqz5rcWV/BwbiIcuIR9HYznrT3yXcY+UHxlrUKo9pHfYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FqQDIJAQl+HRCXA1R6eb263jcSWsPPdpMtygOEShuwg=; b=g6pKcvEwtsLlYFDOZY2rKs51q6CQRLWips3RG1XyeUoZavy7n8vfgxTooL48XhXZvOTLKS8iGGz8IlXtUS4TgZnXz1Id7mElCaNRdqad1Cn3KcRVmcYF3nApjAGt1g4ABklCdUOyrC7+FfpqnzdAGfKEZ6T6qOjeSAs1mRxkKbhtxn+9DugakycZWlgLHgoeRFV8zk4ifBY0d6cJ1bPhP/099qBmzPDs8lj58I2L0LViCiwOjtoXSfuH22n+paq7oBGB5r0OyUUzxcWu/lK1D10028e/OOK2eJtVV9ogfbrlbImEqDac+N6NKDe+1QB0v0/mc324oQCy9FadpsQk1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FqQDIJAQl+HRCXA1R6eb263jcSWsPPdpMtygOEShuwg=; b=X2SN38ipRMWBfzoC+PKsb4TRonQ6oKIKfe7HZyUjR/N1xf8MtXqWpcwkdy4pAxOVBt1zgAF5Bu4q4dpxLs1eUprdkdBeWwGB9DY+rxzfblnMvSWrtV3exJT10D1toYJsAWRCKZl6Gp/u25Vpv3hevTyORjjZjQue8KewcxgR1JY= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from BYAPR12MB4615.namprd12.prod.outlook.com (2603:10b6:a03:96::21) by BY5PR12MB4952.namprd12.prod.outlook.com (2603:10b6:a03:1d8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Fri, 21 May 2021 20:41:36 +0000 Received: from BYAPR12MB4615.namprd12.prod.outlook.com ([fe80::58e2:2ca1:afbc:5122]) by BYAPR12MB4615.namprd12.prod.outlook.com ([fe80::58e2:2ca1:afbc:5122%7]) with mapi id 15.20.4129.035; Fri, 21 May 2021 20:41:36 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com Subject: [PATCH v2 1/2] drm/amdgpu: Rename flag which prevents HW access Date: Fri, 21 May 2021 16:41:21 -0400 Message-Id: <20210521204122.762288-1-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 X-Originating-IP: [2607:fea8:3edf:49b0:b74b:1af9:3eb:e31d] X-ClientProxiedBy: YT1PR01CA0051.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::20) To BYAPR12MB4615.namprd12.prod.outlook.com (2603:10b6:a03:96::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from agrodzovsky-All-Series.hitronhub.home (2607:fea8:3edf:49b0:b74b:1af9:3eb:e31d) by YT1PR01CA0051.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31 via Frontend Transport; Fri, 21 May 2021 20:41:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d74fb4ff-9d2c-45b1-d3ae-08d91c98d2f5 X-MS-TrafficTypeDiagnostic: BY5PR12MB4952: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eCsNMm0bvfgIE6V5a/jwI1AjQ4BoJ9sQMCRur9WIaRqtNsYs2Bx9YfupBU7RjfiTe5d6VuE9TJGUiOys3BGld7ZI+nytA73CW846sMnCZzacj6TPmJN+FC6TVdxkw756bang9vIR9lBSKKQoQjr2dlZqv/M6r1no4+Y0PkNycnlozVyrEsoq1VnT9qKJjqZGGEvapPxiN9U4cHEzNI0T3urFRx69psMEeYKjUXuZbPU0Puu/OTK7FiRBDyOL4ko9gfS4K5Cp+CsdOn2YlW5Y4OujLW3lx7u1PMyH0YtR6EThKzT5yhrOXNa8QGr1tZfF5jV7D/o25YXYq6rDUH5umCpTagIBNTZ9NgJY04ji731v9RzpvdmyxVDIR4oS4zKVgt12RQCMztBcxRriXI2oshzGriOPkBsVItcA6KiiA4lkW4w6lceBkR3xErgCAoMyxs+RaFRgSiX3xWbdv3AX2wKjlQAeq6ru/fEog7uIpV8zU7mMuz35b9Rv/UMUFLsaBiUhbqCl6rn0s0o91yXQxF6GYttYAit8TdRgkz7hefXiERgAWaxT1RzKf9A9JJ1MjZiKvpdFpgD+qjSsjcAXlezySugINUptWDRbcBGc4hM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR12MB4615.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(366004)(376002)(136003)(396003)(186003)(16526019)(8676002)(2616005)(316002)(52116002)(86362001)(36756003)(6666004)(8936002)(44832011)(6636002)(83380400001)(2906002)(478600001)(4326008)(5660300002)(38100700002)(6506007)(66946007)(66556008)(66476007)(1076003)(6512007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wxmsRkHu+VVAJQzSHhtujwAgRqVixArDG2ylPTZ4bOAOGh6NG9cbNmCtHwKa/FbFbxR4IKgT3/lOvrse1/Z75S4hivveZgrzzkUgkIjPF6MZ2CyfLr5WtwodYUUp1HzmjY66vFCGmzqv3f4z/lAm2fD1jXOthCdNCbBlcTNxUt03jtC1TbxGPltj7wbu4P5rodn4j9bCQNkEsYFp6BpT+kWat5lDIJ4iCrsf8b6f6S3bxsQVJh0q2wbMeno2/g1pzCu01jQFExCsJykTKpMNuNvO3KbHl6vwjUMWZUJG21q/k7qfrsLQG3E8RUmTEvrQ2DKvAA+suTXYCzXPKrxDU8XyjwosESoTYPjTzweR2M0sJ/MpokgEE8fdDbR6bxZZU5I4F6Gsh+GhRU/ZQKcdI7GCUlINmIRf1D0QeStt+kNIAwVep83uHljkUWa2IPCTy3jV3IzTTxlsyj6gkSTeycJBaTvSQis6itS+d7OLSZevksaetzwGHx1iz2QaOjVZ6kRFlB9Bo7YWLZA3z2ERd/28yKH9fvglHmRwqbW8tQAeOhmc70hSJzVEop80twNDaDVqKKCrhNMBikyeWisNn4EH4QmtvAb7sqVJPgaXYdVWuj9S+agEXH5C5H5PcTWSjii8resUcY7/FZKmLzS3r5FebpazOSCbFVeHUSfD8V+aHPno1Xy4MhZy6dLb7zR7/a0eAbtqpnEd8UP9+qVShiufXoFuIiJUey5u98oZn7BOLfCWAC9uSzxY0QaQwv5xdE7Y6blaJXN+QYFa/StirpAGAsIDy3MwnmlsGeF4Hsbp8hk932YvJz9y4xsoRf8NZNR0HR09g8+cIYaELaNkT48m6q8UVX7fnyVO6vK5rbpcEMKejp237Cb0ayixUPtHhKsVb9mSGeveWkbSRbPPaFriDXGkO1CvvuuvEPXkOldoEKzS+pKwxsaf1FIVBzNKF5E2NR56rkEfLkbwwbiVbgCkVAUsT1IHXbxTJrQdgvjFO2WeNXN/xrsEwOqCmzoVLc+g2Qzxnp09VrFFpaIJ7lmejVlkyq0kpP7g1H8z29t+l3ZjUNCD7wPeHi8fNlHq99LpyyH43zn+yxR5+ek0TqlFIK/ZvHR1G+DWDebdoyMoHWnkVTGCRkYJOIs3VsOd2z6Wjs6DnI1Emh7Zhss21TZP4zD+BgjK+jvdYfpqUCv7laaZQs8py4goZDvPC4sI1btP3LF6sm8RGDOXriMfj/k0W+4UU+kD4jfi6oHoHIRHB1VipNvVM9ZuhcYn5fmV5lbB/7NnahAfCk/Tm5l1ZXp9JfSIp0dCA/T7QUKUVpTHfv41SJjHXLcuqoDV1cR8u3HvK9SKsV4fatRPyZdjDnjmStqADgLsBoW/YTA/4zItsFZ4deVIl2vvPuwkbzP9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d74fb4ff-9d2c-45b1-d3ae-08d91c98d2f5 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB4615.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 20:41:35.5914 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xa0Md7OXFheNvotsUOXgVXbMPkX9iSdiqNMaZFa2Am815qGI4sZpxmVq2A6AJ8OLn07z8prifPZTkvmO5OqjTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4952 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ckoenig.leichtzumerken@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Make it's name not feature but function descriptive. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index d830a541ba89..d0e557cb5f1d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1076,7 +1076,7 @@ struct amdgpu_device { struct ratelimit_state throttling_logging_rs; uint32_t ras_features; - bool in_pci_err_recovery; + bool no_hw_access; struct pci_saved_state *pci_state; struct amdgpu_reset_control *reset_cntl; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index bf5055642b82..60e945471a54 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -340,7 +340,7 @@ void amdgpu_device_vram_access(struct amdgpu_device *adev, loff_t pos, /* Check if hw access should be skipped because of hotplug or device error */ bool amdgpu_device_skip_hw_access(struct amdgpu_device *adev) { - if (adev->in_pci_err_recovery) + if (adev->no_hw_access) return true; #ifdef CONFIG_LOCKDEP @@ -5335,9 +5335,9 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev) set_bit(AMDGPU_NEED_FULL_RESET, &reset_context.flags); set_bit(AMDGPU_SKIP_HW_RESET, &reset_context.flags); - adev->in_pci_err_recovery = true; + adev->no_hw_access = true; r = amdgpu_device_pre_asic_reset(adev, &reset_context); - adev->in_pci_err_recovery = false; + adev->no_hw_access = false; if (r) goto out; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index baa7d9778583..ce1577687ac2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -232,7 +232,7 @@ int psp_wait_for(struct psp_context *psp, uint32_t reg_index, int i; struct amdgpu_device *adev = psp->adev; - if (psp->adev->in_pci_err_recovery) + if (psp->adev->no_hw_access) return 0; for (i = 0; i < adev->usec_timeout; i++) { @@ -261,7 +261,7 @@ psp_cmd_submit_buf(struct psp_context *psp, bool ras_intr = false; bool skip_unsupport = false; - if (psp->adev->in_pci_err_recovery) + if (psp->adev->no_hw_access) return 0; if (!drm_dev_enter(&psp->adev->ddev, &idx)) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 2408ed4c7d84..540fedf787c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -7332,7 +7332,7 @@ static int gfx_v10_0_hw_fini(void *handle) amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0); amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0); - if (!adev->in_pci_err_recovery) { + if (!adev->no_hw_access) { #ifndef BRING_UP_DEBUG if (amdgpu_async_gfx_ring) { r = gfx_v10_0_kiq_disable_kgq(adev); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c index dc7d2e71aa6f..9526b46582c8 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c @@ -126,7 +126,7 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, struct amdgpu_device *adev = smu->adev; int ret = 0, index = 0; - if (smu->adev->in_pci_err_recovery) + if (smu->adev->no_hw_access) return 0; index = smu_cmn_to_asic_specific_index(smu, From patchwork Fri May 21 20:41:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12273745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BE3C4707E for ; Fri, 21 May 2021 20:41:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 934C760249 for ; Fri, 21 May 2021 20:41:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 934C760249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 294486F903; Fri, 21 May 2021 20:41:42 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E12E6F900; Fri, 21 May 2021 20:41:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CkFHtF9dscfdRQIsWJaz9iRg6HSuwVB8IjZrgPqDC4Zg+nAlshMurYP9P1cC1ePqKX5Za/gNwfLfMThcYX4mbsBVXzNQIIeDq5lgEHL5hVPovNKX/y+O6yjvexYuKLrlJkta5mSleCYKDm2HtSNVOUmtFAC2rNgpGRXfY50jmZaanZGX3jvnlfN4sQmriNCt5X4eEl0HtA4/FOgS9iVMGSY0qZQA1/Y0DtXX4NiPbHzEpgEK2gR8yi0za9qQUxz701FPx6vw+fKQfcDFEix7JgJHWeua1zSSlB7PbssePXVIFFR7kAnakNmqYaR4CenXqP9psVgEXpRKSRLwyY+IAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r9oz8lvo2ZAotg1LCkHFN3+2/gQ0v7HObxdJcmBdHk0=; b=IZd2qS0QNSh4NQfU1eQzAnbmc4YVsb4Uo8rFH2lYZjviFu9lGu1XXtFI+UlbyFuew19OckGOp4cs1V7HQ1gLVqrDLodYLJzEy/6L3a/7BDLaLu8TSfGgnFjJ7CzU6d1mae1r3MsB3yBdQgqttcLQMTzxu6TaIUAfNDAMjwIJnl9/tSSjploUIuIgWWHbDm3sOTCRlI/bjEk6NT6xeAdhhGwy+VR2XTJzT2kbI9SktJhNH7UL608kNUvqXxchIW3t1Vb3oS8aQFzCVaq8lBQW9Uz7wjDjZKJIAUuFpehZWq+crGBGmmcmuAPvwkMf5IB64MTXweBPqnkGePUi56CV2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r9oz8lvo2ZAotg1LCkHFN3+2/gQ0v7HObxdJcmBdHk0=; b=bUkALW8aM6iol4SYbUh52UpnrO7yaHPm3wyn8FrIEbt0Qdrkk0HM7fA7CkBDSeFqJrxigEjezPNsXii/4JxOH4nzL9T2uzfaoYnDWsQ+hwKa+uvvozCcHafrz+9RUiD1lznS+JhiRkgt6WES09QPEtYSzbr7xZ3Z98m/UN1pnus= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from BYAPR12MB4615.namprd12.prod.outlook.com (2603:10b6:a03:96::21) by BY5PR12MB4952.namprd12.prod.outlook.com (2603:10b6:a03:1d8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Fri, 21 May 2021 20:41:39 +0000 Received: from BYAPR12MB4615.namprd12.prod.outlook.com ([fe80::58e2:2ca1:afbc:5122]) by BYAPR12MB4615.namprd12.prod.outlook.com ([fe80::58e2:2ca1:afbc:5122%7]) with mapi id 15.20.4129.035; Fri, 21 May 2021 20:41:39 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com Subject: [PATCH v2 2/2] drm/amdgpu: Fix crash when hot unplug in BACO. Date: Fri, 21 May 2021 16:41:22 -0400 Message-Id: <20210521204122.762288-2-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210521204122.762288-1-andrey.grodzovsky@amd.com> References: <20210521204122.762288-1-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:b74b:1af9:3eb:e31d] X-ClientProxiedBy: YT1PR01CA0051.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::20) To BYAPR12MB4615.namprd12.prod.outlook.com (2603:10b6:a03:96::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from agrodzovsky-All-Series.hitronhub.home (2607:fea8:3edf:49b0:b74b:1af9:3eb:e31d) by YT1PR01CA0051.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31 via Frontend Transport; Fri, 21 May 2021 20:41:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97bc0949-ed5d-4768-6918-08d91c98d57c X-MS-TrafficTypeDiagnostic: BY5PR12MB4952: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0tqLAZ3Hr5SV4HDztPlKXjZ/96/Ad2hLz8xIQA6n/5OsFIm3+LygNBBg32Nr/RrVnM5zV/hfsBuwSq4+5/bS+0KwZNqrTvZdYF/N6wu07FarGTJ/wnUPmUrxh6B6pkmHo0hnsroj4HueKjhHmypW8aI7X0NeQLSISG7ybhvIoh5nYe+YhMjqtmc/mPDeWF51Qb5ATAX9jiyu5laVz4vYdwCEPek3JXKM2oKV+KrGTRIKpEkwccA6dGKxl/6hXioczl5LBOVl1E7iw///7X+noWGGoFmN26Wt4riHpK6PuGph2sbqr1/B7gU6goQt0b9Gj8ceD064JRRb6sqU2RgQZTENEvA1NEMDG+hrz3Bz4W/3IsR3uVBsIcFq4PtQ0cHYhx1v8gx1JTPAea3NBRJpn7tjU73SLO1YthbdMA3TKeha/GzDSKsnBf1KkEuaN0px+jB+UEQMXO5/pUqj3lW5ns8wu1JHAuxjdGH4O/4Rl9GLEgSF66gWOpf2kTYn83DwRX1nPiIpayTWOPlxQzgQ6qPRpPJY7nLXPefWX1Mdh640FF/k343vxObxXXZNx+UTalHIe3C3U7T8c86AyxQioBOA25fqjZQvdn51VR2Kp2IAG6RKK/OmMotVLRmw6Tsr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR12MB4615.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(366004)(376002)(136003)(396003)(186003)(16526019)(966005)(8676002)(2616005)(316002)(52116002)(86362001)(36756003)(6666004)(8936002)(44832011)(6636002)(83380400001)(2906002)(478600001)(4326008)(5660300002)(38100700002)(6506007)(66946007)(66556008)(66476007)(1076003)(6512007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 62F5nuCimLHIbThMYN/wziq8NC+2A2w/ujuwFgFLKxHSHwDZknXBwuHLkvBH0+dTWbO2VUWEGDFoxd9k8MpxMRLAO0N5tDkAfa1+BYtS5Tj4ye7DJQF2Y3VY/wMDkPHCy0m0GJdILC4RL4d1xJjI1JNSZAJXh1TYr+qBjmV+L3KozzgEYPZPC6gI32GfI5YWSvN+shvZbGh+pShck9qFeoby4sO2dnCWGT/kD2DV5DVGUd1Pd1xZdGUTLbvyl5lfB/TGoj3CjqL7WO37FiU4bkhs0j8V7gbuz5tcTc31kfuEHhP93JWHEsSBXoWNM/vkrY38pwyUk2QG4A9FAo78SxbiTSw6WBFkjC/znlxLuS/M8Jbt9VPJyfYT9ZElcy/c5GuTarXUAR/UwK3fSRE0852BWoMJN1UV8jjY/KUbH3CD4hgU0svMuGROrix5qT5yUmrGha7xR++lCidTbX+qbjd5QnZvgGzqYOkDK+hh1fXusCQO/J/ihukhuyo1eJPmmjbjpEgtNkDZSWheyRGF8Tr2V5sdI7851WzCiziz0HtV5S1hzLxNYOmHS/cfU06IIgDNtkM0B/WPjuEtxvuDorHM/eQNgDNwT7NMHtfEbCVEA4RUkqU5MnIm/aIGgx4MOsRquhrDRjzrr9V4txHkrCeadXce2xLtGctF/Iy6jv+NpqPNTu+J6SI2R8bUtEXv/UgPzLo5oOh2bSEbSDz+GU3GJy0DrNIzb54gaJQ6GwmuWiB0zdkJfGiEAceLJUvYxQVH+yOUWNA7MWXKHccsuzEwT7ksN74YmAclmfrOz+9dLDQ743uk3yg+UtWvrMFF6LjgDoZ/d7Xk1/lcMbnwdmhM1+quw7G5xva2HZeHuUvl0D0fJD7tnTx9PdXuUrpK2DIjmaSk141XXzF1OYAp3KC8rJ+ttrPwZxO/ZOS5e2nWckYTZe6LlCJswFx3zmuzAzXnRg8LKBqxZDQ4tdgOcn7HlS4RykVRtzWi++gOp3iEGbiNuyhVUbwZhb49DNANWhiMfn85hUoMcMOPVPQy99kuOk9OoT3vDuEinoha21/nU4AKGmd5D7NwjwoglMBiEEY19xLV2BvytX86xEh4aJMRQwW1FwLzMebBYXXBewRgAqrQjUk4eeCoxNmem9MvjDijKaRiQYf2r/nf028mOdqk+e4LWbmFW5HBKly/tqKPuDWVxh0mS3AuJmFLfGgFiQc6Tszg0UfLSKHetLTudSRyU/jYVkFjkwbjoCltzY41PGAjVvH922oZex2Ygj5q/lsW+hacM+V+GQS35o7Bha+1vAv+mt788Fw5l/mTKrfkF3g+vbbg78wMjLWgubm41zynsDhmiX7MA8gpXgjNJUP7VSU2E9Y7rKa79HHaCovRPJFKu0XsQ2H5LYnxmiEN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97bc0949-ed5d-4768-6918-08d91c98d57c X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB4615.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2021 20:41:39.5860 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kLpX2/xoZ9343Ns7KK0uhV2JemjVUkWomN3gljK1P1aP5/7tLVmKpEGbPllqpgmZdOGMpEvFmuqka9hPExpohA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4952 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ckoenig.leichtzumerken@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Problem: When device goes into sleep state due to prolonged innactivity (e.g. BACO sleep) and then hot unplugged, PCI core will try to wake up the device as part of unplug process. Since the device is gone all HW programming during rpm resume fails leading to a bad SW state later during pci remove handling. Fix: Use a flag we use for PCIe error recovery to avoid accessing registres. This allows to succefully complete rpm resume sequence and finish pci remove. v2: Renamed HW access block flag Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1081 Signed-off-by: Andrey Grodzovsky Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d8db5929cdd9..b9d221fcb66d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1555,6 +1555,11 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) if (!adev->runpm) return -EINVAL; + /* Avoids registers access if device is physically gone */ + if (!pci_device_is_present(adev->pdev)) + adev->no_hw_access = true; + + if (amdgpu_device_supports_px(drm_dev)) { drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;