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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 7752BC4363A for ; Fri, 30 Oct 2020 11:32:35 +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 D252020719 for ; Fri, 30 Oct 2020 11:32:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="fyAZPn07" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D252020719 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCA696EDA2; Fri, 30 Oct 2020 11:32:33 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2055.outbound.protection.outlook.com [40.107.94.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF2326EDA2 for ; Fri, 30 Oct 2020 11:32:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+fEEx9cOWK5DorCkq1N3cyt7nspgr6uj/usYsOYPrvbd6hamJcCY+592iTc0LlUYmtCvQZT99PpgscxL8WA3t/iXQZ8IHqRMT3CL0j1qFSjNN5rhoJYXvzKlVpEpy77YU07P1KckEeeTznGa6aW9Aq6JjVi3drOxqZs2+3UNznxzx/8TVdLfUqF7+GBai8cFPobc5GnfLJg4D9mUUpoM2vqbX0EoK0MVsDPThzankmRrgJFcDo+K5oE0WYTOZVq3fs8c7UxdZ5vpgrWkmKJzLNxiFgGeLs/R+e8v8BSZ6tBUANB0D7Obc2kTD8Vkq08kdpNwuoI8i7qEWG25tPnTg== 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=3nLYfvopw9vx7wSK93K4E5houodcgsukyfH+ttbIbMI=; b=VygJYbJWj7W9Lwh7Qp94y/+NKdDBxMkn6tEEI0mMTuhwB4UuUxVERFmNle01JYevlDiwqWbn9Z01bamj7PQ5AVF0M6tukxopMaKOye0LlIgb4kHYmOeamjoLUzF6CRhWAAB41PqHJeURrwsNtivW88IAxrmBFvdyVK2bLkOLqoJDw/pCTt03U9Qo3zYpsJIfy4mLWcCW2Kdf3oz6duLZJr+F+qhOheLVoC7emEXlrTnbwQ+/mTL9lmohSDUNeZwMD13l1OiZ/n2ELmQVBSz/I8hyTyoDa7wCgGjkh4JBnE6I5uX/W9vp9/rbtM+4yJyTgQtgb8W3bzmev9Oj/+vB3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=none action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3nLYfvopw9vx7wSK93K4E5houodcgsukyfH+ttbIbMI=; b=fyAZPn07f2DtGSmM/Sj9Z21o558Za/Wj/F98QzBQv1sr/qjUh9cVsHqZVMqYubR1Uha+1g+BzhGWvDiNvimmyYD6XWdaVfkeZqkuh+aSkF6HJG6PIi0UvHITQAeUxWkIySPt+IAmt2wC/X4HZFImh/h9bpuA4/XVO0xH8WGPs0U= Received: from BN6PR08CA0065.namprd08.prod.outlook.com (2603:10b6:404:b9::27) by SN6PR12MB2672.namprd12.prod.outlook.com (2603:10b6:805:6f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 11:32:31 +0000 Received: from BN8NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:404:b9:cafe::a7) by BN6PR08CA0065.outlook.office365.com (2603:10b6:404:b9::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 11:32:31 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by BN8NAM11FT047.mail.protection.outlook.com (10.13.177.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.17 via Frontend Transport; Fri, 30 Oct 2020 11:32:31 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 30 Oct 2020 06:32:30 -0500 Received: from SATLEXMB02.amd.com (10.181.40.143) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 30 Oct 2020 06:32:30 -0500 Received: from rico-code.amd.com (10.180.168.240) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 30 Oct 2020 06:32:28 -0500 From: Tianci Yin To: Subject: [PATCH] drm/amdgpu: fix NULL pointer crash on navi10 headless SKU Date: Fri, 30 Oct 2020 19:32:25 +0800 Message-ID: <20201030113225.12675-1-tianci.yin@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9aee0034-7904-42cb-e587-08d87cc77d06 X-MS-TrafficTypeDiagnostic: SN6PR12MB2672: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HYicDwvjz79ppvRUeHK4cZaYrJoxfUgf0mJzbIUPtNMbNhLQjDCzgLZeYcvNf4nJ4EsWSdtZaGN4M26yGMElYp0q+5MXzpUktpWkXkpDqXqA1ITmDgJtvcoODTjgNBO6gXfPbr/quLPOtKvDg491AVXnphlsSJrYJMA6lGEY6An4EvZBNelv+mIFslz/hZE1yhoFabRjbeUjKs+J309TOoYONm/QGi6ga8NNA/pRZvwBXSP+WcNIReiX528VcepTwYAXK0pdzsjfecFNFT+RRdEUlZdzHBEmnjqkLtoNMyCKu42Vf9ODPJsYJMjk1c1ufoQ6344J+XyyqVXYr6f6k0beIay6kdwj9Qvq1hYujtL0DhRmRa+X7GAz34DUmKkBAX2gw8UZmlxvUkKiBKHa2g== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB01.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(46966005)(54906003)(81166007)(356005)(316002)(6916009)(82740400003)(186003)(83380400001)(4326008)(2616005)(336012)(2906002)(47076004)(82310400003)(44832011)(426003)(6666004)(8676002)(8936002)(478600001)(1076003)(26005)(36756003)(86362001)(5660300002)(7696005)(70586007)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 11:32:31.0415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9aee0034-7904-42cb-e587-08d87cc77d06 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2672 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Long Gang , Guchun Chen , Feifei Xu , Tianci Yin , Tuikov Luben , Deucher Alexander , Flora Cui , Hawking Zhang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: "Tianci.Yin" The crash caused by the NULL pointer of adev->ddev.mode_config.funcs in drm_kms_helper_hotplug_event(), but this function should not be called on headless SKU. Fix the mismatch between the return value of amdgpu_device_has_dc_support() and the real DCN supporting state to avoid calling to drm_kms_helper_hotplug_event() in amdgpu_device_resume(). Change-Id: I3a3d387e6ab5b774abb3911ea1bf6de60797759d Signed-off-by: Tianci.Yin --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/nv.c | 2 +- drivers/gpu/drm/amd/amdgpu/nv.h | 1 + 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index ba65d4f2ab67..f0183271456f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1090,7 +1090,7 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev, u32 pcie_index, u32 pcie_data, u32 reg_addr, u64 reg_data); -bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type); +bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type, struct pci_dev *pdev); bool amdgpu_device_has_dc_support(struct amdgpu_device *adev); int emu_soc_asic_init(struct amdgpu_device *adev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 1fe850e0a94d..323ed69032a7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2960,11 +2960,12 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev) * amdgpu_device_asic_has_dc_support - determine if DC supports the asic * * @asic_type: AMD asic type + * @pdev: pointer to pci_dev instance * * Check if there is DC (new modesetting infrastructre) support for an asic. * returns true if DC has support, false if not. */ -bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type) +bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type, struct pci_dev *pdev) { switch (asic_type) { #if defined(CONFIG_DRM_AMD_DC) @@ -3000,9 +3001,14 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type) case CHIP_VEGA20: #if defined(CONFIG_DRM_AMD_DC_DCN) case CHIP_RAVEN: + return amdgpu_dc != 0; case CHIP_NAVI10: case CHIP_NAVI14: case CHIP_NAVI12: + if (nv_is_headless_sku(pdev)) + return false; + else + return amdgpu_dc != 0; case CHIP_RENOIR: #endif #if defined(CONFIG_DRM_AMD_DC_DCN3_0) @@ -3033,7 +3039,7 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) if (amdgpu_sriov_vf(adev) || adev->enable_virtual_display) return false; - return amdgpu_device_asic_has_dc_support(adev->asic_type); + return amdgpu_device_asic_has_dc_support(adev->asic_type, adev->pdev); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 9e92d2a070ac..97014458d7de 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -516,7 +516,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, */ if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) && amdgpu_bo_support_uswc(bo_flags) && - amdgpu_device_asic_has_dc_support(adev->asic_type)) { + amdgpu_device_asic_has_dc_support(adev->asic_type, adev->pdev)) { switch (adev->asic_type) { case CHIP_CARRIZO: case CHIP_STONEY: diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 4b78ecfd35f7..b23110241267 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1117,7 +1117,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, bool supports_atomic = false; if (!amdgpu_virtual_display && - amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK)) + amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK, pdev)) supports_atomic = true; if ((flags & AMD_EXP_HW_SUPPORT) && !amdgpu_exp_hw_support) { diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c index 026e0a8fd526..97446ae75b0b 100644 --- a/drivers/gpu/drm/amd/amdgpu/nv.c +++ b/drivers/gpu/drm/amd/amdgpu/nv.c @@ -493,7 +493,7 @@ void nv_set_virt_ops(struct amdgpu_device *adev) adev->virt.ops = &xgpu_nv_virt_ops; } -static bool nv_is_headless_sku(struct pci_dev *pdev) +bool nv_is_headless_sku(struct pci_dev *pdev) { if ((pdev->device == 0x731E && (pdev->revision == 0xC6 || pdev->revision == 0xC7)) || diff --git a/drivers/gpu/drm/amd/amdgpu/nv.h b/drivers/gpu/drm/amd/amdgpu/nv.h index 515d67bf249f..7880ad0073c9 100644 --- a/drivers/gpu/drm/amd/amdgpu/nv.h +++ b/drivers/gpu/drm/amd/amdgpu/nv.h @@ -29,6 +29,7 @@ void nv_grbm_select(struct amdgpu_device *adev, u32 me, u32 pipe, u32 queue, u32 vmid); void nv_set_virt_ops(struct amdgpu_device *adev); +bool nv_is_headless_sku(struct pci_dev *pdev); int nv_set_ip_blocks(struct amdgpu_device *adev); int navi10_reg_base_init(struct amdgpu_device *adev); int navi14_reg_base_init(struct amdgpu_device *adev); -- 2.17.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx