From patchwork Mon Feb 26 13:16:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10242261 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 5CF5D602DC for ; Mon, 26 Feb 2018 13:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC5A29FFB for ; Mon, 26 Feb 2018 13:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 408C12A000; Mon, 26 Feb 2018 13:16:44 +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=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 B912D29FFB for ; Mon, 26 Feb 2018 13:16:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B67906E480; Mon, 26 Feb 2018 13:16:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BEA86E47B; Mon, 26 Feb 2018 13:16:38 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id t6so8836567wmt.5; Mon, 26 Feb 2018 05:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2mNx9ZDyPk4sKrxWOgX3bjUC5daaB1nvZPmfKOKLLxQ=; b=nB3Og0+HFM2Xk/PftHDQ11k+9xKWCPp5yEKtNZZHWABuRANBrd0div8a43nRovQtWw Pc3cQ0UNgL40S58dYZhea2nnJotsErd0ICHsRTKUqpYYFgUrPN4wt1DJddbZMgrwfyRu KEHFBILUAPiAkh550G3mv08TujG0XJLvXu/MR3sq1KcJSvFi19fI+dc/umnBIS27QaVk XfIrPx3c0nBSdyqR/CMF4z+T8IuhnSM+oqMNueUgqCJWigclEdGfu+FTSP6JM4GhSscK AeLnsGeSJvjHmmWuMoqSNLfbr01tBvWjnOtSIHWmg+1EV0rC62yCQiZF8Bmslg4MZcTP uzHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2mNx9ZDyPk4sKrxWOgX3bjUC5daaB1nvZPmfKOKLLxQ=; b=cBu9C/G0v6UePCPz5G5shaOZ8PkPft7ISBMj6Ydm4GKlp81vdDI+pSHVFqMi+oI8c9 G9NFukGVGrcJMuYL8DbzimUPujZMj72sVne1gBHdoI7JCjkmb81R3eYD+efrvi5HXuTd H9Cf8k+9vLZhrx4xvAIvvyyExepf1EvGGXIRfKYV34SwRRjr1EExsrDHo4/+F7WqoTNk X0TlSDk93Di/FENCrLJoVQMWXGntpRm38myqyvR/+Vq3anV3Zj0iTG91CrJN5c1OvZo9 9rzwlFdqiKKCoBcAcPZ9PjIkpK0uDrR3a0VLnLZ2GdLGbLWo3NnMjyfawHeYutSR6eYF npGA== X-Gm-Message-State: APf1xPAjbfSDTZ24uU9uNpyvWrIBn9TL0hfY5avUfelTXaje08p7np0h MCuA/WPjP/cC03l4+ihR2qfwpw== X-Google-Smtp-Source: AG47ELuh/YleJjkKA8jpLQg1f52yXJ5dJeHOA53KlH3Ms51zVdQjqgxj7fx9EIzsE8TBR0TKVnZX1Q== X-Received: by 10.28.245.25 with SMTP id t25mr7803894wmh.77.1519650996876; Mon, 26 Feb 2018 05:16:36 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:f91b:e92d:3b5f:700b]) by smtp.gmail.com with ESMTPSA id w15sm10275603wrb.33.2018.02.26.05.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 05:16:36 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/2] amdgpu: mostly revert "use the high VA range if possible v2" Date: Mon, 26 Feb 2018 14:16:34 +0100 Message-Id: <20180226131635.54635-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 07ea20d5beb24315b721adf83bbfa72ce016e146. Unfortunately it turned out that this change broke some corner cases in Mesa. Revert it for now, but keep the high range in separate VA managers. Signed-off-by: Christian König --- amdgpu/amdgpu_device.c | 28 +++++++++++++++------------- amdgpu/amdgpu_internal.h | 6 +++++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c index 6ee25a9e..ca0c7987 100644 --- a/amdgpu/amdgpu_device.c +++ b/amdgpu/amdgpu_device.c @@ -264,27 +264,29 @@ int amdgpu_device_initialize(int fd, goto cleanup; } - if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max) { - start = dev->dev_info.high_va_offset; - max = dev->dev_info.high_va_max; - } else { - start = dev->dev_info.virtual_address_offset; - max = dev->dev_info.virtual_address_max; - } - - max = MIN2(max, (start & ~0xffffffffULL) + 0x100000000ULL); + start = dev->dev_info.virtual_address_offset; + max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL); amdgpu_vamgr_init(&dev->vamgr_32, start, max, dev->dev_info.virtual_address_alignment); dev->address32_hi = start >> 32; start = max; - if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max) - max = dev->dev_info.high_va_max; - else - max = dev->dev_info.virtual_address_max; + max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL); amdgpu_vamgr_init(&dev->vamgr, start, max, dev->dev_info.virtual_address_alignment); + start = dev->dev_info.high_va_offset; + max = MIN2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) + + 0x100000000ULL); + amdgpu_vamgr_init(&dev->vamgr_high_32, start, max, + dev->dev_info.virtual_address_alignment); + + start = max; + max = MAX2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) + + 0x100000000ULL); + amdgpu_vamgr_init(&dev->vamgr_high, start, max, + dev->dev_info.virtual_address_alignment); + amdgpu_parse_asic_ids(dev); *major_version = dev->major_version; diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h index dd0c3a61..423880ed 100644 --- a/amdgpu/amdgpu_internal.h +++ b/amdgpu/amdgpu_internal.h @@ -84,10 +84,14 @@ struct amdgpu_device { pthread_mutex_t bo_table_mutex; struct drm_amdgpu_info_device dev_info; struct amdgpu_gpu_info info; - /** The global VA manager for the whole virtual address space */ + /** The VA manager for the lower virtual address space */ struct amdgpu_bo_va_mgr vamgr; /** The VA manager for the 32bit address space */ struct amdgpu_bo_va_mgr vamgr_32; + /** The VA manager for the high virtual address space */ + struct amdgpu_bo_va_mgr vamgr_high; + /** The VA manager for the 32bit high address space */ + struct amdgpu_bo_va_mgr vamgr_high_32; }; struct amdgpu_bo {