From: Tristan Gingold Subject: Re: pcifront for ia64 Date: Thu, 27 Jul 2006 15:16:23 +0200 Message-ID: <200607271516.23157.Tristan.Gingold@bull.net> References: <200607271141.14467.Tristan.Gingold@bull.net> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_nyLyESFvv01N/A/" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com, xen-ia64-devel List-Id: xen-devel@lists.xenproject.org --Boundary-00=_nyLyESFvv01N/A/ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Jeudi 27 Juillet 2006 14:12, Keir Fraser a =E9crit : > On 27 Jul 2006, at 10:41, Tristan Gingold wrote: > > this patch ports pcifont to ia64. pciback compiles without any change. > > > > I had to make a few change because pcifront use its own structure > > (struct pcifront_sd) for sysdata while ia64 wants it own (at least for > > pcibios_fixup_bus). My solution is to reuse the ia64 sysdata structure > > for pcifront, at the cost of a few ugly #ifdef. > > > > Comments and ideas are welcome to improve this. > > > > Also the patch fix a compile-time warning for xenbus.c. > > > > Using this patch I was able to use an ethernet card in domU. This is > > the good news. > > Move the sysdata initialisation to static inline functions in > pcifront.h. That means you only have a single big ifdef in the header, > and none in the main C files. With that change this will be fine to > check in. Thank you for your quick reply. Here is the updated patch. Tristan. --Boundary-00=_nyLyESFvv01N/A/ Content-Type: text/x-diff; charset="iso-8859-1"; name="xen-pcifront2.diffs" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-pcifront2.diffs" # HG changeset patch # User gingold@virtu10 # Node ID 4519e440e05c4083ce28187dd771416a31fbeda1 # Parent 254c090854de353cf9859575c2bed0549d0ff5dd Pcifront for ia64. Added in Kconfig. On ia64, use ia64 sysdata instead of pcifront genuine one. Fix a warning on xenbus.c Signed-off-by: Tristan Gingold diff -r 254c090854de -r 4519e440e05c linux-2.6-xen-sparse/arch/ia64/Kconfig --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig Wed Jul 26 15:59:36 2006 -0600 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig Thu Jul 27 13:30:37 2006 +0200 @@ -438,6 +438,21 @@ config PCI_DOMAINS bool default PCI +config XEN_PCIDEV_FRONTEND + bool "Xen PCI Frontend" + depends on PCI && XEN + default y + help + The PCI device frontend driver allows the kernel to import arbitrary + PCI devices from a PCI backend to support PCI driver domains. + +config XEN_PCIDEV_FE_DEBUG + bool "Xen PCI Frontend Debugging" + depends on XEN_PCIDEV_FRONTEND + default n + help + Enables some debug statements within the PCI Frontend. + source "drivers/pci/Kconfig" source "drivers/pci/hotplug/Kconfig" diff -r 254c090854de -r 4519e440e05c linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Wed Jul 26 15:59:36 2006 -0600 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c Thu Jul 27 13:30:37 2006 +0200 @@ -105,7 +105,7 @@ static int pcifront_bus_read(struct pci_ .size = size, }; struct pcifront_sd *sd = bus->sysdata; - struct pcifront_device *pdev = sd->pdev; + struct pcifront_device *pdev = pcifront_get_pdev(sd); if (verbose_request) dev_info(&pdev->xdev->dev, @@ -144,7 +144,7 @@ static int pcifront_bus_write(struct pci .value = val, }; struct pcifront_sd *sd = bus->sysdata; - struct pcifront_device *pdev = sd->pdev; + struct pcifront_device *pdev = pcifront_get_pdev(sd); if (verbose_request) dev_info(&pdev->xdev->dev, @@ -207,8 +207,7 @@ int pcifront_scan_root(struct pcifront_d err = -ENOMEM; goto err_out; } - sd->domain = domain; - sd->pdev = pdev; + pcifront_init_sd (sd, domain, pdev); b = pci_scan_bus_parented(&pdev->xdev->dev, bus, &pcifront_bus_ops, sd); if (!b) { diff -r 254c090854de -r 4519e440e05c linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c --- a/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Wed Jul 26 15:59:36 2006 -0600 +++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/xenbus.c Thu Jul 27 13:30:37 2006 +0200 @@ -7,6 +7,7 @@ #include #include #include +#include #include "pcifront.h" #define INVALID_GRANT_REF (0) diff -r 254c090854de -r 4519e440e05c linux-2.6-xen-sparse/include/xen/pcifront.h --- a/linux-2.6-xen-sparse/include/xen/pcifront.h Wed Jul 26 15:59:36 2006 -0600 +++ b/linux-2.6-xen-sparse/include/xen/pcifront.h Thu Jul 27 13:30:37 2006 +0200 @@ -11,6 +11,7 @@ #ifdef __KERNEL__ +#ifndef __ia64__ struct pcifront_device; struct pcifront_sd { @@ -20,7 +21,20 @@ struct pcifront_sd { struct pci_bus; -#ifdef CONFIG_PCI_DOMAINS +static inline struct pcifront_device * +pcifront_get_pdev (struct pcifront_sd *sd) +{ + return sd->pdev; +} + +static inline void pcifront_init_sd (struct pcifront_sd *sd, int domain, + struct pcifront_device *pdev) +{ + sd->domain = domain; + sd->pdev = pdev; +} + +#if defined(CONFIG_PCI_DOMAINS) static inline int pci_domain_nr(struct pci_bus *bus) { struct pcifront_sd *sd = bus->sysdata; @@ -31,6 +45,28 @@ static inline int pci_proc_domain(struct return pci_domain_nr(bus); } #endif /* CONFIG_PCI_DOMAINS */ +#else +#include +#define pcifront_sd pci_controller + +static inline struct pcifront_device * +pcifront_get_pdev (struct pcifront_sd *sd) +{ + return (struct pcifront_device *)sd->platform_data; +} + +static inline void pcifront_init_sd (struct pcifront_sd *sd, int domain, + struct pcifront_device *pdev) +{ + sd->segment = domain; + sd->acpi_handle = NULL; + sd->iommu = NULL; + sd->windows = 0; + sd->window = NULL; + sd->platform_data = pdev; +} + +#endif /* __ia64__ */ extern spinlock_t pci_bus_lock; --Boundary-00=_nyLyESFvv01N/A/ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_nyLyESFvv01N/A/--