From patchwork Mon Apr 3 08:27:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicolai_H=C3=A4hnle?= X-Patchwork-Id: 9658939 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 F2AA460352 for ; Mon, 3 Apr 2017 08:27:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E281C28450 for ; Mon, 3 Apr 2017 08:27:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6E172845E; Mon, 3 Apr 2017 08:27:39 +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 9F7F128450 for ; Mon, 3 Apr 2017 08:27:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8073D6E2D8; Mon, 3 Apr 2017 08:27:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EEF36E2CE; Mon, 3 Apr 2017 08:27:34 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id w43so31290809wrb.1; Mon, 03 Apr 2017 01:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6DTuiPPmFc0g2y45ND5iG40IVRKikHaqXdNKpEiJrHU=; b=s8J5YGad9rs75N+sg72+pv3AIqYmerlwRFvpDh4SBiE2vqb0ISriMFd4A5FNzb+DWZ c90ZQY8DNmQ/FBvaz9mE+cGZV1BD95I1/zlYXDpQnpDhZywDNoixyg0qAgXkYCcCHZ3H jediki3qh2xz5Km8OvI7y0cNuNXyGTu6VQ0D3k4yjX4ISteOjaLtWPSpAh/BOaVJOE4h OH2C5RHY++baEgx10/4meSQduqjx8hPg90LHyLLhrQbZbBI7joRRFGK8Vqr7RrtSnKiI uB/MsJIqxrDZB8TA4zGXJYOl/sG4Ki9z/qwJCw5xyuYvNVSnuuZB69Q7DMxUBWW/Jo+G PEYw== 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=6DTuiPPmFc0g2y45ND5iG40IVRKikHaqXdNKpEiJrHU=; b=apUMyjzLGqB1HKAh9MA/1kJHO5Ql5P6/ZmGnv8tn/f0lsQ15jl3HqgvQ4dgXXQxmCz wxD3PhaNWOftIM9yC1AaPaeYwwAh7R+hfzPzqhvqXyaNYmdXADk4YZgMKR3CF9hcfBCq 0gx+1iUz8CWDa7eyurmWh+aWkQWSUlQ1fxp6wK3ouTGtOJSyrl0eb/MPGKW42VkiDvbv 4OvtkYHSebEvTt7MqVAGK0vFGvDt9jVltGVy12MRL9tl/WTxbTTPm5cP0EghAZzLgHHl 4D4YJIGANeGroyHOgcxNp7jrooPIRAsSHV7/xa11RKc5E7QaXSxVyF3NAQN8IuXDheRU 7syw== X-Gm-Message-State: AFeK/H36j3Qo+7tw4C9TU2AmBH6G7riBK4z+/PDq+zqh/ACjmKKK+08yGqox+Db3VL6GVw== X-Received: by 10.28.194.7 with SMTP id s7mr8478328wmf.34.1491208053152; Mon, 03 Apr 2017 01:27:33 -0700 (PDT) Received: from capella.fritz.box (ppp-93-104-81-181.dynamic.mnet-online.de. [93.104.81.181]) by smtp.gmail.com with ESMTPSA id k32sm17096529wre.18.2017.04.03.01.27.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 01:27:32 -0700 (PDT) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: amd-gfx@lists.freedesktop.org Subject: [PATCH libdrm 3/3] amdgpu: add REPLACE and CLEAR checking for VA op (v2) Date: Mon, 3 Apr 2017 10:27:20 +0200 Message-Id: <20170403082720.13166-3-nhaehnle@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170403082720.13166-1-nhaehnle@gmail.com> References: <20170403082720.13166-1-nhaehnle@gmail.com> MIME-Version: 1.0 Cc: Junwei Zhang , =?UTF-8?q?Nicolai=20H=C3=A4hnle?= , dri-devel@lists.freedesktop.org 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-Virus-Scanned: ClamAV using ClamSMTP From: Junwei Zhang v2: fix indent Signed-off-by: Junwei Zhang Reviewed-by: Nicolai Hähnle Reviewed-by: Christian König Reviewed-by: Marek Olšák Acked-by: Emil Velikov --- amdgpu/amdgpu_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index f725bfd..8bc1ebd 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -696,21 +696,23 @@ int amdgpu_bo_va_op_raw(amdgpu_device_handle dev, amdgpu_bo_handle bo, uint64_t offset, uint64_t size, uint64_t addr, uint64_t flags, uint32_t ops) { struct drm_amdgpu_gem_va va; int r; - if (ops != AMDGPU_VA_OP_MAP && ops != AMDGPU_VA_OP_UNMAP) + if (ops != AMDGPU_VA_OP_MAP && ops != AMDGPU_VA_OP_UNMAP && + ops != AMDGPU_VA_OP_REPLACE && ops != AMDGPU_VA_OP_CLEAR) + return -EINVAL; memset(&va, 0, sizeof(va)); va.handle = bo ? bo->handle : 0; va.operation = ops; va.flags = flags; va.va_address = addr; va.offset_in_bo = offset; va.map_size = size;