Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp317292ybv; Tue, 18 Feb 2020 23:58:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwJVQi/jXrgJ5Qs5f10AQ0Nkjew7zd1buVMRnQCWMmRs+PNt0tiINESvIR6IO6EOPauyjHe X-Received: by 2002:aca:dc45:: with SMTP id t66mr3972866oig.39.1582099084639; Tue, 18 Feb 2020 23:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582099084; cv=none; d=google.com; s=arc-20160816; b=FXDng0WzXk1lD3xbq5dWqi0vCdNmKei4dn3XNsbuKE80lRD0jWQCbObrDZsBS5Apox 13oEYkH5DN8J7Mbcfws2xP/elNXxUYdHT7aX5V6G+VXgu/QU14zgskTPbFl5TUR36Zw6 OV/2ZI8MoQt2mnGDX5FbLWV3cpaw3Vn464zUa9FlH5NvqSTwdEaz3QRyLmPWxXEEEOsU fdt4TwZnpmZv06f0jl7HMJUoww5lkDLwZb6Y9KJ4ygcRVcoKeUdi2ecPPk+2eJRiZdq5 26T5qex9e8wNTzfJPR0/k8W8AJuC2GY/d1m4usIy0KR2WQ04MDREQEMzD6Nj3/O03yDs LUVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=LpPrdpJGoVbWT+T9C5Dpc1gbsH/dUDPSGyAoNL0fEF8=; b=h0F1KVlDkHLcq/ue6SjhtUQDptQqhXPInYGm1MVRlYUSd8LfOd6nvFX4KwuUJQdD0s 8IsocMKwbRHTzp4vS/yQOdnQ+amCtBY86QGupyUehJ++VqaqJPXLptWWCuOcmgxOjAu9 F/n8/tYhuhJBo89VfpCV+9PuDC3giV+JB7ASIJRyp4p0axL+rvERertr2VXb3EB14dYv vpS2p2blV7HGTQjZSt347W4JheKiHAn9co1bq6oaMzkdEPY/buy8sAq2hf5R9KTSSOQ2 Us76ozQnPaIbpyOHJoX4cBnU4VrmbOs9xUZrSMjbAehAW9hrlmz7/UMa3IvM1YPw0NES wyKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si743824otq.94.2020.02.18.23.57.52; Tue, 18 Feb 2020 23:58:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726634AbgBSH5m (ORCPT + 99 others); Wed, 19 Feb 2020 02:57:42 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10642 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726260AbgBSH5m (ORCPT ); Wed, 19 Feb 2020 02:57:42 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EB2D92AC65ADECDF186C; Wed, 19 Feb 2020 15:57:33 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 19 Feb 2020 15:57:26 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH] drm/hisilicon: Fixed pcie resource conflict between drm and firmware Date: Wed, 19 Feb 2020 15:57:08 +0800 Message-ID: <1582099028-11898-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org remove the framebuffer initialized by fireware/bootloader,which will use hibmc's pcie resource, and may cause conflict. Signed-off-by: Tian Tao Signed-off-by: Gong junjie --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 5f612f6..7ebe831 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -47,6 +47,22 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void *arg) return IRQ_HANDLED; } +static void hibmc_remove_framebuffers(struct pci_dev *pdev) +{ + struct apertures_struct *ap; + + ap = alloc_apertures(1); + if (!ap) + return; + + ap->ranges[0].base = pci_resource_start(pdev, 0); + ap->ranges[0].size = pci_resource_len(pdev, 0); + + drm_fb_helper_remove_conflicting_framebuffers(ap, "hibmcdrmfb", false); + + kfree(ap); +} + static struct drm_driver hibmc_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &hibmc_fops, @@ -327,6 +343,8 @@ static int hibmc_pci_probe(struct pci_dev *pdev, struct drm_device *dev; int ret; + hibmc_remove_framebuffers(pdev); + dev = drm_dev_alloc(&hibmc_driver, &pdev->dev); if (IS_ERR(dev)) { DRM_ERROR("failed to allocate drm_device\n"); -- 2.7.4