From patchwork Wed Jan 30 01:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bas Nieuwenhuizen X-Patchwork-Id: 10787553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A26AE91E for ; Wed, 30 Jan 2019 01:54:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95DBC2C5FD for ; Wed, 30 Jan 2019 01:54:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A29C2D2C5; Wed, 30 Jan 2019 01:54:49 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 4C45D2C5FD for ; Wed, 30 Jan 2019 01:54:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAF5E6EAAD; Wed, 30 Jan 2019 01:54:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69C4E6E42C for ; Wed, 30 Jan 2019 01:54:39 +0000 (UTC) Received: by mail-ed1-x544.google.com with SMTP id y56so17685186edd.11 for ; Tue, 29 Jan 2019 17:54:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DmDioc5h76SBS6LL4Qm8dI3achc14EwSg+0OtelQiIA=; b=d7JTGNwEAznXYPU5taVUK319x/AuZ2DgNtbLscND900vyiGqXBNLdjYfVQnFIaWQSp UvQ8uyiwAqOCyhVDZ8GN9Su4+owlC4qGMgkKHX0EaibiBFeR2QJyhc6UptB76zAaMOwX PbCix95V/PGwKzC+nxT+5vzow06tCaAZ+ZVIzK2V1Xz19bckxhbpc47o5ijeEKgkEMY6 ttyoxScw407VNslJoEJiXB2BuuyqeqRMB++/eWOImelIYpcgOFJJaxTxXx4QLQz9LdUo psRJZ/hDD249VAb4IsnGIfh1RhotKRpVZyp1M18Q6Obuz5Bmeu7kepWoPUfMvmVprDGu JwKQ== X-Gm-Message-State: AJcUukf4bIHxRQkNNl7ImwLdW7WqfWjOLOsfa0r+BJCx9bXFkVW3sKFy 0xAmTYkwE87DO6eJcGrYYdkB7r93Ozk= X-Google-Smtp-Source: ALg8bN5q+2QgGR9jNIv29lfNTSYsLehPeRQfOXYAQMwG0ZMkUskupxxo07wfe+TdycCwaqrcWMtCeQ== X-Received: by 2002:a50:a844:: with SMTP id j62mr28683136edc.2.1548813277988; Tue, 29 Jan 2019 17:54:37 -0800 (PST) Received: from localhost.localdomain ([2a02:aa12:a77f:2000:7285:c2ff:fe4e:b21b]) by smtp.gmail.com with ESMTPSA id l18sm117157edq.87.2019.01.29.17.54.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 17:54:37 -0800 (PST) From: Bas Nieuwenhuizen To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/4] drm/amdgpu: Only add rqs for initialized rings. Date: Wed, 30 Jan 2019 02:53:20 +0100 Message-Id: <20190130015322.105870-2-bas@basnieuwenhuizen.nl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190130015322.105870-1-bas@basnieuwenhuizen.nl> References: <20190130015322.105870-1-bas@basnieuwenhuizen.nl> 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 I don't see another way to figure out if a ring is initialized if the hardware block might not be initialized. Entities have been fixed up to handle num_rqs = 0. Signed-off-by: Bas Nieuwenhuizen --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index d85184b5b35c..30407e55593b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -124,6 +124,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ring *rings[AMDGPU_MAX_RINGS]; struct drm_sched_rq *rqs[AMDGPU_MAX_RINGS]; unsigned num_rings; + unsigned num_rqs = 0; switch (i) { case AMDGPU_HW_IP_GFX: @@ -166,12 +167,16 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, break; } - for (j = 0; j < num_rings; ++j) - rqs[j] = &rings[j]->sched.sched_rq[priority]; + for (j = 0; j < num_rings; ++j) { + if (rings[j]->adev) { + rqs[num_rqs++] = + &rings[j]->sched.sched_rq[priority]; + } + } for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) r = drm_sched_entity_init(&ctx->entities[i][j].entity, - rqs, num_rings, &ctx->guilty); + rqs, num_rqs, &ctx->guilty); if (r) goto error_cleanup_entities; }