public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Sanford Rockowitz <rockowitz@minsoft.com>
To: linux-i2c@vger.kernel.org
Subject: i2c-dev mismatch with proprietary nvidia driver
Date: Sun, 25 Sep 2022 21:12:54 -0400	[thread overview]
Message-ID: <6330FC96.5030908@minsoft.com> (raw)

I'm not sure where to post this bug report on the Linux side, I have 
already posted it at developer.nvida.com.  If there's a more appropriate 
location, please let me know.

At approximately line 41 of nvidia driver file nv-i2c.c, in function 
nv_i2c_algo_master_transfer(), there's an if-test for symbol 
I2C_M_DMA_SAFE.  If the symbol is not defined, a call to the function 
with the bit set fails with error -EINVAL. The file includes 
"linux/i2c.h", so apparently there are versions of I2c.h in which the 
flag is undefined.

At approximately line 262 of i2c-dev driver file i2c-dev.c, in function  
i2cdev_ioctl_wdrw(), this bit is set unconditionally, with the comment 
"memdup_user allocates with GFP_KERNEL, so DMA is ok ". This behavior is 
not the result of the userspace caller setting the flag, the driver sets 
it unconditionally. The result is that calls into i2c-dev using its 
ioctl() interface, as opposed to the read()/write() interface, always 
fail with error EINVAL.

Every version of i2c.h that I have defines I2C_M_DMA_SAFE, so the 
version of the nvidia driver that DKMS builds for me works. However, as 
the developer of ddcutil (https://github.com/rockowitz/ddcutil, 
https://www.ddcutil.com) I receive bug reports of failures with the 
nvidia proprietary driver due to this mismatch, so it is a problem.



I

             reply	other threads:[~2022-09-26  1:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  1:12 Sanford Rockowitz [this message]
2022-09-28 19:16 ` i2c-dev mismatch with proprietary nvidia driver Wolfram Sang
2022-09-29 16:21   ` Sanford Rockowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6330FC96.5030908@minsoft.com \
    --to=rockowitz@minsoft.com \
    --cc=linux-i2c@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox