public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: <eiichiro.oiwa.nm@hitachi.com>
To: "David Miller" <davem@davemloft.net>
Cc: <jesse.barnes@intel.com>, <alan@redhat.com>, <greg@kroah.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re[2]: pci_fixup_video change blows up on sparc64
Date: Fri, 20 Oct 2006 13:25:17 +0900	[thread overview]
Message-ID: <XNM1$9$0$4$$3$3$7$A$9002711U45384fa7@hitachi.com> (raw)
In-Reply-To: 20061019.202117.123674883.davem@davemloft.net

From: David Miller <davem@davemloft.net>
>From: <eiichiro.oiwa.nm@hitachi.com>
>Date: Fri, 20 Oct 2006 11:57:06 +0900
>
>> I am sorry. I assumed ROM base address will be 0xc0000 if VGA Enable
>> bit in Bridge Control Register set. This assuming is incorrect.
>
>Please also notice another point we are trying to explain in this
>thread, in fact several times.
>
>This "bridge control register" is only valid for "PCI to PCI" bridges.
>
>I repeat:
>
>	This "bridge control register" is only valid for "PCI to PCI"
>	bridges.
>
>It is not valid for "host to PCI" bridges, yet the pci_fixup_video()
>code is testing the bridge control register, blindly, in every bus
>device it sees as it walks up the device tree to the root.
>
>The bridge control register is valid for PCI header type BRIDGE, or
>CARDBUS.  Host to PCI controllers use PCI header type NORMAL.  For
>example, here is the lspci dump for my host bridge:
>
>0000:00:00.0 Host bridge: Sun Microsystems Computer Corp. Tomatillo PCI Bus Module
>00: 8e 10 01 a8 46 01 a0 22 00 00 00 06 00 40 00 00
>
>and here is a dump for a PCI->PCI bridge in the same machine:
>
>0000:00:02.0 PCI bridge: Texas Instruments PCI2250 PCI-to-PCI Bridge (rev 02)
>00: 4c 10 23 ac 07 00 10 02 02 00 04 06 10 40 01 00
>
>Clearly, the host bridge has PCI header type 0x00 (NORMAL) at offset
>0x0e, and the PCI-PCI bridge has header type 0x01 (BRIDGE).
>
>Back to the code, look at the loop:
>
>	bus = pdev->bus;
>	while (bus) {
>		bridge = bus->self;
>		if (bridge) {
>			pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
>						&config);
>			if (!(config & PCI_BRIDGE_CTL_VGA))
>				return;
>		}
>		bus = bus->parent;
>	}
>
>Where is it making sure that this is a PCI to PCI bus and not a
>host to PCI bus?  It's not, and that's a serious bug.  There should
>be a PCI header type check here, or similar.  The PCI device probing
>layer correctly checks the PCI header type before trying to access
>the bridge control register of any PCI device.
>
>And also, it is also true that the ioremap() calls done by
>pci_map_rom() for the "0xc0000" case are totally invalid.  For several
>reasons:
>
>1) That is going to be RAM, not I/O memory space, therefore accessing
>   it with ioremap() and asm/io.h accessors such as readl() and
>   memcpy_fromio() will result in bus errors and other faults.
>
>2) It is illegal to pass raw physical addresses to ioremap() as the
>   first argument.  The first argument to ioremap() is an architecture
>   defined opaque "address cookie" which by definition must be setup
>   by platform specific code.
>
>Just copying the x86 code over to IA64 to 'fix the problem' doesn't
>fix any of these bugs (illegal access to bridge control register on
>devices with PCI header type NORMAL) or portability problems (invalid
>first argument to ioremap()).
>
I am sorry again. I understood we need to fix pci_fixup_video and ...

Thank you for your good comments.


  reply	other threads:[~2006-10-20  4:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19  6:31 pci_fixup_video change blows up on sparc64 David Miller
2006-10-19  7:54 ` eiichiro.oiwa.nm
2006-10-19  8:37   ` pci_fixup_video " David Miller
2006-10-19  9:22     ` Alan Cox
2006-10-19  9:25       ` David Miller
2006-10-19 10:49         ` eiichiro.oiwa.nm
2006-10-19 22:32           ` David Miller
2006-10-20  2:41             ` Greg KH
2006-10-20  3:21               ` eiichiro.oiwa.nm
2006-10-20  4:03                 ` Greg KH
2006-10-20  4:28                   ` eiichiro.oiwa.nm
2006-10-20 14:20                   ` eiichiro.oiwa.nm
2006-10-20 19:31                     ` David Miller
2006-10-23  6:14                       ` eiichiro.oiwa.nm
2006-10-23  8:53                         ` David Miller
2006-10-23 18:39                           ` Greg KH
2006-10-23 21:02                             ` David Miller
2006-10-27 18:05                         ` patch pci-fix-pci_fixup_video-as-it-blows-up-on-sparc64.patch added to gregkh-2.6 tree gregkh
2006-10-19 10:01     ` Re[2]: pci_fixup_video change blows up on sparc64 eiichiro.oiwa.nm
2006-10-19 11:20       ` Alan Cox
2006-10-19 11:38         ` eiichiro.oiwa.nm
2006-10-19 18:03       ` Jesse Barnes
2006-10-19 22:58         ` David Miller
2006-10-20  2:57           ` eiichiro.oiwa.nm
2006-10-20  3:21             ` David Miller
2006-10-20  4:25               ` eiichiro.oiwa.nm [this message]
2006-10-19 16:52     ` Jesse Barnes
2006-10-19 22:38       ` David Miller
2006-10-19 22:58         ` Jesse Barnes
2006-10-19 23:17           ` David Miller

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='XNM1$9$0$4$$3$3$7$A$9002711U45384fa7@hitachi.com' \
    --to=eiichiro.oiwa.nm@hitachi.com \
    --cc=alan@redhat.com \
    --cc=davem@davemloft.net \
    --cc=greg@kroah.com \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@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