From patchwork Fri Feb 2 07:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10196333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8F280603D7 for ; Fri, 2 Feb 2018 07:23:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7615F28D75 for ; Fri, 2 Feb 2018 07:23:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3E528E0B; Fri, 2 Feb 2018 07:23:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFDEB28D75 for ; Fri, 2 Feb 2018 07:23:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E86306EFAF; Fri, 2 Feb 2018 07:23:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0075.outbound.protection.outlook.com [104.47.34.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F32F6EFAF for ; Fri, 2 Feb 2018 07:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=woqAYJAhPTK8lH/3rdnYaiqsHbiMZs37jWLRZAQy4lg=; b=KcQxlpu4jVtEETcECvOPxB02L+1V7+qAXreJGRvO0lJFevZ+c/dqP+pKdysFhKoU1N8U2wLRcr27+CCL+90DmZeps6SkRrbv8AqsMDBsHFzZDWsb4NWhi6kMef4hRgnCxoHTNLMTSFguSVPuVBYMWnZoYHQj9gjOgzlUp8C4oyk= Received: from CY4PR1201CA0005.namprd12.prod.outlook.com (10.172.75.15) by DM5PR12MB1449.namprd12.prod.outlook.com (10.172.38.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Fri, 2 Feb 2018 07:23:54 +0000 Received: from DM3NAM03FT013.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::200) by CY4PR1201CA0005.outlook.office365.com (2603:10b6:910:16::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.11 via Frontend Transport; Fri, 2 Feb 2018 07:23:54 +0000 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=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT013.mail.protection.outlook.com (10.152.82.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.464.13 via Frontend Transport; Fri, 2 Feb 2018 07:23:53 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.361.1; Fri, 2 Feb 2018 01:23:52 -0600 From: Roger He To: Subject: [PATCH 4/5] drm/ttm: if need_dma32 is not set, actually no need dma32 zone at all. Date: Fri, 2 Feb 2018 15:22:24 +0800 Message-ID: <1517556145-23505-4-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517556145-23505-1-git-send-email-Hongbo.He@amd.com> References: <1517556145-23505-1-git-send-email-Hongbo.He@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(346002)(39380400002)(2980300002)(428003)(189003)(199004)(316002)(2351001)(72206003)(104016004)(8936002)(8676002)(97736004)(51416003)(7696005)(53416004)(86362001)(81166006)(81156014)(47776003)(76176011)(305945005)(106466001)(50226002)(5660300001)(54906003)(4326008)(53936002)(50466002)(105586002)(48376002)(16586007)(2906002)(36756003)(336011)(26005)(68736007)(2950100002)(186003)(6666003)(6916009)(478600001)(356003)(77096007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1449; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT013; 1:NADG2MPlB+/hR4dNZhk6t+dvh1RnvxkRyP93IRtrBznoLwDDYlOjGUJ1CZpES35vAOzVmqB7wKE1RHgcYOsMkPjarVS9uYGUMc5efPuPzvImfNu60Z4Enu8s9Iqxj7bI X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7a81452-11a5-4f5c-5357-08d56a0dea64 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM5PR12MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449;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qdxuTslGzrwAFN7qxfxaIj/Ea3pTe0hj3w+J4ge6tZGhMm8yTmabq2edec7JAyr1/l9HLpLmBBoKt8jWU6u0XaFADsd0N/G2tyY/MSfljPbGRH7RvTrpqhV7vmSyaUJIg/zuDsyeEsEAmxIhpR2CTh624VMrnkVbN3Lh+FfDqbsytuWoK2SJXcxRNlD9kn+rtLvDW6NOaA45+OF5qB9QIrv4voDsgBh9JM6Z3sh7oSsyha9uDrwvYqCZ7hA4hiLeqistZ5jwnHhG8OmwxRCVYla/3Z8uxNIaPuPMwXbMthm76UUezORpWh4kaAXzhmLgkhhshMtT2dXZjiqca+yaAZKTdqoFuYaoSeruSK31Mi/pjxIujD1blwMAdgg625+lJ81zol/ZAjoSEQwTrDhIRz1Ed5fy/I4qrV1/jjdo1lH0lq1vVhu4iacQ5Q5GlfL4D1I07BMY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93003095)(3231101)(2400082)(944501161)(6055026)(6041288)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR12MB1449; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 4:V6TiSbHnWY4d+F0arRYl8t6ebasq3vCekUMbEcgnefo04qlSj6pKU8zPiLj7ZYcxOQd7Y2VxvBnhDYaqpUhVJaY/PrREF5MC8dGJWLgcDuuHOepqewN3lD3uCOj6VekTQbNo2f5sLJ+oIttWywcP6F689PJ6kQOigQPkl2GRLKgQKbpWnxNzmvDFB9OHhANHkBeUz2PHpuXKJFSGO5fg4iTG8oyIcEXFh6PmZfVuqY7Eag6fgKmjEOd3MluP0ZMnmIbBxUvYV/ZQioxd+YptzKQSyczhD0JaZlU6Iibv/aG2ope88nlM8QW01fi8HpCd X-Forefront-PRVS: 05715BE7FD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1449; 23:9F2ay2rzLKozaVveSQbA+7mgDsWx3REJDH0psiD3E?= =?us-ascii?Q?HOLSC+S4ABwSsRddsavERmet2N/4uioWwiU/qNZtEnKVS3R+kMNDV6YDejGK?= =?us-ascii?Q?Ol8MeAmFiG3JrDKfzHUQmmqZolpVDAnKz5PcTjcK6+VYpJl4nv2eswG9Hr2C?= =?us-ascii?Q?PyKU2N5nIybgIrOsXJFQSCXD7TUc30IiI10+PNmM05+KFuTmLgy3zsBrDMsU?= =?us-ascii?Q?z8UjniPwzRUVSTvcMYz2ppqV1Z22JZIcXEFxA13jU8Q5+nr2Y9k7C9STuKh/?= =?us-ascii?Q?ihiRQ90x8G0u5XzNde/ZeZHHyuLz42uQHtynkAvkPPu8tT9yctMLXfg8OfkG?= =?us-ascii?Q?4R+FBMfPLR0XcSYPwv105/PCquvGuSsypQAQeajtOXceOCKfjfHg7V/Ahgqg?= =?us-ascii?Q?3xafyiIfYPsrzgKukxeXHVh4no4I4rFuKcr7fQMH7fs3K75+VCBqG35rtNnO?= =?us-ascii?Q?dFplLw+ayq4LzivAwu/+ftbRmsfqnqpY0qBfKjzaKLbNpttLmIWMgu8pid8W?= =?us-ascii?Q?OqDwYx1+I6GOq0ttv9hrRnPgRfIb4gVwKhaImNh8Y5+lMfYwAhePZI0yyc8z?= =?us-ascii?Q?IFYD+fxhYyNGRIkz+FTnEMACl4f3OW061bU4YrCCG8Uw6n2LXnJFD2/nascx?= =?us-ascii?Q?Q+dT6ZAlhSoKbLBK9v9dGMaux2LQXDz/0chMuuG1Z+xkjrkiy0BMKYAW+MkR?= =?us-ascii?Q?6Y1uQsr54qrbD13gBrxk/ePF+GEUk4b1s1VXTP57VSpYcDpja3cMzGxmOaKy?= =?us-ascii?Q?mY3tQJVjGM2pGSTt8YEWRvHsileV9ooSHKfM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0mU=; 7:8PMd0uA21l0oAthHuMfVWYZZ40jGxA5/ZrN7NB6sX2Lt3wEUPFP1kCTX/9sr/IEVYzNI30PoQjP4cSdX/CNcfiPNQB4wDUZz3SkK5Msxbp1QLnE80/OZhTvigiDUGqUBNVtf86aGkijdSMHy8HeufIAZIsb1vMmlS1zYeEiZeeQcPzCEal6e4Oz+Fe4uhqeBHiT8tsxihq50D0qt9pyIH8IYA3ivfyQtPbZFqMxTMXL92gP375dv+QxJIdhjV7fj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 20:LTAS5TzG667dBQ2/WHtB4T1m3c/A7kR7Qm/Xpei6SmjyMmPA6XyjBr0lRmHlSiZXHiBqO9P07QTx/bVGrWp6U+yIIGkpjsUxvB6hei2kTT+jFRGYDWZmLohjJa44uqbH6Oc9ouPkw98W+j0J8lQEgWTXSBXa9S0Hhi9b7y4HGBFx/z2lAUj6x2fYbMdK4kZaChBLVy8Z/ZwqsaPrtYUln7ednsiLqml1pocJe4B3egBQ45mTpEXHrtYAI+WCF0tB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2018 07:23:53.8449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7a81452-11a5-4f5c-5357-08d56a0dea64 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1449 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roger He , Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP because this zone has only 4GB, it is easy to became bottleneck for huge normal zone. Signed-off-by: Roger He --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++ drivers/gpu/drm/ttm/ttm_memory.c | 10 ++++++++-- include/drm/ttm/ttm_memory.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 95f9901..9f90022 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -75,6 +75,7 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref) static int amdgpu_ttm_global_init(struct amdgpu_device *adev) { struct drm_global_reference *global_ref; + struct ttm_mem_global *mem_glob; struct amdgpu_ring *ring; struct drm_sched_rq *rq; int r; @@ -91,6 +92,8 @@ static int amdgpu_ttm_global_init(struct amdgpu_device *adev) "subsystem.\n"); goto error_mem; } + mem_glob = (struct ttm_mem_global *)global_ref->object; + mem_glob->bdev = &adev->mman.bdev; adev->mman.bo_global_ref.mem_glob = adev->mman.mem_global_ref.object; diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index f5227a5..875e5b8 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -567,6 +567,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, bool in_pagefault) { struct ttm_mem_zone *zone = NULL; + struct ttm_bo_device *bdev = glob->bdev; /** * Page allocations may be registed in a single zone @@ -577,7 +578,9 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, if (PageHighMem(page) && glob->zone_highmem != NULL) zone = glob->zone_highmem; #else - if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) + if (bdev && !bdev->need_dma32) + zone = glob->zone_kernel; + else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) zone = glob->zone_kernel; #endif return ttm_mem_global_alloc_zone(glob, zone, size, @@ -588,12 +591,15 @@ void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page, uint64_t size) { struct ttm_mem_zone *zone = NULL; + struct ttm_bo_device *bdev = glob->bdev; #ifdef CONFIG_HIGHMEM if (PageHighMem(page) && glob->zone_highmem != NULL) zone = glob->zone_highmem; #else - if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) + if (bdev && !bdev->need_dma32) + zone = glob->zone_kernel; + else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) zone = glob->zone_kernel; #endif ttm_mem_global_free_zone(glob, zone, size); diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index 6c29b5c..0577475 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h @@ -79,6 +79,7 @@ struct ttm_mem_global { #else struct ttm_mem_zone *zone_dma32; #endif + struct ttm_bo_device *bdev; }; extern int ttm_mem_global_init(struct ttm_mem_global *glob);