From nobody Thu May 2 13:59:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1594525322; cv=none; d=zohomail.com; s=zohoarc; b=k631RsWiWvvF3wFKIsAqsRJtXYYa5Parfoudg0BsxO6f+VfKMrBZWlekTKGzs9N7FZ3GgJbXxXOkbtO4dofhpMnA9SlNk8+9nu2LlOfBb+kjh2w44HdtkScAEdqmyyKrUmnLG0djdj+5r9SC4FNCQTX4mwXI3lrRpZOxrVD5ZBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594525322; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=0Na8G5VKykvTtXzigo+An7kSY5aR6v2v+sTg/56PP9s=; b=SzwWSeN9JLgCg6s342J52QJOJgHUiMkZORYuxz6sFGPMrJcD/OI1Tl6WqmeqDBAeUTkDy+8KLaJMK9EQvnheZtfRG5R2U/S5rPK9yd3CIJMj/S1cbXUoPSulHr6ba6XCdGpH8z4655QAILYA1QQrIXgR2XsfwyyC7OJXS3n4qOw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594525322457157.5608637708301; Sat, 11 Jul 2020 20:42:02 -0700 (PDT) Received: from localhost ([::1]:57302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juSsJ-0004Hj-Tc for importer@patchew.org; Sat, 11 Jul 2020 23:41:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juSrf-0003sh-QF for qemu-devel@nongnu.org; Sat, 11 Jul 2020 23:41:19 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:54676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juSrc-0002aT-98 for qemu-devel@nongnu.org; Sat, 11 Jul 2020 23:41:19 -0400 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 1633DA1222; Sun, 12 Jul 2020 11:41:09 +0800 (CST) Received: from localhost.localdomain (unknown [223.72.94.78]) by smtp.263.net (postfix) whith ESMTP id P5939T140503804798720S1594525264515776_; Sun, 12 Jul 2020 11:41:09 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 X-UNIQUE-TAG: <5bc714aff7f6d2e0be977ff37281f4e9> X-RL-SENDER: chengang@emindsoft.com.cn X-SENDER: chengang@emindsoft.com.cn X-LOGIN-NAME: chengang@emindsoft.com.cn X-FST-TO: riku.voipio@iki.fi X-SENDER-IP: 223.72.94.78 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: chengang@emindsoft.com.cn To: riku.voipio@iki.fi, laurent@vivier.eu Subject: [PATCH] linux-user: syscall: ioctls: support DRM_IOCTL_I915_GETPARAM Date: Sun, 12 Jul 2020 11:41:02 +0800 Message-Id: <20200712034102.23355-1-chengang@emindsoft.com.cn> X-Mailer: git-send-email 2.24.0.308.g228f53135a MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=211.157.147.135; envelope-from=chengang@emindsoft.com.cn; helo=lucky1.263xmail.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/11 23:41:10 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chengang@emindsoft.com.cn, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Chen Gang It is for i915 drm command, and next, I shall send another i915 commands implementations. Signed-off-by: Chen Gang --- linux-user/ioctls.h | 3 +++ linux-user/syscall.c | 39 ++++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 9 +++++++++ linux-user/syscall_types.h | 4 ++++ 4 files changed, 55 insertions(+) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index f2e2fa9c87..83e045deba 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -577,6 +577,9 @@ #ifdef HAVE_DRM_H IOCTL_SPECIAL(DRM_IOCTL_VERSION, IOC_RW, do_ioctl_drm, MK_PTR(MK_STRUCT(STRUCT_drm_version))) + + IOCTL_SPECIAL(DRM_IOCTL_I915_GETPARAM, IOC_RW, do_ioctl_drm_i915, + MK_PTR(MK_STRUCT(STRUCT_drm_i915_getparam))) #endif =20 #ifdef TARGET_TIOCSTART diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 17ed7f8d6b..6fab9064af 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -114,6 +114,7 @@ #include #ifdef HAVE_DRM_H #include +#include #endif #include "linux_loop.h" #include "uname.h" @@ -5372,6 +5373,44 @@ static abi_long do_ioctl_drm(const IOCTLEntry *ie, u= int8_t *buf_temp, return -TARGET_ENOSYS; } =20 +static abi_long do_ioctl_drm_i915_getparam(const IOCTLEntry *ie, + struct drm_i915_getparam *gpara= m, + int fd, abi_long arg) +{ + abi_long ret; + struct target_drm_i915_getparam *target_gparam; + + if (!lock_user_struct(VERIFY_READ, target_gparam, arg, 0)) { + return -TARGET_EFAULT; + } + __get_user(gparam->param, &target_gparam->param); + gparam->value =3D lock_user(VERIFY_WRITE, target_gparam->value, + sizeof(*gparam->value), 0); + if (!gparam->value) { + unlock_user_struct(target_gparam, arg, 0); + return -TARGET_EFAULT; + } + + ret =3D get_errno(safe_ioctl(fd, ie->host_cmd, gparam)); + + unlock_user(gparam->value, target_gparam->value, sizeof(*gparam->value= )); + unlock_user_struct(target_gparam, arg, 0); + return ret; +} + +static abi_long do_ioctl_drm_i915(const IOCTLEntry *ie, uint8_t *buf_temp, + int fd, int cmd, abi_long arg) +{ + switch (ie->host_cmd) { + case DRM_IOCTL_I915_GETPARAM: + return do_ioctl_drm_i915_getparam(ie, + (struct drm_i915_getparam *)buf_= temp, + fd, arg); + default: + return -TARGET_ENOSYS; + } +} + #endif =20 static IOCTLEntry ioctl_entries[] =3D { diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 3c261cff0e..9082f6c2bc 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1170,6 +1170,9 @@ struct target_rtc_pll_info { /* drm ioctls */ #define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00) =20 +/* drm i915 ioctls */ +#define TARGET_DRM_IOCTL_I915_GETPARAM TARGET_IOWRU('d', 0x46) + /* from asm/termbits.h */ =20 #define TARGET_NCC 8 @@ -2613,6 +2616,12 @@ struct target_drm_version { abi_ulong desc; }; =20 +struct target_drm_i915_getparam { + int param; + abi_ulong value; +}; + + #include "socket.h" =20 #include "errno_defs.h" diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h index e2b0484f50..ef60d5f38c 100644 --- a/linux-user/syscall_types.h +++ b/linux-user/syscall_types.h @@ -303,6 +303,10 @@ STRUCT(drm_version, TYPE_ULONG, /* desc_len */ TYPE_PTRVOID) /* desc */ =20 +STRUCT(drm_i915_getparam, + TYPE_INT, /* param */ + TYPE_PTRVOID) /* value */ + STRUCT(file_clone_range, TYPE_LONGLONG, /* src_fd */ TYPE_ULONGLONG, /* src_offset */ --=20 2.24.0.308.g228f53135a