From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 654C2C7618B for ; Fri, 17 Mar 2023 12:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbjCQMNl (ORCPT ); Fri, 17 Mar 2023 08:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjCQMNh (ORCPT ); Fri, 17 Mar 2023 08:13:37 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21FFDCA1E0 for ; Fri, 17 Mar 2023 05:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=VCIAue9sPRRBRwR7VXuYy3+00JJGub0y0AdfNvYDsPA=; b=LlhCielTqX7+UtDofy9HguL/oQ rqCFRRUsBa3vHPRLBW381bTj/ELcx4pJL9haBsXunGpE7cYlJqqeW2XYC80LXDySAVpZk5DZ1HstL t+ziIa7QJjb5yVVM/gOv4VJKGX5aDPp/35VurpFRucRtD+PSq747ANhcL4xVx7K7cViuKPOZPlPcG yh5TXOCjA10lGy1glK0X94AYMr2Bsizj1rnhX5fsJQEMAzMhkQHbxjRM2QlDSxPyknSJt6Siocd9O rYsCW3oayxUwJNWvk4EoWZGGecUjlmGlCPbgflD8plm957/jwaRqnGgmforuBwuKz05cTPf3aA8fo 56To5DxQ==; Received: from [177.34.168.16] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pd8xZ-00FrGz-7y; Fri, 17 Mar 2023 13:13:25 +0100 From: =?UTF-8?q?Ma=C3=ADra=20Canal?= To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , Asahi Lina , Faith Ekstrand Cc: rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org, Melissa Wen , =?UTF-8?q?Ma=C3=ADra=20Canal?= Subject: [RFC PATCH 5/9] rust: drm: gem: shmem: set map_wc on gem_create_object callback Date: Fri, 17 Mar 2023 09:12:09 -0300 Message-Id: <20230317121213.93991-6-mcanal@igalia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317121213.93991-1-mcanal@igalia.com> References: <20230317121213.93991-1-mcanal@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: rust-for-linux@vger.kernel.org Some drivers use the gem_create_object callback to define the mapping of the object write-combined (map_wc). Currently, the DRM Rust abstractions doesn't allow such operation. So, add a constant to the DriverObject trait to allow drivers to set map_wc on the gem_create_object callback. By default, the constant returns false, which is the shmem default value. Signed-off-by: MaĆ­ra Canal --- rust/kernel/drm/gem/shmem.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs index 8f17eba0be99..d6c56b3cfa71 100644 --- a/rust/kernel/drm/gem/shmem.rs +++ b/rust/kernel/drm/gem/shmem.rs @@ -24,6 +24,9 @@ use gem::BaseObject; pub trait DriverObject: gem::BaseDriverObject> { /// Parent `Driver` for this object. type Driver: drv::Driver; + + /// Define the map object write-combined + const MAP_WC: bool = false; } // FIXME: This is terrible and I don't know how to avoid it @@ -110,6 +113,8 @@ unsafe extern "C" fn gem_create_object( let new: &mut Object = unsafe { &mut *(p as *mut _) }; new.obj.base.funcs = &Object::::VTABLE; + new.obj.map_wc = ::MAP_WC; + &mut new.obj.base } -- 2.39.2