From: Hauke Mehrtens <hauke@hauke-m.de>
To: Nathan Hintz <nlhintz@hotmail.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/5] bcma: don't map/unmap a subset of the PCI config space
Date: Sat, 12 Jan 2013 15:45:03 +0100 [thread overview]
Message-ID: <50F176EF.7080705@hauke-m.de> (raw)
In-Reply-To: <50F17583.2000309@hauke-m.de>
On 01/12/2013 03:38 PM, Hauke Mehrtens wrote:
> On 01/12/2013 11:46 AM, Nathan Hintz wrote:
>> For PCI config space access offsets < 256 for device '0',
>> bcma_extpci_write_config performs an 'ioremap_nocache' on a 4 byte
>> section of the PCI config space (an area that has already
>> previously been mapped), and then subsequently unmaps that 4 byte
>> section. This can't be a good thing for future read access from
>> that now unmapped location. Modify the config space writes to use
>> the existing access functions (similar to how it is done for the reads).
>>
>> Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>> drivers/bcma/driver_pci_host.c | 22 +++++++++++-----------
>> 1 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c
>> index 187cc9f..e1381ba 100644
>> --- a/drivers/bcma/driver_pci_host.c
>> +++ b/drivers/bcma/driver_pci_host.c
>> @@ -149,7 +149,7 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
>> const void *buf, int len)
>> {
>> int err = -EINVAL;
>> - u32 addr = 0, val = 0;
>> + u32 addr, val;
>> void __iomem *mmio = 0;
>> u16 chipid = pc->core->bus->chipinfo.id;
>>
>> @@ -165,12 +165,10 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
>> * requires indirect access.
>> */
>> if (off < PCI_CONFIG_SPACE_SIZE) {
>> - addr = pc->core->addr + BCMA_CORE_PCI_PCICFG0;
>> + addr = BCMA_CORE_PCI_PCICFG0;
>> addr |= (func << 8);
>> addr |= (off & 0xfc);
>> - mmio = ioremap_nocache(addr, sizeof(val));
>> - if (!mmio)
>> - goto out;
>> + val = pcicore_read32(pc, addr);
>> }
>
> off >= PCI_CONFIG_SPACE_SIZE is not handled here, but I think it should
> be. This part of the function should use the same code as used in
> bcma_extpci_read_config().
>
> Your patch improves this, but I think there is an other flaw in the code.
I just saw you do this in the next patch, ignore this comment.
>
>> } else {
>> addr = bcma_get_cfgspace_addr(pc, dev, func, off);
>> @@ -189,12 +187,10 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
>>
>> switch (len) {
>> case 1:
>> - val = readl(mmio);
>> val &= ~(0xFF << (8 * (off & 3)));
>> val |= *((const u8 *)buf) << (8 * (off & 3));
>> break;
>> case 2:
>> - val = readl(mmio);
>> val &= ~(0xFFFF << (8 * (off & 3)));
>> val |= *((const u16 *)buf) << (8 * (off & 3));
>> break;
>> @@ -202,13 +198,17 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
>> val = *((const u32 *)buf);
>> break;
>> }
>> - if (dev == 0 && !addr) {
>> + if (dev == 0) {
>> /* accesses to config registers with offsets >= 256
>> * requires indirect access.
>> */
>> - addr = (func << 12);
>> - addr |= (off & 0x0FFF);
>> - bcma_pcie_write_config(pc, addr, val);
>> + if (off >= PCI_CONFIG_SPACE_SIZE) {
>> + addr = (func << 12);
>> + addr |= (off & 0x0FFF);
>> + bcma_pcie_write_config(pc, addr, val);
>> + } else {
>> + pcicore_write32(pc, addr, val);
>> + }
>> } else {
>> writel(val, mmio);
>>
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-01-12 14:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1357987577-20661-1-git-send-email-nlhintz@hotmail.com>
2013-01-12 10:46 ` [PATCH 1/5] bcma: delete duplicate readl Nathan Hintz
2013-01-12 14:16 ` Hauke Mehrtens
2013-01-12 10:46 ` [PATCH 2/5] bcma: jump to 'out' label for invalid 'func' value Nathan Hintz
2013-01-12 14:18 ` Hauke Mehrtens
2013-01-12 10:46 ` [PATCH 3/5] bcma: don't map/unmap a subset of the PCI config space Nathan Hintz
2013-01-12 14:38 ` Hauke Mehrtens
2013-01-12 14:45 ` Hauke Mehrtens [this message]
2013-01-12 10:46 ` [PATCH 4/5] bcma: add support for 1 and 2 byte extended config space access Nathan Hintz
2013-01-12 14:44 ` Hauke Mehrtens
2013-01-12 10:46 ` [PATCH 5/5] bcma: use consistent case for 'hex' constants Nathan Hintz
2013-01-12 14:05 ` Hauke Mehrtens
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=50F176EF.7080705@hauke-m.de \
--to=hauke@hauke-m.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=nlhintz@hotmail.com \
/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;
as well as URLs for NNTP newsgroup(s).