Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
@ 2019-05-31 15:09 YueHaibing
  2019-06-01 22:59 ` Michael Kelley
  2019-06-14 14:19 ` Yuehaibing
  0 siblings, 2 replies; 8+ messages in thread
From: YueHaibing @ 2019-05-31 15:09 UTC (permalink / raw)
  To: bhelgaas, sthemmin, sashal, decui; +Cc: linux-kernel, linux-pci, YueHaibing

while building without CONFIG_SYSFS, fails as below:

drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'

Select SYSFS while PCI_HYPERV is set to fix this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot information")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/pci/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 2ab9240..6722952 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -182,6 +182,7 @@ config PCI_LABEL
 config PCI_HYPERV
         tristate "Hyper-V PCI Frontend"
         depends on X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && X86_64
+	select SYSFS
         help
           The PCI device frontend driver allows the kernel to import arbitrary
           PCI devices from a PCI backend to support PCI driver domains.
-- 
2.7.4



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-05-31 15:09 [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS YueHaibing
@ 2019-06-01 22:59 ` Michael Kelley
  2019-06-15  6:18   ` Yuehaibing
  2019-06-14 14:19 ` Yuehaibing
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Kelley @ 2019-06-01 22:59 UTC (permalink / raw)
  To: YueHaibing, bhelgaas, Stephen Hemminger, sashal, Dexuan Cui,
	linux-hyperv
  Cc: linux-kernel, linux-pci

From: YueHaibing <yuehaibing@huawei.com>  Sent: Friday, May 31, 2019 8:09 AM
> 
> while building without CONFIG_SYSFS, fails as below:
> 
> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
> 
> Select SYSFS while PCI_HYPERV is set to fix this.
> 

I'm wondering if is the right way to fix the problem.  Conceptually
is it possible to setup & operate virtual PCI devices like 
pci-hyperv.c does, even if sysfs is not present?  Or is it right to
always required sysfs?

The function pci_dev_assign_slot() in slot.c has a null implementation
in include/linux/pci.h when CONFIG_SYSFS is not defined, which
seems to be trying to solve the same problem for that function.  And
if CONFIG_HOTPLUG_PCI is defined but CONFIG_SYSFS is not,
pci_hp_create_module_link() and pci_hp_remove_module_link()
look like they would have the same problem.  Maybe there should
be degenerate implementations of pci_create_slot() and
pci_destroy_slot() for cases when CONFIG_SYSFS is not defined?

But I'll admit I don't know the full story behind how PCI slots
are represented and used, so maybe I'm off base.  I just noticed
the inconsistency in how other functions in slot.c are handled.

Thoughts?

Michael

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-05-31 15:09 [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS YueHaibing
  2019-06-01 22:59 ` Michael Kelley
@ 2019-06-14 14:19 ` Yuehaibing
  2019-06-14 15:23   ` Lorenzo Pieralisi
  1 sibling, 1 reply; 8+ messages in thread
From: Yuehaibing @ 2019-06-14 14:19 UTC (permalink / raw)
  To: bhelgaas, sthemmin, sashal, decui; +Cc: linux-kernel, linux-pci

Hi all,

Friendly ping...

On 2019/5/31 23:09, YueHaibing wrote:
> while building without CONFIG_SYSFS, fails as below:
> 
> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
> 
> Select SYSFS while PCI_HYPERV is set to fix this.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot information")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/pci/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index 2ab9240..6722952 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -182,6 +182,7 @@ config PCI_LABEL
>  config PCI_HYPERV
>          tristate "Hyper-V PCI Frontend"
>          depends on X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && X86_64
> +	select SYSFS
>          help
>            The PCI device frontend driver allows the kernel to import arbitrary
>            PCI devices from a PCI backend to support PCI driver domains.
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-06-14 14:19 ` Yuehaibing
@ 2019-06-14 15:23   ` Lorenzo Pieralisi
  0 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Pieralisi @ 2019-06-14 15:23 UTC (permalink / raw)
  To: Yuehaibing; +Cc: bhelgaas, sthemmin, sashal, decui, linux-kernel, linux-pci

On Fri, Jun 14, 2019 at 10:19:10PM +0800, Yuehaibing wrote:
> Hi all,
> 
> Friendly ping...

We should address Michael's question:

https://lore.kernel.org/linux-pci/BYAPR21MB12211EEA95200F437C8E37ECD71A0@BYAPR21MB1221.namprd21.prod.outlook.com/

Lorenzo

> On 2019/5/31 23:09, YueHaibing wrote:
> > while building without CONFIG_SYSFS, fails as below:
> > 
> > drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
> > pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
> > drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
> > pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
> > drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
> > pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
> > drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
> > pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
> > 
> > Select SYSFS while PCI_HYPERV is set to fix this.
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot information")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> >  drivers/pci/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> > index 2ab9240..6722952 100644
> > --- a/drivers/pci/Kconfig
> > +++ b/drivers/pci/Kconfig
> > @@ -182,6 +182,7 @@ config PCI_LABEL
> >  config PCI_HYPERV
> >          tristate "Hyper-V PCI Frontend"
> >          depends on X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && X86_64
> > +	select SYSFS
> >          help
> >            The PCI device frontend driver allows the kernel to import arbitrary
> >            PCI devices from a PCI backend to support PCI driver domains.
> > 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-06-01 22:59 ` Michael Kelley
@ 2019-06-15  6:18   ` Yuehaibing
  2019-06-15  6:48     ` Yuehaibing
  0 siblings, 1 reply; 8+ messages in thread
From: Yuehaibing @ 2019-06-15  6:18 UTC (permalink / raw)
  To: Michael Kelley, bhelgaas, Stephen Hemminger, sashal, Dexuan Cui,
	linux-hyperv
  Cc: linux-kernel, linux-pci


On 2019/6/2 6:59, Michael Kelley wrote:
> From: YueHaibing <yuehaibing@huawei.com>  Sent: Friday, May 31, 2019 8:09 AM
>>
>> while building without CONFIG_SYSFS, fails as below:
>>
>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
>> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
>> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
>> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
>> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
>> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
>> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
>>
>> Select SYSFS while PCI_HYPERV is set to fix this.
>>
> 
> I'm wondering if is the right way to fix the problem.  Conceptually
> is it possible to setup & operate virtual PCI devices like 
> pci-hyperv.c does, even if sysfs is not present?  Or is it right to
> always required sysfs?
> 
> The function pci_dev_assign_slot() in slot.c has a null implementation
> in include/linux/pci.h when CONFIG_SYSFS is not defined, which
> seems to be trying to solve the same problem for that function.  And
> if CONFIG_HOTPLUG_PCI is defined but CONFIG_SYSFS is not,
> pci_hp_create_module_link() and pci_hp_remove_module_link()
> look like they would have the same problem.  Maybe there should
> be degenerate implementations of pci_create_slot() and
> pci_destroy_slot() for cases when CONFIG_SYSFS is not defined?
> 
> But I'll admit I don't know the full story behind how PCI slots
> are represented and used, so maybe I'm off base.  I just noticed
> the inconsistency in how other functions in slot.c are handled.
> 
> Thoughts?

268a03a42d33 ("PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS")

make slot.o depends CONFIG_SYSFS

commit 268a03a42d3377d5fb41e6e7cbdec4e0b65cab2e
Author: Alex Chiang <achiang@hp.com>
Date:   Wed Jun 17 19:03:57 2009 -0600

    PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS

    There is no way to interact with a physical PCI slot without
    sysfs, so encode the dependency and prevent this build error:

        drivers/pci/slot.c: In function 'pci_hp_create_module_link':
        drivers/pci/slot.c:327: error: 'module_kset' undeclared

    This patch _should_ make pci-sysfs.o depend on CONFIG_SYSFS too,
    but we cannot (yet) because the PCI core merrily assumes the
    existence of sysfs:

        drivers/built-in.o: In function `pci_bus_add_device':
        drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
        drivers/built-in.o: In function `pci_stop_dev':
        drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'

    So do the minimal bit for now and figure out how to untangle it
    later.

If No CONFIG_SYSFS, slot.o is not build

> 
> Michael
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-06-15  6:18   ` Yuehaibing
@ 2019-06-15  6:48     ` Yuehaibing
  2019-08-13 10:18       ` Lorenzo Pieralisi
  0 siblings, 1 reply; 8+ messages in thread
From: Yuehaibing @ 2019-06-15  6:48 UTC (permalink / raw)
  To: Michael Kelley, bhelgaas, Stephen Hemminger, sashal, Dexuan Cui,
	linux-hyperv
  Cc: linux-kernel, linux-pci

+cc Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

On 2019/6/15 14:18, Yuehaibing wrote:
> 
> On 2019/6/2 6:59, Michael Kelley wrote:
>> From: YueHaibing <yuehaibing@huawei.com>  Sent: Friday, May 31, 2019 8:09 AM
>>>
>>> while building without CONFIG_SYSFS, fails as below:
>>>
>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
>>> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
>>> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
>>> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
>>> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
>>> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
>>>
>>> Select SYSFS while PCI_HYPERV is set to fix this.
>>>
>>
>> I'm wondering if is the right way to fix the problem.  Conceptually
>> is it possible to setup & operate virtual PCI devices like 
>> pci-hyperv.c does, even if sysfs is not present?  Or is it right to
>> always required sysfs?
>>
>> The function pci_dev_assign_slot() in slot.c has a null implementation
>> in include/linux/pci.h when CONFIG_SYSFS is not defined, which
>> seems to be trying to solve the same problem for that function.  And
>> if CONFIG_HOTPLUG_PCI is defined but CONFIG_SYSFS is not,
>> pci_hp_create_module_link() and pci_hp_remove_module_link()
>> look like they would have the same problem.  Maybe there should
>> be degenerate implementations of pci_create_slot() and
>> pci_destroy_slot() for cases when CONFIG_SYSFS is not defined?
>>
>> But I'll admit I don't know the full story behind how PCI slots
>> are represented and used, so maybe I'm off base.  I just noticed
>> the inconsistency in how other functions in slot.c are handled.
>>
>> Thoughts?
> 
> 268a03a42d33 ("PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS")
> 
> make slot.o depends CONFIG_SYSFS
> 
> commit 268a03a42d3377d5fb41e6e7cbdec4e0b65cab2e
> Author: Alex Chiang <achiang@hp.com>
> Date:   Wed Jun 17 19:03:57 2009 -0600
> 
>     PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS
> 
>     There is no way to interact with a physical PCI slot without
>     sysfs, so encode the dependency and prevent this build error:
> 
>         drivers/pci/slot.c: In function 'pci_hp_create_module_link':
>         drivers/pci/slot.c:327: error: 'module_kset' undeclared
> 
>     This patch _should_ make pci-sysfs.o depend on CONFIG_SYSFS too,
>     but we cannot (yet) because the PCI core merrily assumes the
>     existence of sysfs:
> 
>         drivers/built-in.o: In function `pci_bus_add_device':
>         drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
>         drivers/built-in.o: In function `pci_stop_dev':
>         drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'
> 
>     So do the minimal bit for now and figure out how to untangle it
>     later.
> 
> If No CONFIG_SYSFS, slot.o is not build
> 
>>
>> Michael
>>
>>
> 
> 
> .
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-06-15  6:48     ` Yuehaibing
@ 2019-08-13 10:18       ` Lorenzo Pieralisi
  2019-08-13 12:43         ` Yuehaibing
  0 siblings, 1 reply; 8+ messages in thread
From: Lorenzo Pieralisi @ 2019-08-13 10:18 UTC (permalink / raw)
  To: Yuehaibing
  Cc: Michael Kelley, bhelgaas, Stephen Hemminger, sashal, Dexuan Cui,
	linux-hyperv, linux-kernel, linux-pci

On Sat, Jun 15, 2019 at 02:48:24PM +0800, Yuehaibing wrote:
> +cc Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Can we drop this patch and merge:

https://patchwork.ozlabs.org/patch/1131444/

instead ?

Thanks,
Lorenzo

> 
> On 2019/6/15 14:18, Yuehaibing wrote:
> > 
> > On 2019/6/2 6:59, Michael Kelley wrote:
> >> From: YueHaibing <yuehaibing@huawei.com>  Sent: Friday, May 31, 2019 8:09 AM
> >>>
> >>> while building without CONFIG_SYSFS, fails as below:
> >>>
> >>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
> >>> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
> >>> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
> >>> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
> >>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
> >>> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
> >>> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
> >>> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
> >>>
> >>> Select SYSFS while PCI_HYPERV is set to fix this.
> >>>
> >>
> >> I'm wondering if is the right way to fix the problem.  Conceptually
> >> is it possible to setup & operate virtual PCI devices like 
> >> pci-hyperv.c does, even if sysfs is not present?  Or is it right to
> >> always required sysfs?
> >>
> >> The function pci_dev_assign_slot() in slot.c has a null implementation
> >> in include/linux/pci.h when CONFIG_SYSFS is not defined, which
> >> seems to be trying to solve the same problem for that function.  And
> >> if CONFIG_HOTPLUG_PCI is defined but CONFIG_SYSFS is not,
> >> pci_hp_create_module_link() and pci_hp_remove_module_link()
> >> look like they would have the same problem.  Maybe there should
> >> be degenerate implementations of pci_create_slot() and
> >> pci_destroy_slot() for cases when CONFIG_SYSFS is not defined?
> >>
> >> But I'll admit I don't know the full story behind how PCI slots
> >> are represented and used, so maybe I'm off base.  I just noticed
> >> the inconsistency in how other functions in slot.c are handled.
> >>
> >> Thoughts?
> > 
> > 268a03a42d33 ("PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS")
> > 
> > make slot.o depends CONFIG_SYSFS
> > 
> > commit 268a03a42d3377d5fb41e6e7cbdec4e0b65cab2e
> > Author: Alex Chiang <achiang@hp.com>
> > Date:   Wed Jun 17 19:03:57 2009 -0600
> > 
> >     PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS
> > 
> >     There is no way to interact with a physical PCI slot without
> >     sysfs, so encode the dependency and prevent this build error:
> > 
> >         drivers/pci/slot.c: In function 'pci_hp_create_module_link':
> >         drivers/pci/slot.c:327: error: 'module_kset' undeclared
> > 
> >     This patch _should_ make pci-sysfs.o depend on CONFIG_SYSFS too,
> >     but we cannot (yet) because the PCI core merrily assumes the
> >     existence of sysfs:
> > 
> >         drivers/built-in.o: In function `pci_bus_add_device':
> >         drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
> >         drivers/built-in.o: In function `pci_stop_dev':
> >         drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'
> > 
> >     So do the minimal bit for now and figure out how to untangle it
> >     later.
> > 
> > If No CONFIG_SYSFS, slot.o is not build
> > 
> >>
> >> Michael
> >>
> >>
> > 
> > 
> > .
> > 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS
  2019-08-13 10:18       ` Lorenzo Pieralisi
@ 2019-08-13 12:43         ` Yuehaibing
  0 siblings, 0 replies; 8+ messages in thread
From: Yuehaibing @ 2019-08-13 12:43 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Michael Kelley, bhelgaas, Stephen Hemminger, sashal, Dexuan Cui,
	linux-hyperv, linux-kernel, linux-pci

On 2019/8/13 18:18, Lorenzo Pieralisi wrote:
> On Sat, Jun 15, 2019 at 02:48:24PM +0800, Yuehaibing wrote:
>> +cc Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> 
> Can we drop this patch and merge:
> 
> https://patchwork.ozlabs.org/patch/1131444/
> 
> instead ?

Ok, it looks good to me, thanks!

> 
> Thanks,
> Lorenzo
> 
>>
>> On 2019/6/15 14:18, Yuehaibing wrote:
>>>
>>> On 2019/6/2 6:59, Michael Kelley wrote:
>>>> From: YueHaibing <yuehaibing@huawei.com>  Sent: Friday, May 31, 2019 8:09 AM
>>>>>
>>>>> while building without CONFIG_SYSFS, fails as below:
>>>>>
>>>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_assign_slots':
>>>>> pci-hyperv.c:(.text+0x40a): undefined reference to 'pci_create_slot'
>>>>> drivers/pci/controller/pci-hyperv.o: In function 'pci_devices_present_work':
>>>>> pci-hyperv.c:(.text+0xc02): undefined reference to 'pci_destroy_slot'
>>>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_pci_remove':
>>>>> pci-hyperv.c:(.text+0xe50): undefined reference to 'pci_destroy_slot'
>>>>> drivers/pci/controller/pci-hyperv.o: In function 'hv_eject_device_work':
>>>>> pci-hyperv.c:(.text+0x11f9): undefined reference to 'pci_destroy_slot'
>>>>>
>>>>> Select SYSFS while PCI_HYPERV is set to fix this.
>>>>>
>>>>
>>>> I'm wondering if is the right way to fix the problem.  Conceptually
>>>> is it possible to setup & operate virtual PCI devices like 
>>>> pci-hyperv.c does, even if sysfs is not present?  Or is it right to
>>>> always required sysfs?
>>>>
>>>> The function pci_dev_assign_slot() in slot.c has a null implementation
>>>> in include/linux/pci.h when CONFIG_SYSFS is not defined, which
>>>> seems to be trying to solve the same problem for that function.  And
>>>> if CONFIG_HOTPLUG_PCI is defined but CONFIG_SYSFS is not,
>>>> pci_hp_create_module_link() and pci_hp_remove_module_link()
>>>> look like they would have the same problem.  Maybe there should
>>>> be degenerate implementations of pci_create_slot() and
>>>> pci_destroy_slot() for cases when CONFIG_SYSFS is not defined?
>>>>
>>>> But I'll admit I don't know the full story behind how PCI slots
>>>> are represented and used, so maybe I'm off base.  I just noticed
>>>> the inconsistency in how other functions in slot.c are handled.
>>>>
>>>> Thoughts?
>>>
>>> 268a03a42d33 ("PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS")
>>>
>>> make slot.o depends CONFIG_SYSFS
>>>
>>> commit 268a03a42d3377d5fb41e6e7cbdec4e0b65cab2e
>>> Author: Alex Chiang <achiang@hp.com>
>>> Date:   Wed Jun 17 19:03:57 2009 -0600
>>>
>>>     PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS
>>>
>>>     There is no way to interact with a physical PCI slot without
>>>     sysfs, so encode the dependency and prevent this build error:
>>>
>>>         drivers/pci/slot.c: In function 'pci_hp_create_module_link':
>>>         drivers/pci/slot.c:327: error: 'module_kset' undeclared
>>>
>>>     This patch _should_ make pci-sysfs.o depend on CONFIG_SYSFS too,
>>>     but we cannot (yet) because the PCI core merrily assumes the
>>>     existence of sysfs:
>>>
>>>         drivers/built-in.o: In function `pci_bus_add_device':
>>>         drivers/pci/bus.c:89: undefined reference to `pci_create_sysfs_dev_files'
>>>         drivers/built-in.o: In function `pci_stop_dev':
>>>         drivers/pci/remove.c:24: undefined reference to `pci_remove_sysfs_dev_files'
>>>
>>>     So do the minimal bit for now and figure out how to untangle it
>>>     later.
>>>
>>> If No CONFIG_SYSFS, slot.o is not build
>>>
>>>>
>>>> Michael
>>>>
>>>>
>>>
>>>
>>> .
>>>
>>
> 
> .
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 15:09 [PATCH] PCI: hv: Fix build error without CONFIG_SYSFS YueHaibing
2019-06-01 22:59 ` Michael Kelley
2019-06-15  6:18   ` Yuehaibing
2019-06-15  6:48     ` Yuehaibing
2019-08-13 10:18       ` Lorenzo Pieralisi
2019-08-13 12:43         ` Yuehaibing
2019-06-14 14:19 ` Yuehaibing
2019-06-14 15:23   ` Lorenzo Pieralisi

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org linux-pci@archiver.kernel.org
	public-inbox-index linux-pci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox