mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: jayalk@intworks.biz
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	linux-pci@atrey.karlin.mff.cuni.cz
Subject: Re: [PATCH 2.6.11.2 1/1] PCI Allow OutOfRange PIRQ table address
Date: Thu, 10 Mar 2005 13:42:19 +0000	[thread overview]
Message-ID: <20050310134219.GE21986@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <200503101329.j2ADTZU0030146@intworks.biz>

On Thu, Mar 10, 2005 at 05:29:35AM -0800, jayalk@intworks.biz wrote:

Nice work, I like it.  You could make it even prettier:

> diff -uprN -X dontdiff linux-2.6.11.2-vanilla/arch/i386/pci/irq.c linux-2.6.11.2/arch/i386/pci/irq.c
> --- linux-2.6.11.2-vanilla/arch/i386/pci/irq.c	2005-03-10 16:31:25.000000000 +0800
> +++ linux-2.6.11.2/arch/i386/pci/irq.c	2005-03-10 20:43:02.479487640 +0800
> @@ -58,6 +58,35 @@ struct irq_router_handler {
>  int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL;
>  
>  /*
> + *  Check passed address for the PCI IRQ Routing Table signature 
> + *  and perform checksum verification.
> + */
> +
> +static inline struct irq_routing_table * __init pirq_check_routing_table(u8 *addr)
> +{
> +	struct irq_routing_table *rt;
> +	int i;
> +	u8 sum;
> +
> +	rt = (struct irq_routing_table *) addr;

static inline struct irq_routing_table * __init pirq_check_routing_table(unsigned long phys)
{
	struct irq_routing_table *rt = __va(phys);
[...]

> @@ -65,21 +94,16 @@ static struct irq_routing_table * __init
>  {
>  	u8 *addr;

	unsigned long addr;

>  	struct irq_routing_table *rt;
> -	int i;
> -	u8 sum;
>  
> +	if (pirq_table_addr) {
> +		rt = pirq_check_routing_table((u8 *) __va(pirq_table_addr));
> +		if (rt) {
> +			return rt;
> +		}
> +	}

	if (pirq_table_addr) {
		rt = pirq_check_routing_table(pirq_table_addr);
		if (rt)
			return rt;
	}

Should we fall back to searching if someone's specified an address?  If not,
it becomes even simpler:

	if (pirq_table_addr) {
		return pirq_check_routing_table(pirq_table_addr);
	}

>  	for(addr = (u8 *) __va(0xf0000); addr < (u8 *) __va(0x100000); addr += 16) {

This loop would become:

	for (addr = 0xf0000; addr < 0x100000; addr += 16) {

> @@ -27,6 +27,7 @@
>  #define PCI_ASSIGN_ALL_BUSSES	0x4000
>  
>  extern unsigned int pci_probe;
> +extern unsigned int pirq_table_addr;

Completely nitpicking, but I think this should be an unsigned long rather
than an int -- physical addresses are normally expressed in terms of
unsigned long.

> +		pirqaddr=0xAAAAA	[IA-32] Specify the physical address
> +					of the PIRQ table (normally generated
> +					by the BIOS) if it is outside the .  
> +					F0000h-100000h range.

And you even bothered to update the documentation!  This is definitely
a cut above most of the patches I review ;-)

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

  reply	other threads:[~2005-03-10 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-10 13:29 jayalk
2005-03-10 13:42 ` Matthew Wilcox [this message]
2005-03-11 12:44   ` jayalk
2005-03-17  1:16 jayalk
2005-03-17  1:24 jayalk
2005-03-17  3:34 ` Randy.Dunlap
2005-03-17  6:36 jayalk
2005-03-17  6:50 jayalk
2005-03-22  4:20 jayalk

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=20050310134219.GE21986@parcelfarce.linux.theplanet.co.uk \
    --to=matthew@wil.cx \
    --cc=gregkh@suse.de \
    --cc=jayalk@intworks.biz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /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

Powered by JetHome