On 15.01.20 15:54, Ralf Ramsauer wrote:


On 1/6/20 3:20 PM, Jan Kiszka wrote:
From: Jan Kiszka <jan.kis...@siemens.com>

Provide PCI support for ARM by implementing mmconfig-based
pci_read/write_config and moving shared defines and prototypes into the
common header. pci_msix_set_vector is only implemented as stub on ARM
so far, can be enhanced later.

As mmconfig implies mapping of that MMIO region, pci_init is introduced.
x86 does not need it and only implements a stub in order to allow
arch-independent inmates.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
  inmates/lib/arm-common/Makefile.lib   |  4 +-
  inmates/lib/{x86 => arm-common}/pci.c | 96 ++++++++++-------------------------
  inmates/lib/include/inmate_common.h   | 34 +++++++++++++
  inmates/lib/x86/include/inmate.h      | 32 ------------
  inmates/lib/x86/pci.c                 |  4 ++
  5 files changed, 66 insertions(+), 104 deletions(-)
  copy inmates/lib/{x86 => arm-common}/pci.c (51%)

diff --git a/inmates/lib/arm-common/Makefile.lib 
b/inmates/lib/arm-common/Makefile.lib
index 669ff485..8a4c2237 100644
--- a/inmates/lib/arm-common/Makefile.lib
+++ b/inmates/lib/arm-common/Makefile.lib
@@ -37,8 +37,8 @@
  #
objs-y := ../string.o ../cmdline.o ../setup.o ../alloc.o ../uart-8250.o
-objs-y += ../printk.o
-objs-y += printk.o gic.o mem.o timer.o setup.o uart.o
+objs-y += ../printk.o ../pci.o
+objs-y += printk.o gic.o mem.o pci.o timer.o setup.o uart.o
  objs-y += uart-xuartps.o uart-mvebu.o uart-hscif.o uart-scifa.o uart-imx.o
  objs-y += uart-pl011.o
  objs-y += gic-v2.o gic-v3.o
diff --git a/inmates/lib/x86/pci.c b/inmates/lib/arm-common/pci.c
similarity index 51%
copy from inmates/lib/x86/pci.c
copy to inmates/lib/arm-common/pci.c
index 06dd193f..99210c21 100644
--- a/inmates/lib/x86/pci.c
+++ b/inmates/lib/arm-common/pci.c
@@ -1,7 +1,7 @@
  /*
   * Jailhouse, a Linux-based partitioning hypervisor
   *
- * Copyright (c) Siemens AG, 2014
+ * Copyright (c) Siemens AG, 2014-2020
   *
   * Authors:
   *  Jan Kiszka <jan.kis...@siemens.com>
@@ -38,21 +38,32 @@
#include <inmate.h> -#define PCI_REG_ADDR_PORT 0xcf8
-#define PCI_REG_DATA_PORT      0xcfc
+void pci_init(void)
+{
+       void *mmcfg = (void *)(unsigned long)comm_region->pci_mmconfig_base;
+
+       if (mmcfg)
+               map_range(mmcfg, 0x100000, MAP_UNCACHED);
+}
-#define PCI_CONE (1 << 31)
+static void *pci_get_device_mmcfg_base(u16 bdf)

inline?

The compiler will do that if appropriate.


+{
+       void *mmcfg = (void *)(unsigned long)comm_region->pci_mmconfig_base;
+
+        return mmcfg + ((unsigned long)bdf << 12);

Here are whitespaces instead of tabs.

Ooops.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/41769cbb-832e-ead9-b062-663069ed2221%40siemens.com.

Reply via email to