Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1499674
| Path | csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Christoph Hellwig <hch@infradead.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 01/11] pci: endpoint: add EP core layer to enable EP controller and EP functions |
| Date | Wed, 12 Oct 2016 15:20:02 +0200 |
| Message-ID | <srrBU-4SP-37@gated-at.bofh.it> (permalink) |
| References | <shaM1-4De-3@gated-at.bofh.it> <shaM1-4De-1@gated-at.bofh.it> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.6.1 (2016-04-27) |
| X-Srs-Rewrite | SMTP reverse-path rewritten from <hch@infradead.org> by bombadil.infradead.org. See http://www.infradead.org/rpr.html |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 53 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Bjorn Helgaas <bhelgaas@google.com>, Arnd Bergmann <arnd@arndb.de>, Jingoo Han <jingoohan1@gmail.com>, hch@infradead.org, Joao.Pinto@synopsys.com, mingkai.hu@nxp.com, m-karicheri2@ti.com, Pratyush Anand <pratyush.anand@gmail.com>, linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joao Pinto <jpinto@synopsys.com>, Rob Herring <robh+dt@kernel.org>, nsekhar@ti.com |
| X-Original-Date | Wed, 12 Oct 2016 05:38:43 -0700 |
| X-Original-Message-ID | <20161012123843.GA942@infradead.org> |
| X-Original-References | <1473829927-20466-1-git-send-email-kishon@ti.com> <1473829927-20466-2-git-send-email-kishon@ti.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1499674 |
Show key headers only | View raw
> +/**
> + * pci_epc_stop() - stop the PCI link
> + * @epc: the link of the EPC device that has to be stopped
> + *
> + * Invoke to stop the PCI link
> + */
> +void pci_epc_stop(struct pci_epc *epc)
> +{
> + if (IS_ERR(epc) || !epc->ops->stop)
> + return;
> +
> + spin_lock_irq(&epc->irq_lock);
> + epc->ops->stop(epc);
> + spin_unlock_irq(&epc->irq_lock);
> +}
> +EXPORT_SYMBOL_GPL(pci_epc_stop);
Can you elaborate on the synchronization strategy here? It seems
like irq_lock is generally taken irq save and just around method
calls. Wou;dn't it be better to leave locking to the methods
themselves?
> +/**
> + * struct pci_epc - represents the PCI EPC device
> + * @dev: PCI EPC device
> + * @ops: function pointers for performing endpoint operations
> + * @mutex: mutex to protect pci_epc ops
> + */
> +struct pci_epc {
> + struct device dev;
> + /* support only single function PCI device for now */
> + struct pci_epf *epf;
> + const struct pci_epc_ops *ops;
> + spinlock_t irq_lock;
> +};
And this still documentes a mutex instead of the irq save spinlock,
while we're at it..
> +/**
> + * struct pci_epf_bar - represents the BAR of EPF device
> + * @phys_addr: physical address that should be mapped to the BAR
> + * @size: the size of the address space present in BAR
> + */
> +struct pci_epf_bar {
> + dma_addr_t phys_addr;
> + size_t size;
> +};
Just curious: shouldn't this be a phys_addr_t instead of a dma_addr_t?
Otherwise this looks like a nice little framework to get started!
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [RFC PATCH 01/11] pci: endpoint: add EP core layer to enable EP controller and EP functions Christoph Hellwig <hch@infradead.org> - 2016-10-12 15:20 +0200
csiph-web