Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2516343imm; Mon, 24 Sep 2018 05:47:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZJunIIf01LfsU5Ev0FvyTXOOacKk0Hw+T/VTNs/DuMfjhx592duanag7mHTVxGb3Q1XO1z X-Received: by 2002:a62:9992:: with SMTP id t18-v6mr10112780pfk.239.1537793247758; Mon, 24 Sep 2018 05:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793247; cv=none; d=google.com; s=arc-20160816; b=OWiEXNAS9Ht72r46aJFtxNO4NhKu3+HK99n4A/yxYOrVJHD3WLuUMQsP7zSJymIZMC v7c5ykWAaXK6nc8StYfNOuZwCAl8ILdm/dns9Wr3EXC6aiXtfe8yGb8d78mSrGOvV6mK ld/HA+bEFaNOrfQbYHvFqaJ7vZo6IV4xepkFpESJbEwJ0wp5F2D4EPpEK9i49LkRq0rw BTNa4jGa95GCR6oXk+h0E6QWgZYwydWkeBRMf1Ns0JrNTw2JMBNzcHpnd4L1OPEBW9Xq tFOArOlcDAW/GBx1pxl1Gml8lFGX4B8w8JprL68PLociXVwGO0qgvSfEduav7aoG76m2 9j8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=KykTRL7ZoRUI8kiW0ZXugIyjg3hZoyG9tyWlLT26muM=; b=J/HBv7X9Q9V7kxpon1Oavud1SM1ED0S7Dv5TOhTXm6NMIAj/aIO7WKnJdfayJ8/Z/0 5QTlsQRUWzuIfACGn89+U4dmYwckPgAsJETZ8Iy17kUzmgYS0d7X45i0XeTmKpLldU4i NSvO3RBH9KJw+/6CtQZwp9msjdabiv0nIvW2UZ/1tZOBUEAFSYgjqoe3q6q47tbkeshY vnn0Av96HaU1qoVO7nPrREGiRodyzaCxFYJnUXyhDbzF2tnOmpujqzTzfz12RnVKi414 OT1+u4+k5zl16zBH0f3CNpRUBbyFJayzXEr3YF2s8FjZYD3YX2dwqODW3Y8JFUhd2SAQ KX9Q== 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 i190-v6si571028pge.83.2018.09.24.05.47.11; Mon, 24 Sep 2018 05:47:27 -0700 (PDT) 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 S2389267AbeIXSrA (ORCPT + 99 others); Mon, 24 Sep 2018 14:47:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59700 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388896AbeIXSq7 (ORCPT ); Mon, 24 Sep 2018 14:46:59 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 33BB91099; Mon, 24 Sep 2018 12:45:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaoyun Liu , Felix Kuehling , =?UTF-8?q?Christian=20K=C3=B6nig?= , Oded Gabbay , Sasha Levin Subject: [PATCH 4.18 208/235] drm/amdkfd: Fix kernel queue 64 bit doorbell offset calculation Date: Mon, 24 Sep 2018 13:53:14 +0200 Message-Id: <20180924113124.691249701@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shaoyun Liu [ Upstream commit 951df6d9cfd07f205f1905bf3b27d994612e0614 ] The bitmap index calculation should reverse the logic used on allocation so it will clear the same bit used on allocation Signed-off-by: Shaoyun Liu Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Acked-by: Christian König Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c @@ -188,9 +188,9 @@ void __iomem *kfd_get_kernel_doorbell(st *doorbell_off = kfd->doorbell_id_offset + inx; pr_debug("Get kernel queue doorbell\n" - " doorbell offset == 0x%08X\n" - " kernel address == %p\n", - *doorbell_off, (kfd->doorbell_kernel_ptr + inx)); + " doorbell offset == 0x%08X\n" + " doorbell index == 0x%x\n", + *doorbell_off, inx); return kfd->doorbell_kernel_ptr + inx; } @@ -199,7 +199,8 @@ void kfd_release_kernel_doorbell(struct { unsigned int inx; - inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr); + inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr) + * sizeof(u32) / kfd->device_info->doorbell_size; mutex_lock(&kfd->doorbell_mutex); __clear_bit(inx, kfd->doorbell_available_index);