From patchwork Tue Feb 18 18:04:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 11390661 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFFF2109A for ; Wed, 19 Feb 2020 08:20:40 +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 9DC572176D for ; Wed, 19 Feb 2020 08:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N5QGfRDR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DC572176D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 719E46EAE0; Wed, 19 Feb 2020 08:20:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id B2AEB6E3B0; Tue, 18 Feb 2020 18:02:27 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id c9so25106321wrw.8; Tue, 18 Feb 2020 10:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n5R88FGnPjhsQadJtsU+Gi9+2LMayu3HLn44l5p9s88=; b=N5QGfRDRA2X9GmasAl0gSPur1ZbJcHybQJ65XK/qWKMbER4n9+0Sz5bdQta9JdwAGo PqqhfgKPrxj/aEwc6HSPMgtdPol+UXFOi0a/OO0nGtaoxPXXi788/kGumag/jeF9gcm3 iDMvTYzpMyn9xbTcdDXXaNKGOSBj8NxGOJmn571YPZ8LMcIV3yW+30oVPjjUXgefmY/C W4glXbgoJ+EiX94mIf/6sAJHCa7mdDCcEiGtLiuJWU1QgcQiCUf5j/IG3X3ETmjg/d5b ECdaQrplM60Ibap489pOhTNe+EOI4f1RH05ejU5X0otVfQB6p3z0g633J9sONiDZ9MU7 vfeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n5R88FGnPjhsQadJtsU+Gi9+2LMayu3HLn44l5p9s88=; b=tsi0qFjPLuWjirVwtVRenN0fno9J/FxjKwRCc2jNbv6na62QgyOSh7KDyEC5tAdZ7R C4KbDBPSV+FZEMdeDaO8VMdJKLXMe2tG1mUSQFL+xjYP79CRukfPnfUY1khXC9qx5PfK gbXoxYedpJcZ1O9eSVmVYcnAlVT5/XQ0Lq80kprD5MB6P3+RTN6r0iNthwsmk4x2CRwJ nnjiDTvOQFeq16TD+UPbPVUMgRKpgYDvmktFqjc7oKkwES9MdN6Y9WcIfsdc5UHVf8WH zsrJGsPjhj8Jk5VYRAn49XEhuHuZBk1uUclSV3e5qT5jGJG96Tiz6Vo06Xb28ZzB1Rbr 56Nw== X-Gm-Message-State: APjAAAWWBIZGBiyTEs9vr54NIOfu79EEjDY3wAfFgFxsuVX5CZuAxCuV NsefOoQQ+H8JiYsMxAttQkf2AbicJdGI5Q== X-Google-Smtp-Source: APXvYqwkWJQg5wp45GBNA6FMb7wfQYdXh2VF17SYZDCTnlU9oSN0n2go4g4TYRPUnYP+yepHjmCsVA== X-Received: by 2002:a5d:4702:: with SMTP id y2mr29084186wrq.37.1582048945877; Tue, 18 Feb 2020 10:02:25 -0800 (PST) Received: from brihaspati.fritz.box (p200300C58F2CE900751228326401B174.dip0.t-ipconnect.de. [2003:c5:8f2c:e900:7512:2832:6401:b174]) by smtp.gmail.com with ESMTPSA id d16sm7872733wrg.27.2020.02.18.10.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 10:02:24 -0800 (PST) From: Nirmoy Das X-Google-Original-From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 5/8] drm/qxl: don't use ttm bo->offset Date: Tue, 18 Feb 2020 19:04:51 +0100 Message-Id: <20200218180454.81866-6-nirmoy.das@amd.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218180454.81866-1-nirmoy.das@amd.com> References: <20200218180454.81866-1-nirmoy.das@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Feb 2020 08:19:59 +0000 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: thellstrom@vmware.com, airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com, amd-gfx@lists.freedesktop.org, nirmoy.das@amd.com, linux-graphics-maintainer@vmware.com, bskeggs@redhat.com, alexander.deucher@amd.com, sean@poorly.run, christian.koenig@amd.com, kraxel@redhat.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch removes slot->gpu_offset which is not required as VRAM and PRIV slot are in separate PCI bar This patch also removes unused qxl_bo_gpu_offset() Signed-off-by: Nirmoy Das Acked-by: Christian König Acked-by: Gerd Hoffmann --- drivers/gpu/drm/qxl/qxl_drv.h | 6 ++---- drivers/gpu/drm/qxl/qxl_kms.c | 5 ++--- drivers/gpu/drm/qxl/qxl_object.h | 5 ----- drivers/gpu/drm/qxl/qxl_ttm.c | 9 --------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 27e45a2d6b52..df581f0e6699 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -134,7 +134,6 @@ struct qxl_memslot { uint64_t start_phys_addr; uint64_t size; uint64_t high_bits; - uint64_t gpu_offset; }; enum { @@ -311,10 +310,9 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo, (bo->tbo.mem.mem_type == TTM_PL_VRAM) ? &qdev->main_slot : &qdev->surfaces_slot; - WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset); + /* TODO - need to hold one of the locks to read bo->tbo.mem.start */ - /* TODO - need to hold one of the locks to read tbo.offset */ - return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset); + return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) + offset); } /* qxl_display.c */ diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 70b20ee4741a..7a5bf544f34d 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c @@ -86,11 +86,10 @@ static void setup_slot(struct qxl_device *qdev, high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits)); slot->high_bits = high_bits; - DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n", + DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx\n", slot->index, slot->name, (unsigned long)slot->start_phys_addr, - (unsigned long)slot->size, - (unsigned long)slot->gpu_offset); + (unsigned long)slot->size); } void qxl_reinit_memslots(struct qxl_device *qdev) diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h index 8ae54ba7857c..21fa81048f4f 100644 --- a/drivers/gpu/drm/qxl/qxl_object.h +++ b/drivers/gpu/drm/qxl/qxl_object.h @@ -48,11 +48,6 @@ static inline void qxl_bo_unreserve(struct qxl_bo *bo) ttm_bo_unreserve(&bo->tbo); } -static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo) -{ - return bo->tbo.offset; -} - static inline unsigned long qxl_bo_size(struct qxl_bo *bo) { return bo->tbo.num_pages << PAGE_SHIFT; diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 62a5e424971b..635d000e7934 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -51,11 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev) static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, struct ttm_mem_type_manager *man) { - struct qxl_device *qdev = qxl_get_qdev(bdev); - unsigned int gpu_offset_shift = - 64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits + 8); - struct qxl_memslot *slot; - switch (type) { case TTM_PL_SYSTEM: /* System memory */ @@ -66,11 +61,7 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, case TTM_PL_VRAM: case TTM_PL_PRIV: /* "On-card" video ram */ - slot = (type == TTM_PL_VRAM) ? - &qdev->main_slot : &qdev->surfaces_slot; - slot->gpu_offset = (uint64_t)type << gpu_offset_shift; man->func = &ttm_bo_manager_func; - man->gpu_offset = slot->gpu_offset; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->available_caching = TTM_PL_MASK_CACHING;