[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 06/13] xen/arm: Introduce a generic way to describe device



On Fri, 2015-01-30 at 18:49 +0000, Julien Grall wrote:
> @@ -2,8 +2,34 @@
>  #define __ASM_ARM_DEVICE_H
>  
>  #include <xen/init.h>
> +
> +enum device_type
> +{
> +    DEV_DT,

I suppose no #ifdef here because an empty enum is a bit silly?

>  
> +/* TODO: Correctly implement dev_is_pci when PCI will be supported on ARM */

s/will be/is/

> +#define dev_is_pci(dev) ((void)(dev), 0)
> +#define dev_is_dt(dev)  ((dev->type == DEV_DT)
> +
>  enum device_class
>  {
>      DEVICE_SERIAL,
> diff --git a/xen/include/asm-x86/device.h b/xen/include/asm-x86/device.h
> new file mode 100644
> index 0000000..a016112
> --- /dev/null
> +++ b/xen/include/asm-x86/device.h
> @@ -0,0 +1,25 @@
> +#ifndef __ASM_X86_DEVICE_H
> +#define __ASM_X86_DEVICE_H
> +
> +#include <xen/pci.h>
> +
> +/*
> + * x86 is only supported PCI. Therefore it's possible to directly use

"x86 is only supporting PCI" or (better) "x86 only supports PCI".

> +#define dt_to_dev(dt_node)  (&(dt_node)->dev)
> +
> +static inline struct dt_device_node *dev_to_dt(struct device *dev)
> +{
> +    ASSERT(dev->type == DEV_DT);
> +
> +    return container_of(dev, struct dt_device_node, dev);
> +}

Given that x86 uses a difference struct and doesn't support DT shouldn't
this either be wrapped in a HAVE_DEVICE_TREE or placed in the ARM header
(or some other common-to-all-dt-platforms header)?

> +
>  #define MAX_PHANDLE_ARGS 16
>  struct dt_phandle_args {
>      struct dt_device_node *np;
> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> index 8eb764a..ecb2627 100644
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -25,6 +25,7 @@
>  #include <xen/pci.h>
>  #include <public/hvm/ioreq.h>
>  #include <public/domctl.h>
> +#include <asm/device.h>
>  #include <asm/iommu.h>
>  
>  extern bool_t iommu_enable, iommu_enabled;
> diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
> index 5f295f3..3988ee68 100644
> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -13,6 +13,7 @@
>  #include <xen/irq.h>
>  #include <xen/pci_regs.h>
>  #include <xen/pfn.h>
> +#include <asm/device.h>
>  #include <asm/pci.h>
>  
>  /*



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.