* [PATCH] add hook for PCI resource deallocation
@ 2004-09-16 12:54 Kenji Kaneshige
2004-09-17 21:49 ` Greg KH
2004-09-24 20:02 ` Ashok Raj
0 siblings, 2 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-09-16 12:54 UTC (permalink / raw)
To: akpm, greg, linux-kernel
Hi,
This patch adds a hook 'pcibios_disable_device()' into
pci_disable_device() to call architecture specific PCI resource
deallocation code. It's a opposite part of pcibios_enable_device().
We need this hook to deallocate architecture specific PCI resource
such as IRQ resource, etc.. This patch is just for adding the hook,
so pcibios_disable_device() is defined as a null function on all
architecture so far.
I tested this patch on i386, x86_64 and ia64. But it has not been
tested on other architectures because I don't have these machines.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
linux-2.6.9-rc2-kanesige/arch/alpha/kernel/pci.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/arm/kernel/bios32.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/i386/pci/common.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/ia64/pci/pci.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/m68knommu/kernel/comempci.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/mips/pci/pci.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/mips/pmc-sierra/yosemite/ht.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/parisc/kernel/pci.c | 6 ++++++
linux-2.6.9-rc2-kanesige/arch/ppc/kernel/pci.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/ppc64/kernel/pci.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/sh/boards/overdrive/galileo.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/sh/drivers/pci/pci.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/sh64/kernel/pcibios.c | 5 +++++
linux-2.6.9-rc2-kanesige/arch/sparc/kernel/pcic.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/sparc64/kernel/pci.c | 4 ++++
linux-2.6.9-rc2-kanesige/arch/v850/kernel/rte_mb_a_pci.c | 6 ++++++
linux-2.6.9-rc2-kanesige/drivers/pci/pci.c | 2 ++
linux-2.6.9-rc2-kanesige/include/linux/pci.h | 1 +
18 files changed, 77 insertions(+)
diff -puN arch/alpha/kernel/pci.c~IRQ_deallocation_pci arch/alpha/kernel/pci.c
--- linux-2.6.9-rc2/arch/alpha/kernel/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.296954429 +0900
+++ linux-2.6.9-rc2-kanesige/arch/alpha/kernel/pci.c 2004-09-16 15:58:27.338946945 +0900
@@ -384,6 +384,11 @@ pcibios_enable_device(struct pci_dev *de
return 0;
}
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain firmware forgets to set it properly, as seen
diff -puN arch/arm/kernel/bios32.c~IRQ_deallocation_pci arch/arm/kernel/bios32.c
--- linux-2.6.9-rc2/arch/arm/kernel/bios32.c~IRQ_deallocation_pci 2004-09-16 15:58:27.299884139 +0900
+++ linux-2.6.9-rc2-kanesige/arch/arm/kernel/bios32.c 2004-09-16 15:58:27.338946945 +0900
@@ -672,6 +672,10 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine)
{
diff -puN arch/i386/pci/common.c~IRQ_deallocation_pci arch/i386/pci/common.c
--- linux-2.6.9-rc2/arch/i386/pci/common.c~IRQ_deallocation_pci 2004-09-16 15:58:27.301837280 +0900
+++ linux-2.6.9-rc2-kanesige/arch/i386/pci/common.c 2004-09-16 15:58:27.339923515 +0900
@@ -245,3 +245,7 @@ int pcibios_enable_device(struct pci_dev
return pcibios_enable_irq(dev);
}
+
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
diff -puN arch/ia64/pci/pci.c~IRQ_deallocation_pci arch/ia64/pci/pci.c
--- linux-2.6.9-rc2/arch/ia64/pci/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.304766990 +0900
+++ linux-2.6.9-rc2-kanesige/arch/ia64/pci/pci.c 2004-09-16 15:58:27.340900085 +0900
@@ -427,6 +427,11 @@ pcibios_enable_device (struct pci_dev *d
}
void
+pcibios_disable_device (struct pci_dev *dev)
+{
+}
+
+void
pcibios_align_resource (void *data, struct resource *res,
unsigned long size, unsigned long align)
{
diff -puN arch/m68knommu/kernel/comempci.c~IRQ_deallocation_pci arch/m68knommu/kernel/comempci.c
--- linux-2.6.9-rc2/arch/m68knommu/kernel/comempci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.306720130 +0900
+++ linux-2.6.9-rc2-kanesige/arch/m68knommu/kernel/comempci.c 2004-09-16 15:58:27.341876655 +0900
@@ -373,6 +373,10 @@ int pcibios_enable_device(struct pci_dev
return(0);
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/*****************************************************************************/
void pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *r, int resource)
diff -puN arch/mips/pci/pci.c~IRQ_deallocation_pci arch/mips/pci/pci.c
--- linux-2.6.9-rc2/arch/mips/pci/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.308673271 +0900
+++ linux-2.6.9-rc2-kanesige/arch/mips/pci/pci.c 2004-09-16 15:58:27.341876655 +0900
@@ -226,6 +226,10 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
static void __init pcibios_fixup_device_resources(struct pci_dev *dev,
struct pci_bus *bus)
{
diff -puN arch/mips/pmc-sierra/yosemite/ht.c~IRQ_deallocation_pci arch/mips/pmc-sierra/yosemite/ht.c
--- linux-2.6.9-rc2/arch/mips/pmc-sierra/yosemite/ht.c~IRQ_deallocation_pci 2004-09-16 15:58:27.311602981 +0900
+++ linux-2.6.9-rc2-kanesige/arch/mips/pmc-sierra/yosemite/ht.c 2004-09-16 15:58:27.342853226 +0900
@@ -348,6 +348,11 @@ int pcibios_enable_device(struct pci_dev
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
+
void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
struct resource *res, int resource)
diff -puN arch/parisc/kernel/pci.c~IRQ_deallocation_pci arch/parisc/kernel/pci.c
--- linux-2.6.9-rc2/arch/parisc/kernel/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.313556121 +0900
+++ linux-2.6.9-rc2-kanesige/arch/parisc/kernel/pci.c 2004-09-16 15:58:27.343829796 +0900
@@ -331,6 +331,12 @@ int pcibios_enable_device(struct pci_dev
}
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
+
/* PA-RISC specific */
void pcibios_register_hba(struct pci_hba_data *hba)
{
diff -puN arch/ppc64/kernel/pci.c~IRQ_deallocation_pci arch/ppc64/kernel/pci.c
--- linux-2.6.9-rc2/arch/ppc64/kernel/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.315509262 +0900
+++ linux-2.6.9-rc2-kanesige/arch/ppc64/kernel/pci.c 2004-09-16 15:58:27.343829796 +0900
@@ -348,6 +348,11 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/*
* Return the domain number for this bus.
*/
diff -puN arch/ppc/kernel/pci.c~IRQ_deallocation_pci arch/ppc/kernel/pci.c
--- linux-2.6.9-rc2/arch/ppc/kernel/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.318438972 +0900
+++ linux-2.6.9-rc2-kanesige/arch/ppc/kernel/pci.c 2004-09-16 15:58:27.344806366 +0900
@@ -1430,6 +1430,11 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
struct pci_controller*
pci_bus_to_hose(int bus)
{
diff -puN arch/sh64/kernel/pcibios.c~IRQ_deallocation_pci arch/sh64/kernel/pcibios.c
--- linux-2.6.9-rc2/arch/sh64/kernel/pcibios.c~IRQ_deallocation_pci 2004-09-16 15:58:27.320392112 +0900
+++ linux-2.6.9-rc2-kanesige/arch/sh64/kernel/pcibios.c 2004-09-16 15:58:27.345782936 +0900
@@ -142,6 +142,11 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/*
* If we set up a device for bus mastering, we need to check and set
* the latency timer as it may not be properly set.
diff -puN arch/sh/boards/overdrive/galileo.c~IRQ_deallocation_pci arch/sh/boards/overdrive/galileo.c
--- linux-2.6.9-rc2/arch/sh/boards/overdrive/galileo.c~IRQ_deallocation_pci 2004-09-16 15:58:27.322345253 +0900
+++ linux-2.6.9-rc2-kanesige/arch/sh/boards/overdrive/galileo.c 2004-09-16 15:58:27.346759506 +0900
@@ -529,6 +529,10 @@ int pcibios_enable_device(struct pci_dev
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/* We should do some optimisation work here I think. Ok for now though */
void __init pcibios_fixup_bus(struct pci_bus *bus)
{
diff -puN arch/sh/drivers/pci/pci.c~IRQ_deallocation_pci arch/sh/drivers/pci/pci.c
--- linux-2.6.9-rc2/arch/sh/drivers/pci/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.324298393 +0900
+++ linux-2.6.9-rc2-kanesige/arch/sh/drivers/pci/pci.c 2004-09-16 15:58:27.346759506 +0900
@@ -127,6 +127,10 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
/*
* If we set up a device for bus mastering, we need to check and set
* the latency timer as it may not be properly set.
diff -puN arch/sparc64/kernel/pci.c~IRQ_deallocation_pci arch/sparc64/kernel/pci.c
--- linux-2.6.9-rc2/arch/sparc64/kernel/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.327228103 +0900
+++ linux-2.6.9-rc2-kanesige/arch/sparc64/kernel/pci.c 2004-09-16 15:58:27.347736076 +0900
@@ -502,6 +502,10 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void pcibios_disable_device(struct pci_dev *pdev)
+{
+}
+
void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
struct resource *res)
{
diff -puN arch/sparc/kernel/pcic.c~IRQ_deallocation_pci arch/sparc/kernel/pcic.c
--- linux-2.6.9-rc2/arch/sparc/kernel/pcic.c~IRQ_deallocation_pci 2004-09-16 15:58:27.329181244 +0900
+++ linux-2.6.9-rc2-kanesige/arch/sparc/kernel/pcic.c 2004-09-16 15:58:27.348712646 +0900
@@ -871,6 +871,10 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
+void pcibios_disable_device(struct pci_dev *pdev)
+{
+}
+
/*
* NMI
*/
diff -puN arch/v850/kernel/rte_mb_a_pci.c~IRQ_deallocation_pci arch/v850/kernel/rte_mb_a_pci.c
--- linux-2.6.9-rc2/arch/v850/kernel/rte_mb_a_pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.331134384 +0900
+++ linux-2.6.9-rc2-kanesige/arch/v850/kernel/rte_mb_a_pci.c 2004-09-16 15:58:27.349689217 +0900
@@ -247,6 +247,12 @@ int __nomods_init pcibios_enable_device
return 0;
}
+
+void
+pcibios_disable_device(struct pci_dev *dev)
+{
+}
+
\f
/* Resource allocation. */
static void __devinit pcibios_assign_resources (void)
diff -puN drivers/pci/pci.c~IRQ_deallocation_pci drivers/pci/pci.c
--- linux-2.6.9-rc2/drivers/pci/pci.c~IRQ_deallocation_pci 2004-09-16 15:58:27.333087524 +0900
+++ linux-2.6.9-rc2-kanesige/drivers/pci/pci.c 2004-09-16 15:58:27.349689217 +0900
@@ -406,6 +406,8 @@ pci_disable_device(struct pci_dev *dev)
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}
+
+ pcibios_disable_device(dev);
}
/**
diff -puN include/linux/pci.h~IRQ_deallocation_pci include/linux/pci.h
--- linux-2.6.9-rc2/include/linux/pci.h~IRQ_deallocation_pci 2004-09-16 15:58:27.336017235 +0900
+++ linux-2.6.9-rc2-kanesige/include/linux/pci.h 2004-09-16 15:58:27.350665787 +0900
@@ -686,6 +686,7 @@ extern struct list_head pci_devices; /*
void pcibios_fixup_bus(struct pci_bus *);
int pcibios_enable_device(struct pci_dev *, int mask);
+void pcibios_disable_device(struct pci_dev *);
char *pcibios_setup (char *str);
/* Used only when drivers/pci/setup.c is used */
_
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-16 12:54 [PATCH] add hook for PCI resource deallocation Kenji Kaneshige
@ 2004-09-17 21:49 ` Greg KH
2004-09-21 1:35 ` Kenji Kaneshige
2004-09-24 0:49 ` Kenji Kaneshige
2004-09-24 20:02 ` Ashok Raj
1 sibling, 2 replies; 13+ messages in thread
From: Greg KH @ 2004-09-17 21:49 UTC (permalink / raw)
To: Kenji Kaneshige; +Cc: akpm, linux-kernel
On Thu, Sep 16, 2004 at 09:54:14PM +0900, Kenji Kaneshige wrote:
> Hi,
>
> This patch adds a hook 'pcibios_disable_device()' into
> pci_disable_device() to call architecture specific PCI resource
> deallocation code. It's a opposite part of pcibios_enable_device().
> We need this hook to deallocate architecture specific PCI resource
> such as IRQ resource, etc.. This patch is just for adding the hook,
> so pcibios_disable_device() is defined as a null function on all
> architecture so far.
I'd prefer to wait until there was an actual user of this hook before
adding it to the kernel. Otherwise someone (likely me) will notice this
hook in a few days and go, "hey, no one is using this, let's clean it
up" :)
So, how about we wait until you have a patch that needs this before I
apply it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-17 21:49 ` Greg KH
@ 2004-09-21 1:35 ` Kenji Kaneshige
2004-09-24 0:49 ` Kenji Kaneshige
1 sibling, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-09-21 1:35 UTC (permalink / raw)
To: Greg KH; +Cc: akpm, linux-kernel
Greg KH wrote:
> On Thu, Sep 16, 2004 at 09:54:14PM +0900, Kenji Kaneshige wrote:
>> Hi,
>>
>> This patch adds a hook 'pcibios_disable_device()' into
>> pci_disable_device() to call architecture specific PCI resource
>> deallocation code. It's a opposite part of pcibios_enable_device().
>> We need this hook to deallocate architecture specific PCI resource
>> such as IRQ resource, etc.. This patch is just for adding the hook,
>> so pcibios_disable_device() is defined as a null function on all
>> architecture so far.
>
> I'd prefer to wait until there was an actual user of this hook before
> adding it to the kernel. Otherwise someone (likely me) will notice this
> hook in a few days and go, "hey, no one is using this, let's clean it
> up" :)
>
> So, how about we wait until you have a patch that needs this before I
> apply it?
>
Okay.
I'll post a patch that needs this soon.
Thanks,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-17 21:49 ` Greg KH
2004-09-21 1:35 ` Kenji Kaneshige
@ 2004-09-24 0:49 ` Kenji Kaneshige
1 sibling, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-09-24 0:49 UTC (permalink / raw)
To: Greg KH; +Cc: akpm, linux-kernel
Greg KH wrote:
> On Thu, Sep 16, 2004 at 09:54:14PM +0900, Kenji Kaneshige wrote:
>> Hi,
>>
>> This patch adds a hook 'pcibios_disable_device()' into
>> pci_disable_device() to call architecture specific PCI resource
>> deallocation code. It's a opposite part of pcibios_enable_device().
>> We need this hook to deallocate architecture specific PCI resource
>> such as IRQ resource, etc.. This patch is just for adding the hook,
>> so pcibios_disable_device() is defined as a null function on all
>> architecture so far.
>
> I'd prefer to wait until there was an actual user of this hook before
> adding it to the kernel. Otherwise someone (likely me) will notice this
> hook in a few days and go, "hey, no one is using this, let's clean it
> up" :)
>
> So, how about we wait until you have a patch that needs this before I
> apply it?
>
Greg,
Today, we have a PCI IRQ resource deallocation patch (please see the
links below). Ia64 portion of IRQ resource deallocation patch is
waiting this hook to be applied, because it depends on this hook.
So please apply this hook.
PCI IRQ resource deallocation patches:
http://marc.theaimsgroup.com/?l=linux-kernel&m=109575695503290&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=109575695526462&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=109575721322332&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=109575753325729&w=2
Thanks,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-16 12:54 [PATCH] add hook for PCI resource deallocation Kenji Kaneshige
2004-09-17 21:49 ` Greg KH
@ 2004-09-24 20:02 ` Ashok Raj
2004-09-24 21:22 ` Greg KH
1 sibling, 1 reply; 13+ messages in thread
From: Ashok Raj @ 2004-09-24 20:02 UTC (permalink / raw)
To: Kenji Kaneshige; +Cc: akpm, greg, linux-kernel
On Thu, Sep 16, 2004 at 05:54:14AM -0700, Kenji Kaneshige wrote:
>
> Hi,
>
> This patch adds a hook 'pcibios_disable_device()' into
> pci_disable_device() to call architecture specific PCI resource
> deallocation code. It's a opposite part of pcibios_enable_device().
> We need this hook to deallocate architecture specific PCI resource
> such as IRQ resource, etc.. This patch is just for adding the hook,
> so pcibios_disable_device() is defined as a null function on all
> architecture so far.
>
> I tested this patch on i386, x86_64 and ia64. But it has not been
> tested on other architectures because I don't have these machines.
>
> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>
Hi Kenji
I think instead of modifying all the arch specific code, you could use the __attribute__(weak)
and define a default dummy funcion in drivers/pci/pci.c
void __attribute__((weak)) pcibios_disable_device(struct pci_dev *dev) { }
each arch that really needs this can define the override function. That way you dont need to
put the dummy function in several places, containing your changes to a very few set of files.
Cheers,
ashok
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-24 20:02 ` Ashok Raj
@ 2004-09-24 21:22 ` Greg KH
2004-09-27 8:06 ` Kenji Kaneshige
0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-09-24 21:22 UTC (permalink / raw)
To: Ashok Raj; +Cc: Kenji Kaneshige, akpm, linux-kernel
On Fri, Sep 24, 2004 at 01:02:52PM -0700, Ashok Raj wrote:
> On Thu, Sep 16, 2004 at 05:54:14AM -0700, Kenji Kaneshige wrote:
> >
> > Hi,
> >
> > This patch adds a hook 'pcibios_disable_device()' into
> > pci_disable_device() to call architecture specific PCI resource
> > deallocation code. It's a opposite part of pcibios_enable_device().
> > We need this hook to deallocate architecture specific PCI resource
> > such as IRQ resource, etc.. This patch is just for adding the hook,
> > so pcibios_disable_device() is defined as a null function on all
> > architecture so far.
> >
> > I tested this patch on i386, x86_64 and ia64. But it has not been
> > tested on other architectures because I don't have these machines.
> >
> > Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> >
>
> Hi Kenji
>
> I think instead of modifying all the arch specific code, you could use the __attribute__(weak)
> and define a default dummy funcion in drivers/pci/pci.c
>
> void __attribute__((weak)) pcibios_disable_device(struct pci_dev *dev) { }
>
>
> each arch that really needs this can define the override function.
> That way you dont need to put the dummy function in several places,
> containing your changes to a very few set of files.
Ohhh, nice. I like that option better. Kenji, care to respin your
patches based on this change?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-24 21:22 ` Greg KH
@ 2004-09-27 8:06 ` Kenji Kaneshige
2004-09-28 22:00 ` Greg KH
2004-09-30 21:50 ` Andrew Morton
0 siblings, 2 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-09-27 8:06 UTC (permalink / raw)
To: Greg KH, akpm; +Cc: Ashok Raj, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1851 bytes --]
Hi Greg and Andrew,
I'm attaching updated patches for adding pcibiod_disable_device()
hook based on the feedback from Ashok (Thank you, Ashok!).
I made two patches, one of them is against 2.6.9-rc2-mm1 and the
another is against 2.6.9-rc2-mm4 to which the previous version of
the patch has already been applyed. Please use the one convenient
for you.
Thanks,
Kenji Kaneshige
Greg KH wrote:
> On Fri, Sep 24, 2004 at 01:02:52PM -0700, Ashok Raj wrote:
>> On Thu, Sep 16, 2004 at 05:54:14AM -0700, Kenji Kaneshige wrote:
>> >
>> > Hi,
>> >
>> > This patch adds a hook 'pcibios_disable_device()' into
>> > pci_disable_device() to call architecture specific PCI resource
>> > deallocation code. It's a opposite part of pcibios_enable_device().
>> > We need this hook to deallocate architecture specific PCI resource
>> > such as IRQ resource, etc.. This patch is just for adding the hook,
>> > so pcibios_disable_device() is defined as a null function on all
>> > architecture so far.
>> >
>> > I tested this patch on i386, x86_64 and ia64. But it has not been
>> > tested on other architectures because I don't have these machines.
>> >
>> > Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>> >
>>
>> Hi Kenji
>>
>> I think instead of modifying all the arch specific code, you could use the __attribute__(weak)
>> and define a default dummy funcion in drivers/pci/pci.c
>>
>> void __attribute__((weak)) pcibios_disable_device(struct pci_dev *dev) { }
>>
>>
>> each arch that really needs this can define the override function.
>> That way you dont need to put the dummy function in several places,
>> containing your changes to a very few set of files.
>
> Ohhh, nice. I like that option better. Kenji, care to respin your
> patches based on this change?
>
> thanks,
>
> greg k-h
>
[-- Attachment #2: add_pcibios_disable_device_hook-mm1.patch --]
[-- Type: text/plain, Size: 1943 bytes --]
Name: add_pcibios_disable_device_hook.patch
Kernel Version: 2.6.9-rc2-mm1
Depends: none
Change Log:
- Chaged to use __attrubute__ ((weak)) instead of modifying all
arch specific code.
Description:
This patch adds a hook 'pcibios_disable_device()' into
pci_disable_device() to call architecture specific PCI resource
deallocation code. It's a opposite part of pcibios_enable_device().
We need this hook to deallocate architecture specific PCI resource
such as IRQ resource, etc.. This patch is just for adding the hook, so
'pcibios_disable_device()' is defined as a null function on all
architecture so far.
I tested this patch on i386, x86_64 and ia64. But it has not been
tested on other architectures because I don't have these machines.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
linux-2.6.9-rc2-mm1-kanesige/drivers/pci/pci.c | 12 ++++++++++++
1 files changed, 12 insertions(+)
diff -puN drivers/pci/pci.c~add_pcibios_disable_device_hook drivers/pci/pci.c
--- linux-2.6.9-rc2-mm1/drivers/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 11:10:54.000000000 +0900
+++ linux-2.6.9-rc2-mm1-kanesige/drivers/pci/pci.c 2004-09-27 16:24:43.944414436 +0900
@@ -392,6 +392,16 @@ pci_enable_device(struct pci_dev *dev)
}
/**
+ * pcibios_disable_device - disable arch specific PCI resources for device dev
+ * @dev: the PCI device to disable
+ *
+ * Disables architecture specific PCI resources for the device. This
+ * is the default implementation. Architecture implementations can
+ * override this.
+ */
+void __attribute__ ((weak)) pcibios_disable_device (struct pci_dev *dev) {}
+
+/**
* pci_disable_device - Disable PCI device after use
* @dev: PCI device to be disabled
*
@@ -411,6 +421,8 @@ pci_disable_device(struct pci_dev *dev)
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}
+
+ pcibios_disable_device(dev);
}
/**
_
[-- Attachment #3: add_pcibios_disable_device_hook-mm4.patch --]
[-- Type: text/plain, Size: 12372 bytes --]
Kernel Version: 2.6.9-rc2-mm4
Depends: none.
Change Log:
- Chaged to use __attrubute__ ((weak)) instead of modifying all
arch specific code.
Description:
This patch adds a hook 'pcibios_disable_device()' into
pci_disable_device() to call architecture specific PCI resource
deallocation code. It's a opposite part of pcibios_enable_device().
We need this hook to deallocate architecture specific PCI resource
such as IRQ resource, etc.. This patch is just for adding the hook, so
'pcibios_disable_device()' is defined as a null function on all
architecture so far.
I tested this patch on i386, x86_64 and ia64. But it has not been
tested on other architectures because I don't have these machines.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
linux-2.6.9-rc2-mm4-kanesige/arch/alpha/kernel/pci.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/arm/kernel/bios32.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/i386/pci/common.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/ia64/pci/pci.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/m68knommu/kernel/comempci.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/mips/pci/pci.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/mips/pmc-sierra/yosemite/ht.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/parisc/kernel/pci.c | 6 ------
linux-2.6.9-rc2-mm4-kanesige/arch/ppc/kernel/pci.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/ppc64/kernel/pci.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/sh/boards/overdrive/galileo.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/sh/drivers/pci/pci.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/sh64/kernel/pcibios.c | 5 -----
linux-2.6.9-rc2-mm4-kanesige/arch/sparc/kernel/pcic.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/sparc64/kernel/pci.c | 4 ----
linux-2.6.9-rc2-mm4-kanesige/arch/v850/kernel/rte_mb_a_pci.c | 6 ------
linux-2.6.9-rc2-mm4-kanesige/drivers/pci/pci.c | 10 ++++++++++
linux-2.6.9-rc2-mm4-kanesige/include/linux/pci.h | 1 -
18 files changed, 10 insertions(+), 75 deletions(-)
diff -puN arch/alpha/kernel/pci.c~add_pcibios_disable_device_hook arch/alpha/kernel/pci.c
--- linux-2.6.9-rc2-mm4/arch/alpha/kernel/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/alpha/kernel/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -381,11 +381,6 @@ pcibios_enable_device(struct pci_dev *de
return 0;
}
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/*
* If we set up a device for bus mastering, we need to check the latency
* timer as certain firmware forgets to set it properly, as seen
diff -puN arch/arm/kernel/bios32.c~add_pcibios_disable_device_hook arch/arm/kernel/bios32.c
--- linux-2.6.9-rc2-mm4/arch/arm/kernel/bios32.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/arm/kernel/bios32.c 2004-09-27 13:20:42.000000000 +0900
@@ -672,10 +672,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine)
{
diff -puN arch/i386/pci/common.c~add_pcibios_disable_device_hook arch/i386/pci/common.c
--- linux-2.6.9-rc2-mm4/arch/i386/pci/common.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/i386/pci/common.c 2004-09-27 13:20:42.000000000 +0900
@@ -249,7 +249,3 @@ int pcibios_enable_device(struct pci_dev
return pcibios_enable_irq(dev);
}
-
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
diff -puN arch/ia64/pci/pci.c~add_pcibios_disable_device_hook arch/ia64/pci/pci.c
--- linux-2.6.9-rc2-mm4/arch/ia64/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/ia64/pci/pci.c 2004-09-27 15:09:48.973960437 +0900
@@ -449,11 +449,6 @@ pcibios_enable_device (struct pci_dev *d
}
void
-pcibios_disable_device (struct pci_dev *dev)
-{
-}
-
-void
pcibios_align_resource (void *data, struct resource *res,
unsigned long size, unsigned long align)
{
diff -puN arch/m68knommu/kernel/comempci.c~add_pcibios_disable_device_hook arch/m68knommu/kernel/comempci.c
--- linux-2.6.9-rc2-mm4/arch/m68knommu/kernel/comempci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/m68knommu/kernel/comempci.c 2004-09-27 13:20:42.000000000 +0900
@@ -373,10 +373,6 @@ int pcibios_enable_device(struct pci_dev
return(0);
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/*****************************************************************************/
void pcibios_update_resource(struct pci_dev *dev, struct resource *root, struct resource *r, int resource)
diff -puN arch/mips/pci/pci.c~add_pcibios_disable_device_hook arch/mips/pci/pci.c
--- linux-2.6.9-rc2-mm4/arch/mips/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/mips/pci/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -226,10 +226,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
static void __init pcibios_fixup_device_resources(struct pci_dev *dev,
struct pci_bus *bus)
{
diff -puN arch/mips/pmc-sierra/yosemite/ht.c~add_pcibios_disable_device_hook arch/mips/pmc-sierra/yosemite/ht.c
--- linux-2.6.9-rc2-mm4/arch/mips/pmc-sierra/yosemite/ht.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/mips/pmc-sierra/yosemite/ht.c 2004-09-27 13:20:42.000000000 +0900
@@ -348,11 +348,6 @@ int pcibios_enable_device(struct pci_dev
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
-
void pcibios_update_resource(struct pci_dev *dev, struct resource *root,
struct resource *res, int resource)
diff -puN arch/parisc/kernel/pci.c~add_pcibios_disable_device_hook arch/parisc/kernel/pci.c
--- linux-2.6.9-rc2-mm4/arch/parisc/kernel/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/parisc/kernel/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -331,12 +331,6 @@ int pcibios_enable_device(struct pci_dev
}
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
-
/* PA-RISC specific */
void pcibios_register_hba(struct pci_hba_data *hba)
{
diff -puN arch/ppc64/kernel/pci.c~add_pcibios_disable_device_hook arch/ppc64/kernel/pci.c
--- linux-2.6.9-rc2-mm4/arch/ppc64/kernel/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/ppc64/kernel/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -346,11 +346,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/*
* Return the domain number for this bus.
*/
diff -puN arch/ppc/kernel/pci.c~add_pcibios_disable_device_hook arch/ppc/kernel/pci.c
--- linux-2.6.9-rc2-mm4/arch/ppc/kernel/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/ppc/kernel/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -1421,11 +1421,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
struct pci_controller*
pci_bus_to_hose(int bus)
{
diff -puN arch/sh64/kernel/pcibios.c~add_pcibios_disable_device_hook arch/sh64/kernel/pcibios.c
--- linux-2.6.9-rc2-mm4/arch/sh64/kernel/pcibios.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/sh64/kernel/pcibios.c 2004-09-27 13:20:42.000000000 +0900
@@ -142,11 +142,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/*
* If we set up a device for bus mastering, we need to check and set
* the latency timer as it may not be properly set.
diff -puN arch/sh/boards/overdrive/galileo.c~add_pcibios_disable_device_hook arch/sh/boards/overdrive/galileo.c
--- linux-2.6.9-rc2-mm4/arch/sh/boards/overdrive/galileo.c~add_pcibios_disable_device_hook 2004-09-27 13:20:41.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/sh/boards/overdrive/galileo.c 2004-09-27 13:20:42.000000000 +0900
@@ -529,10 +529,6 @@ int pcibios_enable_device(struct pci_dev
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/* We should do some optimisation work here I think. Ok for now though */
void __init pcibios_fixup_bus(struct pci_bus *bus)
{
diff -puN arch/sh/drivers/pci/pci.c~add_pcibios_disable_device_hook arch/sh/drivers/pci/pci.c
--- linux-2.6.9-rc2-mm4/arch/sh/drivers/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/sh/drivers/pci/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -127,10 +127,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
/*
* If we set up a device for bus mastering, we need to check and set
* the latency timer as it may not be properly set.
diff -puN arch/sparc64/kernel/pci.c~add_pcibios_disable_device_hook arch/sparc64/kernel/pci.c
--- linux-2.6.9-rc2-mm4/arch/sparc64/kernel/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/sparc64/kernel/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -502,10 +502,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void pcibios_disable_device(struct pci_dev *pdev)
-{
-}
-
void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
struct resource *res)
{
diff -puN arch/sparc/kernel/pcic.c~add_pcibios_disable_device_hook arch/sparc/kernel/pcic.c
--- linux-2.6.9-rc2-mm4/arch/sparc/kernel/pcic.c~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/sparc/kernel/pcic.c 2004-09-27 13:20:42.000000000 +0900
@@ -872,10 +872,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
}
-void pcibios_disable_device(struct pci_dev *pdev)
-{
-}
-
/*
* NMI
*/
diff -puN arch/v850/kernel/rte_mb_a_pci.c~add_pcibios_disable_device_hook arch/v850/kernel/rte_mb_a_pci.c
--- linux-2.6.9-rc2-mm4/arch/v850/kernel/rte_mb_a_pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/arch/v850/kernel/rte_mb_a_pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -247,12 +247,6 @@ int __nomods_init pcibios_enable_device
return 0;
}
-
-void
-pcibios_disable_device(struct pci_dev *dev)
-{
-}
-
\f
/* Resource allocation. */
static void __devinit pcibios_assign_resources (void)
diff -puN drivers/pci/pci.c~add_pcibios_disable_device_hook drivers/pci/pci.c
--- linux-2.6.9-rc2-mm4/drivers/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/drivers/pci/pci.c 2004-09-27 13:20:42.000000000 +0900
@@ -392,6 +392,16 @@ pci_enable_device(struct pci_dev *dev)
}
/**
+ * pcibios_disable_device - disable arch specific PCI resources for device dev
+ * @dev: the PCI device to disable
+ *
+ * Disables architecture specific PCI resources for the device. This
+ * is the default implementation. Architecture implementations can
+ * override this.
+ */
+void __attribute__ ((weak)) pcibios_disable_device (struct pci_dev *dev) {}
+
+/**
* pci_disable_device - Disable PCI device after use
* @dev: PCI device to be disabled
*
diff -puN include/linux/pci.h~add_pcibios_disable_device_hook include/linux/pci.h
--- linux-2.6.9-rc2-mm4/include/linux/pci.h~add_pcibios_disable_device_hook 2004-09-27 13:20:42.000000000 +0900
+++ linux-2.6.9-rc2-mm4-kanesige/include/linux/pci.h 2004-09-27 13:20:42.000000000 +0900
@@ -689,7 +689,6 @@ extern struct list_head pci_devices; /*
void pcibios_fixup_bus(struct pci_bus *);
int pcibios_enable_device(struct pci_dev *, int mask);
-void pcibios_disable_device(struct pci_dev *);
char *pcibios_setup (char *str);
/* Used only when drivers/pci/setup.c is used */
_
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-27 8:06 ` Kenji Kaneshige
@ 2004-09-28 22:00 ` Greg KH
2004-09-29 0:55 ` Kenji Kaneshige
2004-09-30 21:50 ` Andrew Morton
1 sibling, 1 reply; 13+ messages in thread
From: Greg KH @ 2004-09-28 22:00 UTC (permalink / raw)
To: Kenji Kaneshige; +Cc: akpm, Ashok Raj, linux-kernel
On Mon, Sep 27, 2004 at 05:06:28PM +0900, Kenji Kaneshige wrote:
> Hi Greg and Andrew,
>
> I'm attaching updated patches for adding pcibiod_disable_device()
> hook based on the feedback from Ashok (Thank you, Ashok!).
>
> I made two patches, one of them is against 2.6.9-rc2-mm1 and the
> another is against 2.6.9-rc2-mm4 to which the previous version of
> the patch has already been applyed. Please use the one convenient
> for you.
Based on all of the comments, I'll wait for you to incorporate them, so
I'm not going to apply this one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-28 22:00 ` Greg KH
@ 2004-09-29 0:55 ` Kenji Kaneshige
0 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-09-29 0:55 UTC (permalink / raw)
To: Greg KH; +Cc: akpm, Ashok Raj, linux-kernel
Hi Greg,
Greg KH wrote:
>
> Based on all of the comments, I'll wait for you to incorporate them, so
> I'm not going to apply this one.
>
Okay.
I'll be able to post an updated set of patches based on all of the
comments soon.
Thanks,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-27 8:06 ` Kenji Kaneshige
2004-09-28 22:00 ` Greg KH
@ 2004-09-30 21:50 ` Andrew Morton
2004-09-30 22:21 ` Ashok Raj
1 sibling, 1 reply; 13+ messages in thread
From: Andrew Morton @ 2004-09-30 21:50 UTC (permalink / raw)
To: Kenji Kaneshige; +Cc: greg, ashok.raj, linux-kernel
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> wrote:
>
> I'm attaching updated patches for adding pcibiod_disable_device()
> hook based on the feedback from Ashok (Thank you, Ashok!).
This appears to be a patch-reversed version of the patch which is already
in -mm:
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc2/2.6.9-rc2-mm4/broken-out/add-hook-for-pci-resource-deallocation.patch
So I'm not sure what you're trying to do here.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-30 21:50 ` Andrew Morton
@ 2004-09-30 22:21 ` Ashok Raj
2004-09-30 23:03 ` Andrew Morton
0 siblings, 1 reply; 13+ messages in thread
From: Ashok Raj @ 2004-09-30 22:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Kenji Kaneshige, greg, ashok.raj, linux-kernel
On Thu, Sep 30, 2004 at 02:50:14PM -0700, Andrew Morton wrote:
> Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> wrote:
> >
> > I'm attaching updated patches for adding pcibiod_disable_device()
> > hook based on the feedback from Ashok (Thank you, Ashok!).
>
> This appears to be a patch-reversed version of the patch which is already
> in -mm:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc2/2.6.9-rc2-mm4/broken-out/add-hook-for-pci-resource-deallocation.patch
>
> So I'm not sure what you're trying to do here.
In the original patch, Kenji added a dummy function in several source files. Instead now
the new patch should have a single default implementation with a __attribute__((weak))
As a result its removing all the old additions and now keeping just a single default function.
so yes, its a reverse patch mostly, but there should also be a new function added with the weak
attribute.
--
Cheers,
Ashok Raj
- Linux OS & Technology Team
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-30 22:21 ` Ashok Raj
@ 2004-09-30 23:03 ` Andrew Morton
2004-10-01 2:11 ` Kenji Kaneshige
0 siblings, 1 reply; 13+ messages in thread
From: Andrew Morton @ 2004-09-30 23:03 UTC (permalink / raw)
To: Ashok Raj; +Cc: kaneshige.kenji, greg, ashok.raj, linux-kernel
Ashok Raj <ashok.raj@intel.com> wrote:
>
> On Thu, Sep 30, 2004 at 02:50:14PM -0700, Andrew Morton wrote:
> > Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> wrote:
> > >
> > > I'm attaching updated patches for adding pcibiod_disable_device()
> > > hook based on the feedback from Ashok (Thank you, Ashok!).
> >
> > This appears to be a patch-reversed version of the patch which is already
> > in -mm:
> > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc2/2.6.9-rc2-mm4/broken-out/add-hook-for-pci-resource-deallocation.patch
> >
> > So I'm not sure what you're trying to do here.
>
>
> In the original patch, Kenji added a dummy function in several source files. Instead now
> the new patch should have a single default implementation with a __attribute__((weak))
>
> As a result its removing all the old additions and now keeping just a single default function.
Oh. You may as well send a (chagelogged, signed off) new patch against
current -linus in that case.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] add hook for PCI resource deallocation
2004-09-30 23:03 ` Andrew Morton
@ 2004-10-01 2:11 ` Kenji Kaneshige
0 siblings, 0 replies; 13+ messages in thread
From: Kenji Kaneshige @ 2004-10-01 2:11 UTC (permalink / raw)
To: Andrew Morton; +Cc: Ashok Raj, greg, linux-kernel
Andrew Morton wrote:
> Ashok Raj <ashok.raj@intel.com> wrote:
>>
>> On Thu, Sep 30, 2004 at 02:50:14PM -0700, Andrew Morton wrote:
>> > Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> wrote:
>> > >
>> > > I'm attaching updated patches for adding pcibiod_disable_device()
>> > > hook based on the feedback from Ashok (Thank you, Ashok!).
>> >
>> > This appears to be a patch-reversed version of the patch which is already
>> > in -mm:
>> > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc2/2.6.9-rc2-mm4/broken-out/add-hook-for-pci-resource-deallocation.patch
>> >
>> > So I'm not sure what you're trying to do here.
>>
>>
>> In the original patch, Kenji added a dummy function in several source files. Instead now
>> the new patch should have a single default implementation with a __attribute__((weak))
>>
>> As a result its removing all the old additions and now keeping just a single default function.
>
> Oh. You may as well send a (chagelogged, signed off) new patch against
> current -linus in that case.
>
I'm sorry about that.
Please use the following patch.
Thanks,
Kenji Kaneshige
Name: add_pcibios_disable_device_hook.patch
Kernel Version: 2.6.9-rc2-mm1
Depends: none
Change Log:
- Chaged to use __attrubute__ ((weak)) instead of modifying all
arch specific code.
Description:
This patch adds a hook 'pcibios_disable_device()' into
pci_disable_device() to call architecture specific PCI resource
deallocation code. It's a opposite part of pcibios_enable_device().
We need this hook to deallocate architecture specific PCI resource
such as IRQ resource, etc.. This patch is just for adding the hook, so
'pcibios_disable_device()' is defined as a null function on all
architecture so far.
I tested this patch on i386, x86_64 and ia64. But it has not been
tested on other architectures because I don't have these machines.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
linux-2.6.9-rc2-mm1-kanesige/drivers/pci/pci.c | 12 ++++++++++++
1 files changed, 12 insertions(+)
diff -puN drivers/pci/pci.c~add_pcibios_disable_device_hook drivers/pci/pci.c
--- linux-2.6.9-rc2-mm1/drivers/pci/pci.c~add_pcibios_disable_device_hook 2004-09-27 11:10:54.000000000 +0900
+++ linux-2.6.9-rc2-mm1-kanesige/drivers/pci/pci.c 2004-09-27 16:24:43.944414436 +0900
@@ -392,6 +392,16 @@ pci_enable_device(struct pci_dev *dev)
}
/**
+ * pcibios_disable_device - disable arch specific PCI resources for device dev
+ * @dev: the PCI device to disable
+ *
+ * Disables architecture specific PCI resources for the device. This
+ * is the default implementation. Architecture implementations can
+ * override this.
+ */
+void __attribute__ ((weak)) pcibios_disable_device (struct pci_dev *dev) {}
+
+/**
* pci_disable_device - Disable PCI device after use
* @dev: PCI device to be disabled
*
@@ -411,6 +421,8 @@ pci_disable_device(struct pci_dev *dev)
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}
+
+ pcibios_disable_device(dev);
}
/**
_
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-10-01 2:09 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-16 12:54 [PATCH] add hook for PCI resource deallocation Kenji Kaneshige
2004-09-17 21:49 ` Greg KH
2004-09-21 1:35 ` Kenji Kaneshige
2004-09-24 0:49 ` Kenji Kaneshige
2004-09-24 20:02 ` Ashok Raj
2004-09-24 21:22 ` Greg KH
2004-09-27 8:06 ` Kenji Kaneshige
2004-09-28 22:00 ` Greg KH
2004-09-29 0:55 ` Kenji Kaneshige
2004-09-30 21:50 ` Andrew Morton
2004-09-30 22:21 ` Ashok Raj
2004-09-30 23:03 ` Andrew Morton
2004-10-01 2:11 ` Kenji Kaneshige
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox