public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>,
	Alex Chiang <achiang@hp.com>, Yu Zhao <yu.zhao@intel.com>,
	Matthew Wilcox <willy@linux.intel.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	gleb@redhat.com
Subject: [PATCH] pci: fix nit in ROM BAR size probing
Date: Thu, 29 Oct 2009 17:24:59 +0200	[thread overview]
Message-ID: <20091029152459.GA5480@redhat.com> (raw)

When probing for ROM BAR size, we should not
change bits 1:10 in this BAR, because these
bits are marked as "reserved for future use" in PCI spec,
so changing them might have side effects.

No such issue for I/O or memory, as there is
an implementation note in PCI spec which explicitly allows
writing 0xfffffffff there.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/pci/probe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8105e32..d65aae4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -163,12 +163,12 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 {
 	u32 l, sz, mask;
 
-	mask = type ? ~PCI_ROM_ADDRESS_ENABLE : ~0;
+	mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
 
 	res->name = pci_name(dev);
 
 	pci_read_config_dword(dev, pos, &l);
-	pci_write_config_dword(dev, pos, mask);
+	pci_write_config_dword(dev, pos, l | mask);
 	pci_read_config_dword(dev, pos, &sz);
 	pci_write_config_dword(dev, pos, l);
 
-- 
1.6.5.rc2

             reply	other threads:[~2009-10-29 15:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 15:24 Michael S. Tsirkin [this message]
2009-11-04 17:04 ` [PATCH] pci: fix nit in ROM BAR size probing Jesse Barnes
2009-11-04 17:06   ` Michael S. Tsirkin
2009-11-04 17:14     ` Jesse Barnes

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=20091029152459.GA5480@redhat.com \
    --to=mst@redhat.com \
    --cc=achiang@hp.com \
    --cc=gleb@redhat.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=willy@linux.intel.com \
    --cc=yu.zhao@intel.com \
    /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