Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597467

Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to access data of 4/2/1 bytes

From Niklas Cassel <niklas.cassel@axis.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to access data of 4/2/1 bytes
Date 2017-03-10 14:00 +0100
Message-ID <tjsjh-49K-55@gated-at.bofh.it> (permalink)
References <tj03E-1gR-11@gated-at.bofh.it> <tj03E-1gR-21@gated-at.bofh.it> <tj7HQ-6AN-27@gated-at.bofh.it> <tjrwT-3LF-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/10/2017 01:04 PM, Kishon Vijay Abraham I wrote:
> Hi,
>
> On Thursday 09 March 2017 08:18 PM, Niklas Cassel wrote:
>> On 03/09/2017 07:39 AM, Kishon Vijay Abraham I wrote:
>>> Previously dbi accessors can be used to access data of size 4
>>> bytes. But there might be situations (like accessing
>>> MSI_MESSAGE_CONTROL in order to set/get the number of required
>>> MSI interrupts in EP mode) where dbi accessors must
>>> be used to access data of size 2. This is in preparation for
>>> adding endpoint mode support to designware driver.
>> Hello Kishon
>>
>> I don't really like the idea of adding an extra argument to every existing read/write.
>> Will not a read/write of length != 32 be quite uncommon compared to
>> a read/write of length == 32?
>>
>> How about adding some defines to pcie-designware.h:
>>
>> #define dw_pcie_writel_dbi(pci, base, reg, val) dw_pcie_write_dbi(pci, base, reg, 0x4, val)
>> #define dw_pcie_readl_dbi(pci, base, reg) dw_pcie_read_dbi(pci, base, reg, 0x4)
>>
>> That way we don't have to change every existing read/write.
>>
>>
>>
>> Is there a reason why we can't just do:
>>
>> vial = dw_pcie_readl_dbi(pci, base, MSI_MESSAGE_CONTROL);
> MSI_MESSAGE_CONTROL is 0x52 (MSI capability offset + 2). I'm not sure if we can
> do a readl that crosses the alignment boundary in all platforms. The other
> option is to readl from "MSI capability offset + 0" and extract the last 16
> bits. I felt this is more clear since we are interested only in the
> MSI_MESSAGE_CONTROL.
>
>> <shifting+masking the bits we need to get/set>
>> dw_pcie_writel_dbi(pci, base, MSI_MESSAGE_CONTROL, val);
>>
>> Or are we going to be doing read/writes of length != 32 so often that
>> you think that it's cleaner to have this abstraction?
> it's used mainly for accessing configuration space header fields. Even the pci
> core uses *pci_read_config_word* for accessing such fields.

I see. Adding an extra size argument is a good thing then,
since it's consistent with the pci generic code.

However, I still think that having defines for writel/readl is a
good thing :)


>
> Thanks
> Kishon

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH v3 0/7] PCI: dwc: Miscellaneous fixes and cleanups Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
  [RESEND PATCH v3 3/7] PCI: dwc: artpec6: Populate cpu_addr_fixup ops Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
    Re: [RESEND PATCH v3 3/7] PCI: dwc: artpec6: Populate cpu_addr_fixup  ops Niklas Cassel <niklas.cassel@axis.com> - 2017-03-09 11:30 +0100
  [RESEND PATCH v3 6/7] PCI: dwc: designware: Move _unroll configurations to a separate function Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
    Re: [RESEND PATCH v3 6/7] PCI: dwc: designware: Move _unroll  configurations to a separate function Joao Pinto <Joao.Pinto@synopsys.com> - 2017-03-09 13:30 +0100
  [RESEND PATCH v3 2/7] PCI: dwc: dra7xx: Populate cpu_addr_fixup ops Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
  [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to access data of 4/2/1  bytes Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
    Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to  access data of 4/2/1 bytes Niklas Cassel <niklas.cassel@axis.com> - 2017-03-09 16:00 +0100
      Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to  access data of 4/2/1 bytes Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-10 13:10 +0100
        Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to  access data of 4/2/1 bytes Niklas Cassel <niklas.cassel@axis.com> - 2017-03-10 14:00 +0100
          Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to  access data of 4/2/1 bytes Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-10 14:10 +0100
            Re: [RESEND PATCH v3 5/7] PCI: dwc: all: Modify dbi accessors to  access data of 4/2/1 bytes Niklas Cassel <niklas.cassel@axis.com> - 2017-03-10 16:00 +0100
  [RESEND PATCH v3 7/7] PCI: dwc: dra7xx: Push request_irq call to the bottom of probe Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
  [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take dbi_base as argument Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100
    Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Niklas Cassel <niklas.cassel@axis.com> - 2017-03-09 16:00 +0100
      Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Niklas Cassel <niklas.cassel@axis.com> - 2017-03-09 16:20 +0100
        Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-10 12:40 +0100
          Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Niklas Cassel <niklas.cassel@axis.com> - 2017-03-10 13:30 +0100
          Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Joao Pinto <Joao.Pinto@synopsys.com> - 2017-03-10 13:40 +0100
          Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Niklas Cassel <niklas.cassel@axis.com> - 2017-03-10 13:40 +0100
            Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-10 14:10 +0100
              Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Niklas Cassel <niklas.cassel@axis.com> - 2017-03-10 16:50 +0100
                Re: [RESEND PATCH v3 4/7] PCI: dwc: all: Modify dbi accessors to take  dbi_base as argument Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-13 06:40 +0100
  [RESEND PATCH v3 1/7] PCI: dwc: designware: Add new *ops* for cpu addr fixup Kishon Vijay Abraham I <kishon@ti.com> - 2017-03-09 07:50 +0100

csiph-web