From patchwork Fri Nov 21 08:51:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 5353541 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B25D9F387 for ; Fri, 21 Nov 2014 08:52:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B745F20160 for ; Fri, 21 Nov 2014 08:52:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DD2E72015D for ; Fri, 21 Nov 2014 08:52:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 352416F049; Fri, 21 Nov 2014 00:52:18 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0115.outbound.protection.outlook.com [157.56.111.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 98AE56F049 for ; Fri, 21 Nov 2014 00:52:17 -0800 (PST) Received: from BLUPR02MB195.namprd02.prod.outlook.com (10.242.189.157) by BLUPR02MB099.namprd02.prod.outlook.com (10.242.188.23) with Microsoft SMTP Server (TLS) id 15.1.16.15; Fri, 21 Nov 2014 08:52:16 +0000 Received: from BY1PR0201CA0028.namprd02.prod.outlook.com (25.160.191.166) by BLUPR02MB195.namprd02.prod.outlook.com (10.242.189.157) with Microsoft SMTP Server (TLS) id 15.1.26.15; Fri, 21 Nov 2014 08:52:15 +0000 Received: from BN1BFFO11FD021.protection.gbl (2a01:111:f400:7c10::1:136) by BY1PR0201CA0028.outlook.office365.com (2a01:111:e400:4814::38) with Microsoft SMTP Server (TLS) id 15.1.26.15 via Frontend Transport; Fri, 21 Nov 2014 08:52:14 +0000 Received: from atltwp01.amd.com (165.204.84.221) by BN1BFFO11FD021.mail.protection.outlook.com (10.58.144.84) with Microsoft SMTP Server id 15.1.6.13 via Frontend Transport; Fri, 21 Nov 2014 08:52:14 +0000 X-WSS-ID: 0NFDSN0-07-FJ3-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2F7D6CAE668 for ; Fri, 21 Nov 2014 02:52:11 -0600 (CST) Received: from SATLEXDAG01.amd.com (10.181.40.3) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 21 Nov 2014 02:52:32 -0600 Received: from odedg-kaveri.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 21 Nov 2014 03:52:10 -0500 From: Oded Gabbay To: Subject: [PATCH 11/12] amdkfd: Instead of using get function, use container_of Date: Fri, 21 Nov 2014 10:51:59 +0200 Message-ID: <1416559920-7779-2-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416559920-7779-1-git-send-email-oded.gabbay@amd.com> References: <1416559111-5900-1-git-send-email-oded.gabbay@amd.com> <1416559920-7779-1-git-send-email-oded.gabbay@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-EOPAttributedMessage: 0 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=Oded.Gabbay@amd.com; X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(428002)(199003)(189002)(21056001)(102836001)(50986999)(450100001)(77156002)(64706001)(106466001)(62966003)(46102003)(575784001)(104166001)(87936001)(76176999)(2351001)(50226001)(48376002)(229853001)(4396001)(101416001)(99396003)(86362001)(107046002)(93916002)(20776003)(53416004)(77096003)(47776003)(50466002)(84676001)(88136002)(31966008)(95666004)(19580395003)(92566001)(19580405001)(44976005)(97736003)(105586002)(36756003)(68736004)(89996001)(33646002)(92726001)(120916001)(110136001)(87286001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR02MB195; H:atltwp01.amd.com; FPR:; SPF:None; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB195; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB195; X-Forefront-PRVS: 0402872DA1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB195; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB099; X-OriginatorOrg: amd4.onmicrosoft.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alexey Skidanov Signed-off-by: Alexey Skidanov Signed-off-by: Oded Gabbay --- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++------------ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index bc8961c3..904eb38 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -67,26 +67,21 @@ static inline unsigned int get_pipes_num_cpsch(void) return PIPE_PER_ME_CP_SCHEDULING; } -static unsigned int get_sh_mem_bases_nybble_64(struct kfd_process *process, - struct kfd_dev *dev) +static inline unsigned int +get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd) { - struct kfd_process_device *pdd; uint32_t nybble; - pdd = kfd_get_process_device_data(dev, process, 1); nybble = (pdd->lds_base >> 60) & 0x0E; return nybble; } -static unsigned int get_sh_mem_bases_32(struct kfd_process *process, - struct kfd_dev *dev) +static inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd) { - struct kfd_process_device *pdd; unsigned int shared_base; - pdd = kfd_get_process_device_data(dev, process, 1); shared_base = (pdd->lds_base >> 16) & 0xFF; return shared_base; @@ -96,10 +91,13 @@ static uint32_t compute_sh_mem_bases_64bit(unsigned int top_address_nybble); static void init_process_memory(struct device_queue_manager *dqm, struct qcm_process_device *qpd) { + struct kfd_process_device *pdd; unsigned int temp; BUG_ON(!dqm || !qpd); + pdd = qpd_to_pdd(qpd); + /* check if sh_mem_config register already configured */ if (qpd->sh_mem_config == 0) { qpd->sh_mem_config = @@ -111,11 +109,11 @@ static void init_process_memory(struct device_queue_manager *dqm, } if (qpd->pqm->process->is_32bit_user_mode) { - temp = get_sh_mem_bases_32(qpd->pqm->process, dqm->dev); + temp = get_sh_mem_bases_32(pdd); qpd->sh_mem_bases = SHARED_BASE(temp); qpd->sh_mem_config |= PTR32; } else { - temp = get_sh_mem_bases_nybble_64(qpd->pqm->process, dqm->dev); + temp = get_sh_mem_bases_nybble_64(pdd); qpd->sh_mem_bases = compute_sh_mem_bases_64bit(temp); } @@ -707,8 +705,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) destroy_queues_cpsch(dqm, true); list_for_each_entry(node, &dqm->queues, list) { - pdd = kfd_get_process_device_data(dqm->dev, - node->qpd->pqm->process, 1); + pdd = qpd_to_pdd(node->qpd); pdd->bound = false; } kfd2kgd->free_mem(dqm->dev->kgd, diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index d0bcafc..f9fb81e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -414,6 +414,8 @@ struct kfd_process_device { bool bound; }; +#define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd) + /* Process data */ struct kfd_process { /*