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

[UNIKRAFT PATCH RFCv3 00/32] Impelment virtio_mmio and pci ecam controller for arm64 kvm plat



To support virtio-* family device, we have 2 choices (virtio mmio, virtio pci)
on arm64 kvm plat. This patch series enable the support of virtio mmio. virtio
pci needs pci controller ECAM mode in arm64 Unikraft.

Previously, I proposed a separated series at [1], Julien had given some
comments including using fdt_get_address and refining the platform device
probing sequence. This series address them, but prevent changing too much
in original virtio mmio series.

Patch 1-5 implement the platform bus and virtio mmio skeleton.
Patch 8-10 implement the pci ecam skeleton
Patch 12-13 introduce the new probing interface for virtio mmio and pci
      on arm.
Patch 7,11,14,15,16 lib/fdt or ofw/fdt changes
Patch 17-19 split the arch specific pci bus codes into different directory
Else are the bug fixing or minor changes.

Test
====
1. The test case is a simple httpreply app.
test qemu cmdline:
- for virtio mmio
-device virtio-net-device,id=net1,netdev=hostnet1,mac=52:54:00:09:a4:38
- for virtio pci
-device 
virtio-net-pci,id=net0,netdev=hostnet0,mac=52:54:00:09:a4:31,disable-modern=on

2. Besides, I also tested it with nginx app which was suggested by Felipe. ping
and wget both worked. But this needs a workaround in libngix app to avoid crash
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 9fcb0eb..3afcb66 100644
@@ -1101,18 +1103,11 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void 
*conf)

     if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
         struct group   *grp;
-       struct passwd  *pwd;

         ngx_set_errno(0);
-       pwd = getpwnam(NGX_USER);
-       if (pwd == NULL) {
-           ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
-                         "getpwnam(\"" NGX_USER "\") failed");
-           return NGX_CONF_ERROR;
-       }

         ccf->username = NGX_USER;
-       ccf->user = pwd->pw_uid;
+       ccf->user = 0;

         ngx_set_errno(0);
         grp = getgrnam(NGX_GROUP);
@@ -1193,7 +1188,6 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void 
*conf)
     ngx_core_conf_t  *ccf = conf;

     char            *group;
-    struct passwd    *pwd;
     struct group     *grp;
     ngx_str_t  *value;

@@ -1214,14 +1208,8 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void 
*conf)
     ccf->username = (char *) value[1].data;

     ngx_set_errno(0);
-    pwd = getpwnam((const char *) value[1].data);
-    if (pwd == NULL) {
-       ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                          "getpwnam(\"%s\") failed", value[1].data);
-       return NGX_CONF_ERROR;
-    }

-    ccf->user = pwd->pw_uid;
+    ccf->user = 0;

     group = (char *) ((cf->args->nelts == 2) ? value[1].data : value[2].data);

[1] 
https://lists.xenproject.org/archives/html/minios-devel/2019-10/msg00688.html

Changes:
========
v3: Fix bugs in virtio 9p and arm exception handler to make nginx work
v2: Address the comments from felipe
  - fix the compilation warnings
  - change the better memory barriar for virtio communication
  - fix a bug in virtio-9p
  - make it compilable for individual patch
v1: 
https://lists.xenproject.org/archives/html/minios-devel/2020-03/msg00056.html


