Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1252210
| From | Yinghai Lu <yinghai@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() |
| Date | 2015-10-21 00:20 +0200 |
| Message-ID | <qlNqd-de-75@gated-at.bofh.it> (permalink) |
| References | <qhrex-7rq-3@gated-at.bofh.it> <qhrog-7CK-51@gated-at.bofh.it> <qlN6N-825-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Oct 20, 2015 at 2:57 PM, Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Thu, Oct 08, 2015 at 02:38:22PM -0700, Yinghai Lu wrote:
>> We register regions for legacy and iommu and all have open code.
>>
>> Unify them to pci_register_region() and call it accordingly.
>>
>> + if (!mem_res->flags)
>> return;
>>
>> - p->name = "Video RAM area";
>> - p->start = mem_res->start + 0xa0000UL;
>> - p->end = p->start + 0x1ffffUL;
>> - p->flags = IORESOURCE_BUSY;
>> - request_resource(mem_res, p);
>> + mem_rstart = mem_res->start - offset;
>> + mem_rend = mem_res->end - offset;
>
> This is essentially doing pcibios_bus_to_resource(), except in an
> unnecessarily arch-dependent way. Can you rework it to use
> pcibios_bus_to_resource()? I think you'll have to do
> pci_register_legacy_regions() in pci_scan_one_pbm() instead of in
> pci_determine_mem_io_space(), so that you have a struct pci_bus to
> use, but your next patch does that anyway.
>
>>
>> - p = kzalloc(sizeof(*p), GFP_KERNEL);
>> - if (!p)
>> + /* contain checking */
>> + if (!(mem_rstart <= rstart && mem_rend >= rend))
>> return;
Difference is here.
pcibios_bus_to_resource() would return resource even region is not contained.
>> + res->name = name;
>> + res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
>> + res->start = rstart + offset;
>> + res->end = rend + offset;
>> + conflict = request_resource_conflict(mem_res, res);
>> + if (conflict) {
>> + printk(KERN_DEBUG "PCI: %s can't claim %s %pR: address conflict with %s %pR\n",
>> + pbm->name, res->name, res, conflict->name, conflict);
>> + kfree(res);
>> + }
also we will need to get parent resource to use request_resource_conflict.
otherwise we need to use insert_resource(), but that will prevent driver to use
the resource.
Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Bjorn Helgaas <helgaas@kernel.org> - 2015-10-21 00:00 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-21 00:20 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-21 00:40 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Bjorn Helgaas <helgaas@kernel.org> - 2015-10-21 04:40 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-21 20:20 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Bjorn Helgaas <helgaas@kernel.org> - 2015-10-21 21:00 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-22 00:40 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-22 01:00 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-22 03:20 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-22 22:00 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() David Miller <davem@davemloft.net> - 2015-10-22 03:20 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2015-10-22 05:50 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Bjorn Helgaas <helgaas@kernel.org> - 2015-10-23 07:40 +0200
csiph-web