lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE9FiQVC+r=7NrCvwq9+1XVQD9CGf_3+-4VO9kFPSGqMTR5cBw@mail.gmail.com>
Date:	Tue, 20 Oct 2015 15:16:45 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Bjorn Helgaas <helgaas@...nel.org>
Cc:	Bjorn Helgaas <bhelgaas@...gle.com>,
	David Miller <davem@...emloft.net>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Wei Yang <weiyang@...ux.vnet.ibm.com>, TJ <linux@....tj>,
	Yijing Wang <wangyijing@...wei.com>,
	Khalid Aziz <khalid.aziz@...cle.com>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region()

On Tue, Oct 20, 2015 at 2:57 PM, Bjorn Helgaas <helgaas@...nel.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