nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tomek LECOCQ <tomek.lecocq@hotmail.fr>
To: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Subject: Re: [Nouveau] How to reverse engineer a PCI-Express driver under Linux ?
Date: Wed, 3 Mar 2021 14:44:06 +0000	[thread overview]
Message-ID: <B2949E39-3A54-4605-9A56-AF67CCD2813D@hotmail.fr> (raw)
In-Reply-To: <CAKb7UvgDGDJdVW_P_-rZCXqPo9b6yhcTAjCSF2FOOrhJ4ek5xA@mail.gmail.com>



On 3 Mar 2021, at 14:09, Ilia Mirkin <imirkin@alum.mit.edu> wrote:

> On Wed, Mar 3, 2021 at 5:30 AM Karol Herbst <kherbst@redhat.com> wrote:
>> 
>> 
>> Usually drivers map PCIe bars into the VM and read/write at certain offsets to do.. stuff. In the linux kernel we have the mmiotrace tracer in order to capture what a driver does with the hardware. You still need to interpret the trace file, but at least this should give you the raw data on what's going on. Hope that helps.
> 
> Here's a good guide on how to use mmiotrace. It's nvidia-focused, but
> the same steps would apply to any driver:
> https://wiki.ubuntu.com/X/MMIOTracing
> 
> Basically, start mmiotrace, load target driver, do some stuff, stop
> mmiotrace, analyze the resulting trace.
> 
> We have some tooling to help with that -- envytools/rnn/demmio will
> parse the mmiotrace against a given rnndb (also in envytools). You
> won't be able to reuse our rnndb, but you'd be able to build up your
> own. You also wouldn't be able to use demmio directly, but you could
> see how it works and modify it to your hw's needs. (e.g. it waits for
> a read of the "0" mmio reg to determine which chip is being traced,
> and loads up the appropriate rnndb settings - that won't work with
> your hw out of the box.)
> 

Thank you to both of you for the very useful tips and the link to this tutorial. This was exactly what I was looking for.

>>> Also, the long term goal of this project would be to have this driver merged into mainline, so what is allowed or not while doing this to avoid problematic legal ramifications ?
> 
> This isn't legal advice (for that, consult a lawyer), however a few
> things that are definitely going to get you into trouble:
> 
> - stealing (or using stolen) documentation
> - de-compiling target driver and copying its implementation (as that
> would be subject to copyright)

Yes, I’m not using anything stolen (all the resources I have are publicly available on the card producer’s website).
I’ve also contacted local open-source NGOs about the legal questions, I live in France and the law here is quite different to the US for those kind of things.

Regards.
Tomek


_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

      reply	other threads:[~2021-03-03 14:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 10:07 [Nouveau] How to reverse engineer a PCI-Express driver under Linux ? Tomek LECOCQ
2021-03-03 10:30 ` Karol Herbst
2021-03-03 13:09   ` Ilia Mirkin
2021-03-03 14:44     ` Tomek LECOCQ [this message]

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=B2949E39-3A54-4605-9A56-AF67CCD2813D@hotmail.fr \
    --to=tomek.lecocq@hotmail.fr \
    --cc=imirkin@alum.mit.edu \
    --cc=nouveau@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).