xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Ping: [PATCH] PCI: properly abstract out per-architecture extensions to struct pci_dev
@ 2012-01-09 13:10 Jan Beulich
  2012-01-09 13:24 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-01-09 13:10 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 3490 bytes --]

x86's used_vectors member was both misplaced (in struct pci_dev_info,
which acts as a hypercall input data passing container only) and
improperly abstracted (requiring a CONFIG_X86 conditional in a generic
header).

The adjustment requires hiding several more lines in IA64's pci.h, but
as a benefit this allows removing one of the "null" headers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1877,7 +1877,7 @@ int map_domain_pirq(
         if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
              && !desc->arch.used_vectors )
         {
-            desc->arch.used_vectors = &pdev->info.used_vectors;
+            desc->arch.used_vectors = &pdev->arch.used_vectors;
             if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
             {
                 int vector = desc->arch.vector;
--- a/xen/include/asm-ia64/linux-null/asm-generic/pci-dma-compat.h
+++ /dev/null
@@ -1 +0,0 @@
-/* This file is intentionally left empty. */
--- a/xen/include/asm-ia64/linux-xen/asm/pci.h
+++ b/xen/include/asm-ia64/linux-xen/asm/pci.h
@@ -28,6 +28,10 @@ void pcibios_config_init(void);
 
 struct pci_dev;
 
+#ifdef XEN
+struct arch_pci_dev {};
+#endif
+
 /*
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct correspondence
  * between device bus addresses and CPU physical addresses.  Platforms with a hardware I/O
@@ -43,6 +47,7 @@ struct pci_dev;
 extern unsigned long ia64_max_iommu_merge_mask;
 #define PCI_DMA_BUS_IS_PHYS	(ia64_max_iommu_merge_mask == ~0UL)
 
+#ifndef XEN
 static inline void
 pcibios_set_master (struct pci_dev *dev)
 {
@@ -110,7 +115,6 @@ extern int pci_mmap_page_range (struct p
 #define HAVE_PCI_LEGACY
 extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
 				      struct vm_area_struct *vma);
-#ifndef XEN
 extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off,
 				  size_t count);
 extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off,
@@ -144,6 +148,7 @@ struct pci_controller {
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
 #define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
+#ifndef XEN
 extern struct pci_ops pci_root_ops;
 
 static inline int pci_proc_domain(struct pci_bus *bus)
@@ -161,7 +166,6 @@ extern void pcibios_resource_to_bus(stru
 extern void pcibios_bus_to_resource(struct pci_dev *dev,
 		struct resource *res, struct pci_bus_region *region);
 
-#ifndef XEN
 static inline struct resource *
 pcibios_select_root(struct pci_dev *pdev, struct resource *res)
 {
--- /dev/null
+++ b/xen/include/asm-x86/pci.h
@@ -0,0 +1,8 @@
+#ifndef __X86_PCI_H__
+#define __X86_PCI_H__
+
+struct arch_pci_dev {
+    vmask_t used_vectors;
+};
+
+#endif /* __X86_PCI_H__ */
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -12,6 +12,7 @@
 #include <xen/list.h>
 #include <xen/spinlock.h>
 #include <xen/irq.h>
+#include <asm/pci.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
@@ -39,9 +40,6 @@ struct pci_dev_info {
         u8 bus;
         u8 devfn;
     } physfn;
-#ifdef CONFIG_X86
-    vmask_t used_vectors;
-#endif
 };
 
 struct pci_dev {
@@ -62,6 +60,7 @@ struct pci_dev {
     const u8 bus;
     const u8 devfn;
     struct pci_dev_info info;
+    struct arch_pci_dev arch;
     u64 vf_rlen[6];
 };
 




[-- Attachment #2: arch-pci_dev.patch --]
[-- Type: text/plain, Size: 3560 bytes --]

PCI: properly abstract out per-architecture extensions to struct pci_dev

x86's used_vectors member was both misplaced (in struct pci_dev_info,
which acts as a hypercall input data passing container only) and
improperly abstracted (requiring a CONFIG_X86 conditional in a generic
header).

The adjustment requires hiding several more lines in IA64's pci.h, but
as a benefit this allows removing one of the "null" headers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1877,7 +1877,7 @@ int map_domain_pirq(
         if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
              && !desc->arch.used_vectors )
         {
-            desc->arch.used_vectors = &pdev->info.used_vectors;
+            desc->arch.used_vectors = &pdev->arch.used_vectors;
             if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
             {
                 int vector = desc->arch.vector;
--- a/xen/include/asm-ia64/linux-null/asm-generic/pci-dma-compat.h
+++ /dev/null
@@ -1 +0,0 @@
-/* This file is intentionally left empty. */
--- a/xen/include/asm-ia64/linux-xen/asm/pci.h
+++ b/xen/include/asm-ia64/linux-xen/asm/pci.h
@@ -28,6 +28,10 @@ void pcibios_config_init(void);
 
 struct pci_dev;
 
+#ifdef XEN
+struct arch_pci_dev {};
+#endif
+
 /*
  * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct correspondence
  * between device bus addresses and CPU physical addresses.  Platforms with a hardware I/O
@@ -43,6 +47,7 @@ struct pci_dev;
 extern unsigned long ia64_max_iommu_merge_mask;
 #define PCI_DMA_BUS_IS_PHYS	(ia64_max_iommu_merge_mask == ~0UL)
 
+#ifndef XEN
 static inline void
 pcibios_set_master (struct pci_dev *dev)
 {
@@ -110,7 +115,6 @@ extern int pci_mmap_page_range (struct p
 #define HAVE_PCI_LEGACY
 extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
 				      struct vm_area_struct *vma);
-#ifndef XEN
 extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off,
 				  size_t count);
 extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off,
@@ -144,6 +148,7 @@ struct pci_controller {
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
 #define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
 
+#ifndef XEN
 extern struct pci_ops pci_root_ops;
 
 static inline int pci_proc_domain(struct pci_bus *bus)
@@ -161,7 +166,6 @@ extern void pcibios_resource_to_bus(stru
 extern void pcibios_bus_to_resource(struct pci_dev *dev,
 		struct resource *res, struct pci_bus_region *region);
 
-#ifndef XEN
 static inline struct resource *
 pcibios_select_root(struct pci_dev *pdev, struct resource *res)
 {
--- /dev/null
+++ b/xen/include/asm-x86/pci.h
@@ -0,0 +1,8 @@
+#ifndef __X86_PCI_H__
+#define __X86_PCI_H__
+
+struct arch_pci_dev {
+    vmask_t used_vectors;
+};
+
+#endif /* __X86_PCI_H__ */
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -12,6 +12,7 @@
 #include <xen/list.h>
 #include <xen/spinlock.h>
 #include <xen/irq.h>
+#include <asm/pci.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
@@ -39,9 +40,6 @@ struct pci_dev_info {
         u8 bus;
         u8 devfn;
     } physfn;
-#ifdef CONFIG_X86
-    vmask_t used_vectors;
-#endif
 };
 
 struct pci_dev {
@@ -62,6 +60,7 @@ struct pci_dev {
     const u8 bus;
     const u8 devfn;
     struct pci_dev_info info;
+    struct arch_pci_dev arch;
     u64 vf_rlen[6];
 };
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ping: [PATCH] PCI: properly abstract out per-architecture extensions to struct pci_dev
  2012-01-09 13:10 Ping: [PATCH] PCI: properly abstract out per-architecture extensions to struct pci_dev Jan Beulich
@ 2012-01-09 13:24 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-01-09 13:24 UTC (permalink / raw)
  To: Jan Beulich, xen-devel@lists.xensource.com

On 09/01/2012 13:10, "Jan Beulich" <JBeulich@suse.com> wrote:

> x86's used_vectors member was both misplaced (in struct pci_dev_info,
> which acts as a hypercall input data passing container only) and
> improperly abstracted (requiring a CONFIG_X86 conditional in a generic
> header).
> 
> The adjustment requires hiding several more lines in IA64's pci.h, but
> as a benefit this allows removing one of the "null" headers.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -1877,7 +1877,7 @@ int map_domain_pirq(
>          if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
>               && !desc->arch.used_vectors )
>          {
> -            desc->arch.used_vectors = &pdev->info.used_vectors;
> +            desc->arch.used_vectors = &pdev->arch.used_vectors;
>              if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
>              {
>                  int vector = desc->arch.vector;
> --- a/xen/include/asm-ia64/linux-null/asm-generic/pci-dma-compat.h
> +++ /dev/null
> @@ -1 +0,0 @@
> -/* This file is intentionally left empty. */
> --- a/xen/include/asm-ia64/linux-xen/asm/pci.h
> +++ b/xen/include/asm-ia64/linux-xen/asm/pci.h
> @@ -28,6 +28,10 @@ void pcibios_config_init(void);
>  
>  struct pci_dev;
>  
> +#ifdef XEN
> +struct arch_pci_dev {};
> +#endif
> +
>  /*
>   * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
> correspondence
>   * between device bus addresses and CPU physical addresses.  Platforms with a
> hardware I/O
> @@ -43,6 +47,7 @@ struct pci_dev;
>  extern unsigned long ia64_max_iommu_merge_mask;
>  #define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
>  
> +#ifndef XEN
>  static inline void
>  pcibios_set_master (struct pci_dev *dev)
>  {
> @@ -110,7 +115,6 @@ extern int pci_mmap_page_range (struct p
>  #define HAVE_PCI_LEGACY
>  extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
>      struct vm_area_struct *vma);
> -#ifndef XEN
>  extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t
> off,
>  size_t count);
>  extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t
> off,
> @@ -144,6 +148,7 @@ struct pci_controller {
>  #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
>  #define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
>  
> +#ifndef XEN
>  extern struct pci_ops pci_root_ops;
>  
>  static inline int pci_proc_domain(struct pci_bus *bus)
> @@ -161,7 +166,6 @@ extern void pcibios_resource_to_bus(stru
>  extern void pcibios_bus_to_resource(struct pci_dev *dev,
> struct resource *res, struct pci_bus_region *region);
>  
> -#ifndef XEN
>  static inline struct resource *
>  pcibios_select_root(struct pci_dev *pdev, struct resource *res)
>  {
> --- /dev/null
> +++ b/xen/include/asm-x86/pci.h
> @@ -0,0 +1,8 @@
> +#ifndef __X86_PCI_H__
> +#define __X86_PCI_H__
> +
> +struct arch_pci_dev {
> +    vmask_t used_vectors;
> +};
> +
> +#endif /* __X86_PCI_H__ */
> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -12,6 +12,7 @@
>  #include <xen/list.h>
>  #include <xen/spinlock.h>
>  #include <xen/irq.h>
> +#include <asm/pci.h>
>  
>  /*
>   * The PCI interface treats multi-function devices as independent
> @@ -39,9 +40,6 @@ struct pci_dev_info {
>          u8 bus;
>          u8 devfn;
>      } physfn;
> -#ifdef CONFIG_X86
> -    vmask_t used_vectors;
> -#endif
>  };
>  
>  struct pci_dev {
> @@ -62,6 +60,7 @@ struct pci_dev {
>      const u8 bus;
>      const u8 devfn;
>      struct pci_dev_info info;
> +    struct arch_pci_dev arch;
>      u64 vf_rlen[6];
>  };
>  
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-09 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-09 13:10 Ping: [PATCH] PCI: properly abstract out per-architecture extensions to struct pci_dev Jan Beulich
2012-01-09 13:24 ` Keir Fraser

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).