From: Mark Lord <mlord@pobox.com>
To: linux-kernel@vger.kernel.org, yinghai@kernel.org, tytso@mit.edu
Subject: driver skip pci_set_master, fix it? No.
Date: Tue, 08 Apr 2014 12:34:37 -0400 [thread overview]
Message-ID: <5344251D.7040805@pobox.com> (raw)
I am working a couple of drivers for chips that perform extensive bus-mastering ops.
These including full SRIOV support, and allow assigning virtual functions to virtual machines, etc.
One thing the driver (still in development) does for safety,
is defer the call to pci_set_master() until *after* it has mapped
the MMIO space of the chips, so it can reset/flush the DMA engines
before giving them permission to scribble over host RAM.
But a recent patch to the kernel has removed this from the driver's control.
The core PCI now does pci_set_master() immediately on pci_enable_device().
This could be catastrophic in some situations, depending upon the state
of the DMA engines in the device. If they have "leftovers" from a previous "life"
(or a previous VM assignment), then they'll immediately resume accessing host RAM
as soon as the driver calls pci_enable_device(), courtesy of the embedded call
to pci_set_master().
This isn't good, and these may not be the only devices affected in this way.
Can we perhaps not do that, or provide some other way to return control of bus-mastering
to the device driver ?
--
mlord@pobox.com
Mark Lord
next reply other threads:[~2014-04-08 16:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 16:34 Mark Lord [this message]
2014-04-08 18:27 ` driver skip pci_set_master, fix it? No Bjorn Helgaas
2014-04-08 21:18 ` Mark Lord
2014-04-09 2:51 ` Benjamin Herrenschmidt
2014-04-09 13:08 ` Mark Lord
2014-04-09 14:12 ` Mark Lord
2014-04-09 14:18 ` Mark Lord
2014-04-09 15:52 ` Bjorn Helgaas
2014-04-09 16:40 ` Mark Lord
2014-04-09 17:26 ` Bjorn Helgaas
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=5344251D.7040805@pobox.com \
--to=mlord@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yinghai@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;
as well as URLs for NNTP newsgroup(s).