Jia He (32):
  plat/virtio: Introduce several helpers for virtio ring
  plat/platform: Introduce new platform bus
  plat/virtio: Support virtio_cread/cwrite on arm64
  plat/virtio: Add new virtio_mmio device/driver on arm64
  build: Enable the platform bus and virtio_mmio device on arm64
  plat/kvm: arm64: Fix arm64 memory layout for pcie ecam
  plat/ofw: Export fdt_find_irq_parent_offset
  plat/pci_ecam: Introduce pci/pci_ecam.h
  plat/pci_ecam: Introduce pci ecam skeleton
  lib/ukbus: Adjust default bus register priority
  plat/ofw: Add fdt_node_offset_idx_by_compatible_list
  plat/platform_bus: Add probe/match interface for platform devices
  plat/virtio_mmio: Implement platform probe for virtio_mmio
  plat/ofw: Support completed ranges mapping
  lib/fdt: Fix fdt_address_cell and fdt_size_cell
  plat/ofw: Add fdt_prop_read_bool
  plat/pci_bus: Split specific code into arch directory
  plat/pci_bus: arm64: Implement add/probe interfaces on arm64
  build: Make KVM_PCI default enable on arm64
  plat/pci_bus: Change pci_device.base from u16 to unsigned long
  build: Enable pci library on arm64
  plat/pci_ecam: Fix a lot compilation warnings in pci_ecam
  plat/virtio: Fix virtio net device mac negotiation
  plat/virtio: Change irq,base from u16 to u64 on arm64
  plat/virtio: Use better iormb/iowmb on arm64
  plat/platform_bus,virtio_mmio: Avoid useless log storm
  plat/kvm/arm: Add a memory hole at the beginning 128M
  plat/arm: Make sure fpsimd sysregs writing take effects
  plat/virtio_9p: Remove excessive check for max virtqueue size
  plat/virtio_mmio: Fix virtqueue size for virtio 9p device
  plat/arm/generic_timer: Fix assert in ns_to_ticks
  plat/kvm/arm: Fix x19 corruption by interrupt handler

 lib/fdt/exportsyms.uk                       |   1 +
 lib/fdt/fdt_addresses.c                     |  57 +-
 lib/ukbus/include/uk/bus.h                  |  16 +-
 plat/common/arm/generic_timer.c             |   4 +-
 plat/common/arm/pci_bus_arm64.c             | 200 +++++++
 plat/common/include/arm/arm64/cpu.h         |   6 +
 plat/common/include/arm/arm64/cpu_defs.h    |   3 +
 plat/common/include/pci/pci_bus.h           | 105 +++-
 plat/common/include/pci/pci_ecam.h          | 101 ++++
 plat/common/include/platform_bus.h          | 116 +++++
 plat/common/pci_bus.c                       | 167 +-----
 plat/common/pci_ecam.c                      | 524 +++++++++++++++++++
 plat/common/platform_bus.c                  | 236 +++++++++
 plat/common/x86/pci_bus_x86.c               | 174 +++++++
 plat/drivers/include/ofw/fdt.h              |  74 +++
 plat/drivers/include/virtio/virtio_config.h |  73 ++-
 plat/drivers/include/virtio/virtio_mmio.h   | 137 +++++
 plat/drivers/include/virtio/virtqueue.h     |  33 ++
 plat/drivers/ofw/fdt.c                      |  81 ++-
 plat/drivers/virtio/virtio_9p.c             |   6 +-
 plat/drivers/virtio/virtio_mmio.c           | 550 ++++++++++++++++++++
 plat/drivers/virtio/virtio_net.c            |  15 +-
 plat/drivers/virtio/virtio_pci.c            |   6 +-
 plat/drivers/virtio/virtio_ring.c           |  32 ++
 plat/kvm/Config.uk                          |  14 +-
 plat/kvm/Makefile.uk                        |  29 +-
 plat/kvm/arm/exceptions.S                   |  11 +-
 plat/kvm/arm/pagetable64.S                  |  64 ++-
 plat/kvm/include/kvm-arm/arm64/mm.h         |   7 +-
 29 files changed, 2589 insertions(+), 253 deletions(-)
 create mode 100644 plat/common/arm/pci_bus_arm64.c
 create mode 100644 plat/common/include/pci/pci_ecam.h
 create mode 100644 plat/common/include/platform_bus.h
 create mode 100644 plat/common/pci_ecam.c
 create mode 100644 plat/common/platform_bus.c
 create mode 100644 plat/common/x86/pci_bus_x86.c
 create mode 100644 plat/drivers/include/virtio/virtio_mmio.h
 create mode 100644 plat/drivers/virtio/virtio_mmio.c

-- 
2.17.1




 


Rackspace

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