Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4472179pxf; Tue, 30 Mar 2021 08:36:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys3zscoYPeK9YcSocHwzqM4bVnX5D+NYWcTq7i0CvcSAEgKKTrpzBepSbPemNNq39YY/Hz X-Received: by 2002:a17:906:1519:: with SMTP id b25mr33825051ejd.254.1617118607688; Tue, 30 Mar 2021 08:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617118607; cv=none; d=google.com; s=arc-20160816; b=jFbsmevHkBl2J9V8RX7PAy8hjc/ENOHYys6iU/BpoGrU10kUweIAwI0VzFBrUL+4U1 IEn0sWcCp04wEPkccd7IEMGuABWaIIultwYaeabBJ0/+yoVGVIe2CdOC2Bmp0VckyJ8k LyDwRgzrBDPWTFrOujlIx6ZcwbEErtd41GEmdX714FSDIrvVXJE536jFoVd39DObR+wh of5xoENWnFG8f9+i9WkyNnskY9fl2ba04sZrGAifOUIikRPBQKjzWqi3LCc5PnXR1dVt YhJ2/YmFmkBW68rCUFTXQXmJNYR7XyuCvrgM5JuAYuEFiYbUnvyhmvuOSG9Kg7C3orIc XU6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xJ1gBuhyT9YFSqyyP3dR34G+tKbCjl47M9fIBJWEhP4=; b=G5yYsCckHTs8/KcBGvBEdxkvqK97GJ4v41ajWuLLB+y14lp4Yyg18n7pzdI0yhP36V 2me8EBzzDSsO6paXbyKHtC1vNxcm6rK3GG/cDBvm3Q8kfHhKQsiCmD9CFz8McT0zAp4U +QSVJxEeAFvtNMCqdHjaEn3b4phzvqX4KaOK9oIglv/ZyIdwQzDgjd9b6xRp89OVn0Tp q5JQuuFyH3xu8KzadT0V90uUKDeoJbMUHBUBn+TqKAFPmqoeSjpzP7Rsqx0uRv6hKcNp tkUSnsjpUMmnyVOUL2JT64m8w3QCV7GFhbAbrWgJUvYlDGSIF0hGgGHAbwE19IdHsyF7 FVzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mengyan1223.wang header.s=mail header.b=nNuEvw7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mengyan1223.wang Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si15100279ejp.171.2021.03.30.08.36.24; Tue, 30 Mar 2021 08:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mengyan1223.wang header.s=mail header.b=nNuEvw7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mengyan1223.wang Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbhC3Pfd (ORCPT + 99 others); Tue, 30 Mar 2021 11:35:33 -0400 Received: from mengyan1223.wang ([89.208.246.23]:33060 "EHLO mengyan1223.wang" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232378AbhC3PfL (ORCPT ); Tue, 30 Mar 2021 11:35:11 -0400 Received: from xry111-X57S1.. (unknown [IPv6:240e:35a:1037:8a00:70b2:e35d:833c:af3e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@mengyan1223.wang) by mengyan1223.wang (Postfix) with ESMTPSA id 4833965C14; Tue, 30 Mar 2021 11:34:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mengyan1223.wang; s=mail; t=1617118510; bh=xJ1gBuhyT9YFSqyyP3dR34G+tKbCjl47M9fIBJWEhP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nNuEvw7jfD7BiHtgdTD0pBrp2f6S96v0UAaS384nzTVt7iqz4b3f50RR76fanHxBu vtThlDtrWvudCRJDAWp+caryNPii4t5iXGTkjCd/8NLA7SfQGhr9w0KlS61/yp5TVM d984Bqv/oz2Rvt0GNVrkhsSIVTuVDmy1MoWR3ZANv4Dk7WkStaOH7GYjPPwzDi+Gjg cP7reWq4ayypxOeHajV2fUN0vtQWK0wAzYogIeDWT+2ppf2CGxYC6C4he4af+L4Ohl aEZLHvIuqJpnJ+LHRPOxcf+wnVwQdsyo4lRtyNnAadsVbLmhbefZCp3s7mN4GsHX4A xOxZiaknAURnw== From: =?UTF-8?q?X=E2=84=B9=20Ruoyao?= To: amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Huacai Chen , =?UTF-8?q?Dan=20Hor=C3=A1k?= , Alex Deucher , David Airlie , Huacai Chen , Rui Wang , Xi Ruoyao , stable@vger.kernel.org Subject: [PATCH 1/2] drm/amdgpu: Set a suitable dev_info.gart_page_size Date: Tue, 30 Mar 2021 23:33:33 +0800 Message-Id: <20210330153334.44570-2-xry111@mengyan1223.wang> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210330153334.44570-1-xry111@mengyan1223.wang> References: <20210330153334.44570-1-xry111@mengyan1223.wang> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huacai Chen In Mesa, dev_info.gart_page_size is used for alignment and it was set to AMDGPU_GPU_PAGE_SIZE(4KB). However, the page table of AMDGPU driver requires an alignment on CPU pages. So, for non-4KB page system, gart_page_size should be max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE). Signed-off-by: Rui Wang Signed-off-by: Huacai Chen Link: https://github.com/loongson-community/linux-stable/commit/caa9c0a1 [Xi: rebased for drm-next, use max_t for checkpatch, and reworded commit message.] Signed-off-by: Xi Ruoyao BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1549 Tested-by: Dan HorĂ¡k Cc: stable@vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 86eeeb4f3513..3b0be64e4638 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -791,9 +791,9 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) dev_info->high_va_offset = AMDGPU_GMC_HOLE_END; dev_info->high_va_max = AMDGPU_GMC_HOLE_END | vm_size; } - dev_info->virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); + dev_info->virtual_address_alignment = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); dev_info->pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE; - dev_info->gart_page_size = AMDGPU_GPU_PAGE_SIZE; + dev_info->gart_page_size = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); dev_info->cu_active_number = adev->gfx.cu_info.number; dev_info->cu_ao_mask = adev->gfx.cu_info.ao_cu_mask; dev_info->ce_ram_size = adev->gfx.ce_ram_size; -- 2.31.1