Hi,

these patches are an attempt to get the contributions from Jonas in a
shape that can be merged. This first version was tested on x86 and arm
32, i want it to work on arm64 as well but still had some trouble there.

So this first attempt is just to collect some feedback about the
general approach.

Jonas:
I kept you as author for one patch, and i added your signed-off, please
confirm that that was ok. If you want to test it, please also update
ivshmem-guest-code to what i pushed there today.

There are still a few points:
- the pci_cfg_base could become a general cmdline arg for systems doing
  mmio-pci, right now this is part of the demo, could maybe done once
  another demo needs it as well
- for my tests i abused the -linux-cells because we have ready and
  working configs with an ivshmem-pair for those, that is why i dropped
  the check for the !VETH, i am even tempted to revert the patch that
  introduced that, just for sharing configs
  Ivshmem-net should not get confused, since the demo-code does not
  touch the state-register
- i kind of dislike the #ifdef-spaghetti that i ended up with ...

Henning

Am Tue, 16 Jan 2018 17:04:37 +0100
schrieb Henning Schild <henning.sch...@siemens.com>:

> Code is just moved around and not changed. This prepares for using pci
> in arm demos.
> 
> Signed-off-by: Henning Schild <henning.sch...@siemens.com>
> ---
>  inmates/lib/inmate_common.h | 26 ++++++++++++++++++++++++++
>  inmates/lib/x86/inmate.h    | 26 --------------------------
>  2 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/inmates/lib/inmate_common.h b/inmates/lib/inmate_common.h
> index 6c779b5..9b770a3 100644
> --- a/inmates/lib/inmate_common.h
> +++ b/inmates/lib/inmate_common.h
> @@ -42,6 +42,24 @@
>  #define NS_PER_MSEC          1000000UL
>  #define NS_PER_SEC           1000000000UL
>  
> +#define PCI_CFG_VENDOR_ID    0x000
> +#define PCI_CFG_DEVICE_ID    0x002
> +#define PCI_CFG_COMMAND              0x004
> +# define PCI_CMD_IO          (1 << 0)
> +# define PCI_CMD_MEM         (1 << 1)
> +# define PCI_CMD_MASTER              (1 << 2)
> +# define PCI_CMD_INTX_OFF    (1 << 10)
> +#define PCI_CFG_STATUS               0x006
> +# define PCI_STS_INT         (1 << 3)
> +# define PCI_STS_CAPS                (1 << 4)
> +#define PCI_CFG_BAR          0x010
> +# define PCI_BAR_64BIT               0x4
> +#define PCI_CFG_CAP_PTR              0x034
> +
> +#define PCI_ID_ANY           0xffff
> +
> +#define PCI_DEV_CLASS_OTHER  0xff
> +
>  #ifndef __ASSEMBLY__
>  typedef s8 __s8;
>  typedef u8 __u8;
> @@ -69,6 +87,14 @@ unsigned long strlen(const char *s);
>  int strncmp(const char *s1, const char *s2, unsigned long n);
>  int strcmp(const char *s1, const char *s2);
>  
> +u32 pci_read_config(u16 bdf, unsigned int addr, unsigned int size);
> +void pci_write_config(u16 bdf, unsigned int addr, u32 value,
> +                   unsigned int size);
> +int pci_find_device(u16 vendor, u16 device, u16 start_bdf);
> +int pci_find_cap(u16 bdf, u16 cap);
> +void pci_msi_set_vector(u16 bdf, unsigned int vector);
> +void pci_msix_set_vector(u16 bdf, unsigned int vector, u32 index);
> +
>  const char *cmdline_parse_str(const char *param, char *value_buffer,
>                             unsigned long buffer_size,
>                             const char *default_value);
> diff --git a/inmates/lib/x86/inmate.h b/inmates/lib/x86/inmate.h
> index 964a543..f903f24 100644
> --- a/inmates/lib/x86/inmate.h
> +++ b/inmates/lib/x86/inmate.h
> @@ -62,24 +62,6 @@
>  
>  #define APIC_LVL_ASSERT              (1 << 14)
>  
> -#define PCI_CFG_VENDOR_ID    0x000
> -#define PCI_CFG_DEVICE_ID    0x002
> -#define PCI_CFG_COMMAND              0x004
> -# define PCI_CMD_IO          (1 << 0)
> -# define PCI_CMD_MEM         (1 << 1)
> -# define PCI_CMD_MASTER              (1 << 2)
> -# define PCI_CMD_INTX_OFF    (1 << 10)
> -#define PCI_CFG_STATUS               0x006
> -# define PCI_STS_INT         (1 << 3)
> -# define PCI_STS_CAPS                (1 << 4)
> -#define PCI_CFG_BAR          0x010
> -# define PCI_BAR_64BIT               0x4
> -#define PCI_CFG_CAP_PTR              0x034
> -
> -#define PCI_ID_ANY           0xffff
> -
> -#define PCI_DEV_CLASS_OTHER  0xff
> -
>  #define PCI_CAP_MSI          0x05
>  #define PCI_CAP_MSIX         0x11
>  
> @@ -242,14 +224,6 @@ enum map_type { MAP_CACHED, MAP_UNCACHED };
>  void *alloc(unsigned long size, unsigned long align);
>  void map_range(void *start, unsigned long size, enum map_type
> map_type); 
> -u32 pci_read_config(u16 bdf, unsigned int addr, unsigned int size);
> -void pci_write_config(u16 bdf, unsigned int addr, u32 value,
> -                   unsigned int size);
> -int pci_find_device(u16 vendor, u16 device, u16 start_bdf);
> -int pci_find_cap(u16 bdf, u16 cap);
> -void pci_msi_set_vector(u16 bdf, unsigned int vector);
> -void pci_msix_set_vector(u16 bdf, unsigned int vector, u32 index);
> -
>  extern volatile u32 smp_num_cpus;
>  extern u8 smp_cpu_ids[SMP_MAX_CPUS];
>  void smp_wait_for_all_cpus(void);

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to