[PATCH v3] migration: Support QLIST migration

2019-10-15 Thread Eric Auger
Support QLIST migration using the same principle as QTAILQ: 94869d5c52 ("migration: migrate QTAILQ"). The VMSTATE_QLIST_V macro has the same proto as VMSTATE_QTAILQ_V. The change mainly resides in QLIST_RAW_INSERT_TAIL implementation. Tests also are provided. Signed-off-by: Eric Auger

[PATCH v4] migration: Support QLIST migration

2019-10-18 Thread Eric Auger
Signed-off-by: Eric Auger --- v3 -> v4: - replace QLIST_RAW_INSERT_TAIL by QLIST_RAW_INSERT_HEAD and QLIST_RAW_REVERSE as suggested by Juan --- include/migration/vmstate.h | 21 ++ include/qemu/queue.h| 40 +++ migration/trace-events | 5 ++ migration/vmstate-ty

[PATCH v5] migration: Support QLIST migration

2019-10-23 Thread Eric Auger
Signed-off-by: Eric Auger Reviewed-by: Juan Quintela --- v4 -> v5: - fix indent issue and previous assignment (Peter) - add Juan's R-b v3 -> v4: - replace QLIST_RAW_INSERT_TAIL by QLIST_RAW_INSERT_HEAD and QLIST_RAW_REVERSE as suggested by Juan v2 -> v3: - remove 2 spurious ch

[PATCH v16 00/10] VIRTIO-IOMMU device

2020-02-14 Thread Eric Auger
ve g_tree_destroy(domain->mappings) in virtio_iommu_detach v13 -> v14: - added "virtio-iommu-pci: Introduce the x-dt-binding option" - Removed the mappings gtree ref counting and simply delete the gtree when the last EP is detached from the domain Eric Auger (10): virtio-io

[PATCH v16 02/10] virtio-iommu: Decode the command payload

2020-02-14 Thread Eric Auger
This patch adds the command payload decoding and introduces the functions that will do the actual command handling. Those functions are not yet implemented. Signed-off-by: Eric Auger Reviewed-by: Jean-Philippe Brucker Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- v11 ->

[PATCH v16 05/10] virtio-iommu: Implement translate

2020-02-14 Thread Eric Auger
This patch implements the translate callback Signed-off-by: Eric Auger Reviewed-by: Jean-Philippe Brucker Reviewed-by: Michael S. Tsirkin --- v11 -> v12: - Added Jean's R-b - s/qemu_log_mask/error_report_once v10 -> v11: - take into account the new value str

[PATCH v16 06/10] virtio-iommu: Implement fault reporting

2020-02-14 Thread Eric Auger
The event queue allows to report asynchronous errors. The translate function now injects faults when relevant. Signed-off-by: Eric Auger Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- v13 -> v14: - remove loop - add Peter's R-b v12 -> v13: - return on virtio_error()

[PATCH v16 03/10] virtio-iommu: Implement attach/detach command

2020-02-14 Thread Eric Auger
will need to retrieve the IOMMUdevice and its IOMMU memory region from the bus number and devfn, once the bus number is garanteed to be frozen, use an array of IOMMUPciBus, lazily populated. Signed-off-by: Eric Auger Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- v14 ->

[PATCH v16 01/10] virtio-iommu: Add skeleton

2020-02-14 Thread Eric Auger
This patchs adds the skeleton for the virtio-iommu device. Signed-off-by: Eric Auger Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- v13 -> v14: - use device_class_set_props - updated copyright's year v12 -> v13 - removed IOMMU_PCI_BUS_MAX and IOMMU_PCI_DEVFN_MAX

[PATCH v16 04/10] virtio-iommu: Implement map/unmap

2020-02-14 Thread Eric Auger
This patch implements virtio_iommu_map/unmap. Signed-off-by: Eric Auger Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin --- v11 -> v12: - check unmanaged managed flags on map - removed 2 qemu_log_mask in unmap() - fix leak v10 -> v11: - revisit the implementation of unmap accord

[PATCH v16 07/10] virtio-iommu: Support migration

2020-02-14 Thread Eric Auger
Add Migration support. We rely on recently added gtree and qlist migration. We only migrate the domain gtree. The endpoint gtree is re-constructed in a post-load operation. Signed-off-by: Eric Auger Acked-by: Peter Xu Reviewed-by: Juan Quintela Reviewed-by: Michael S. Tsirkin --- v15 ->

[PATCH v16 08/10] virtio-iommu-pci: Add virtio iommu pci support

2020-02-14 Thread Eric Auger
kernel documentation: Documentation/devicetree/bindings/virtio/iommu.txt Signed-off-by: Eric Auger Reviewed-by: Jean-Philippe Brucker Reviewed-by: Michael S. Tsirkin --- v15 -> v16: - made the device not hotpluggable v14 -> v15: - checker whether the machine implements a hotplug handler

[PATCH v16 10/10] MAINTAINERS: add virtio-iommu related files

2020-02-14 Thread Eric Auger
Add a new "virtio-iommu" section with the new files related to this device. Signed-off-by: Eric Auger --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c7717df720..b7a7a18737 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1623,

[PATCH v16 09/10] hw/arm/virt: Add the virtio-iommu device tree mappings

2020-02-14 Thread Eric Auger
pported by the kernel we must make sure we are in DT mode. This limitation will be removed as soon as the topology description feature gets supported. Signed-off-by: Eric Auger --- v15 -> v16: - rename create_virtio_iommu into create_virtio_iommu_dt_bindings v14 -> v15: - only support the

[RFC v2 1/6] tpm: rename TPM_TIS into TPM_TIS_ISA

2020-02-14 Thread Eric Auger
As we plan to introduce a sysbus TPM_TIS, let's rename TPM_TIS into TPM_TIS_ISA. Signed-off-by: Eric Auger --- hw/i386/acpi-build.c | 6 +++--- hw/tpm/tpm_tis.c | 4 ++-- include/sysemu/tpm.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-buil

[RFC v2 0/6] vTPM for aarch64

2020-02-14 Thread Eric Auger
art. - both ARM and x86 integration were tested. - acknowledgement: migration has not been tested Eric Auger (6): tpm: rename TPM_TIS into TPM_TIS_ISA tpm: Use TPMState as a common struct tpm: Separate tpm_tis common functions from isa code tpm: Separate TPM_TIS and TPM_TIS_ISA configs tpm:

[RFC v2 5/6] tpm: Add the SysBus TPM TIS device

2020-02-14 Thread Eric Auger
Introduce the tpm-tis-device which is a sysbus device and is bound to be used on ARM. Signed-off-by: Eric Auger --- hw/tpm/Kconfig | 5 ++ hw/tpm/Makefile.objs| 1 + hw/tpm/tpm_tis_sysbus.c | 159 include/sysemu/tpm.h| 1 + 4 files

[RFC v2 2/6] tpm: Use TPMState as a common struct

2020-02-14 Thread Eric Auger
ed to take TPMState handle. A bunch of structs also are renamed to be specialized for the ISA device. Besides those transformations, no functional change is expected. Signed-off-by: Eric Auger --- hw/tpm/tpm_tis.c | 146 +-- 1 file changed, 91 inser

[RFC v2 3/6] tpm: Separate tpm_tis common functions from isa code

2020-02-14 Thread Eric Auger
Move the device agnostic code into tpm_tis_common.c and put the ISA device specific code into tpm_tis_isa.c Signed-off-by: Eric Auger --- hw/tpm/Makefile.objs | 2 +- hw/tpm/tpm_tis.h | 91 +++ hw/tpm/{tpm_tis.c => tpm_tis_common.c} |

[RFC v2 6/6] hw/arm/virt: vTPM support

2020-02-14 Thread Eric Auger
,id=chrtpm,path=swtpm-sock \ -tpmdev emulator,id=tpm0,chardev=chrtpm \ -device tpm-tis-device,tpmdev=tpm0 \ swtpm/libtpms command line example: swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \ --ctrl type=unixio,path=swtpm-sock Signed-off-by: Eric Auger --- hw/arm/Kconfig

[RFC v2 4/6] tpm: Separate TPM_TIS and TPM_TIS_ISA configs

2020-02-14 Thread Eric Auger
Let's separate the compilation of tpm_tis_common.c from the compilation of tpm_tis_isa.c The common part will be also compiled along with the tpm_tis_sysbus device. Signed-off-by: Eric Auger --- default-configs/i386-softmmu.mak | 2 +- hw/i386/Kconfig | 2 +- hw/tpm/Kc

[kvm-unit-tests RFC 03/10] pmu: Add a pmu struct

2019-12-06 Thread Eric Auger
This struct aims at storing information potentially used by all tests such as the pmu version, the read-only part of the PMCR, the number of implemented event counters, ... Signed-off-by: Eric Auger --- arm/pmu.c | 29 - 1 file changed, 24 insertions(+), 5 deletions

[kvm-unit-tests RFC 00/10] KVM: arm64: PMUv3 Event Counter Tests

2019-12-06 Thread Eric Auger
d yet. Andre Przywara (1): arm: gic: Provide per-IRQ helper functions Andrew Jones (1): arm64: Provide read/write_sysreg_s Eric Auger (8): pmu: Let pmu tests take a sub-test parameter pmu: Add a pmu struct pmu: Check Required Event Support pmu: Basic event counter Tests pmu: Test

[kvm-unit-tests RFC 05/10] pmu: Basic event counter Tests

2019-12-06 Thread Eric Auger
overflow bit is set after the execution of the asm loop. - mem-access: counts MEM_ACCESS event on counters #0 and #1 with and without 32-bit overflow. Signed-off-by: Eric Auger --- arm/pmu.c | 254 ++ arm/unittests.cfg | 18 2 files

[kvm-unit-tests RFC 06/10] pmu: Test chained counter

2019-12-06 Thread Eric Auger
Add 2 tests exercising chained counters. The first one uses CPU_CYCLES and the second one uses SW_INCR. Signed-off-by: Eric Auger --- arm/pmu.c | 125 ++ arm/unittests.cfg | 12 + 2 files changed, 137 insertions(+) diff --git a/arm/pmu.c

[kvm-unit-tests RFC 01/10] arm64: Provide read/write_sysreg_s

2019-12-06 Thread Eric Auger
From: Andrew Jones Sometimes we need to test access to system registers which are missing assembler mnemonics. Signed-off-by: Andrew Jones --- lib/arm64/asm/sysreg.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h index a03830b..

[kvm-unit-tests RFC 02/10] pmu: Let pmu tests take a sub-test parameter

2019-12-06 Thread Eric Auger
As we intend to introduce more PMU tests, let's add a sub-test parameter that will allow to categorize them. Existing tests are in the cycle-counter category. Signed-off-by: Eric Auger --- arm/pmu.c | 22 ++ arm/unittests.cfg | 7 --- 2 files change

[kvm-unit-tests RFC 04/10] pmu: Check Required Event Support

2019-12-06 Thread Eric Auger
unconditionally required. This test currently fails on TCG as neither INST_RETIRED or INST_SPEC are supported. Signed-off-by: Eric Auger --- arm/pmu.c | 70 +++ arm/unittests.cfg | 6 2 files changed, 76 insertions(+) diff --git a/arm/pmu.c

[kvm-unit-tests RFC 07/10] arm: pmu: test 32-bit <-> 64-bit transitions

2019-12-06 Thread Eric Auger
--- arm/pmu.c | 125 +- arm/unittests.cfg | 6 +++ 2 files changed, 130 insertions(+), 1 deletion(-) diff --git a/arm/pmu.c b/arm/pmu.c index e185809..47d46a2 100644 --- a/arm/pmu.c +++ b/arm/pmu.c @@ -116,6 +116,7 @@ static void test_basic_ev

[kvm-unit-tests RFC 08/10] arm: gic: Provide per-IRQ helper functions

2019-12-06 Thread Eric Auger
From: Andre Przywara A common theme when accessing per-IRQ parameters in the GIC distributor is to set fields of a certain bit width in a range of MMIO registers. Examples are the enabled status (one bit per IRQ), the level/edge configuration (2 bits per IRQ) or the priority (8 bits per IRQ). Ad

[kvm-unit-tests RFC 09/10] arm/arm64: gic: Introduce setup_irq() helper

2019-12-06 Thread Eric Auger
ipi_enable() code would be reusable for other interrupts than IPI. Let's rename it setup_irq() and pass an interrupt handler pointer. We also export it to use it in other tests such as the PMU's one. Signed-off-by: Eric Auger --- arm/gic.c | 24 +++- l

[kvm-unit-tests RFC 10/10] pmu: Test overflow interrupts

2019-12-06 Thread Eric Auger
Test overflows for MEM_ACESS and SW_INCR events. Also tests overflows with 64-bit events. Signed-off-by: Eric Auger --- arm/pmu.c | 133 +- arm/unittests.cfg | 6 +++ 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/arm/pmu.c

[kvm-unit-tests PATCH 04/16] arm/arm64: gicv3: Add some re-distributor defines

2019-12-16 Thread Eric Auger
PROPBASER, PENDBASE and GICR_CTRL will be used for LPI management. Signed-off-by: Eric Auger --- lib/arm/asm/gic-v3.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lib/arm/asm/gic-v3.h b/lib/arm/asm/gic-v3.h index 4a445a5..d02f4a4 100644 --- a/lib/arm/asm/gic-v3.h +++ b/lib/arm/asm

[kvm-unit-tests PATCH 01/16] libcflat: Add other size defines

2019-12-16 Thread Eric Auger
Introduce additional SZ_256, SZ_8K, SZ_16K macros that will be used by ITS tests. Signed-off-by: Eric Auger --- lib/libcflat.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index ea19f61..7092af2 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -36,7

[kvm-unit-tests PATCH 03/16] arm/arm64: gic: Introduce setup_irq() helper

2019-12-16 Thread Eric Auger
ipi_enable() code would be reusable for other interrupts than IPI. Let's rename it setup_irq() and pass an interrupt handler pointer. We also export it to use it in other tests such as the PMU's one. Signed-off-by: Eric Auger --- arm/gic.c | 24 +++- l

[kvm-unit-tests PATCH 09/16] arm/arm64: ITS: Enable/Disable LPIs at re-distributor level

2019-12-16 Thread Eric Auger
This helper function enables or disables the signaling of LPIs at redistributor level. Signed-off-by: Eric Auger --- lib/arm/asm/gic-v3-its.h | 1 + lib/arm/gic-v3-its.c | 18 ++ 2 files changed, 19 insertions(+) diff --git a/lib/arm/asm/gic-v3-its.h b/lib/arm/asm/gic-v3

[kvm-unit-tests PATCH 05/16] arm/arm64: ITS: Introspection tests

2019-12-16 Thread Eric Auger
Detect the presence of an ITS as part of the GICv3 init routine, initialize its base address and read few registers the IIDR, the TYPER to store its dimensioning parameters. This is our first ITS test, belonging to a new "its" group. Signed-off-by: Eric Auger --- arm/Makef

[kvm-unit-tests PATCH 00/16] arm/arm64: Add ITS tests

2019-12-16 Thread Eric Auger
I think it is beyond the scope of that series) For other ITS tests: ./run_tests.sh -g its non migration tests can be launched invidually. For instance: ./arm-run arm/gic.flat -smp 8 -append 'its-trigger' Andre Przywara (1): arm: gic: Provide per-IRQ helper functions Eric Auger (1

[kvm-unit-tests PATCH 16/16] arm/arm64: ITS: pending table migration test

2019-12-16 Thread Eric Auger
Add two new migration tests. One testing the migration of a topology where collection were unmapped. The second test checks the migration of the pending table. Signed-off-by: Eric Auger --- arm/gic.c | 148 ++ arm/unittests.cfg | 16 - 2

[kvm-unit-tests PATCH 06/16] arm/arm64: ITS: Test BASER

2019-12-16 Thread Eric Auger
Add helper routines to parse and set up BASER registers. Add a new test dedicated to BASER accesses. Signed-off-by: Eric Auger --- arm/gic.c| 20 ++ arm/unittests.cfg| 6 +++ lib/arm/asm/gic-v3-its.h | 17 lib/arm/gic-v3-its.c | 84

[kvm-unit-tests PATCH 10/16] arm/arm64: ITS: its_enable_defaults

2019-12-16 Thread Eric Auger
its_enable_defaults() is the top init function that allocates all the requested tables (device, collection, lpi config and pending tables), enable LPIs at distributor level and ITS level. gicv3_enable_defaults must be called before. Signed-off-by: Eric Auger --- lib/arm/asm/gic-v3-its.h | 1

[kvm-unit-tests PATCH 07/16] arm/arm64: ITS: Set the LPI config and pending tables

2019-12-16 Thread Eric Auger
Allocate the LPI configuration and per re-distributor pending table. Set redistributor's PROPBASER and PENDBASER. The LPIs are enabled by default in the config table. Also introduce a helper routine that allows to set the pending table bit for a given LPI. Signed-off-by: Eric Auger --- li

[kvm-unit-tests PATCH 08/16] arm/arm64: ITS: Init the command queue

2019-12-16 Thread Eric Auger
Allocate the command queue and initialize related registers: CBASER, CREADR, CWRITER. The command queue is 64kB. This aims at not bothing with fullness. Signed-off-by: Eric Auger --- lib/arm/asm/gic-v3-its.h | 7 +++ lib/arm/gic-v3-its.c | 37 + 2

[kvm-unit-tests PATCH 11/16] arm/arm64: ITS: Device and collection Initialization

2019-12-16 Thread Eric Auger
). Signed-off-by: Eric Auger --- --- lib/arm/asm/gic-v3-its.h | 20 + lib/arm/gic-v3-its.c | 46 2 files changed, 66 insertions(+) diff --git a/lib/arm/asm/gic-v3-its.h b/lib/arm/asm/gic-v3-its.h index ab639c5..245ef61 100644 --- a/lib

[kvm-unit-tests PATCH 13/16] arm/arm64: ITS: INT functional tests

2019-12-16 Thread Eric Auger
Triggers LPIs through the INT command. the test checks the LPI hits the right CPU and triggers the right LPI intid, ie. the translation is correct. Updates to the config table also are tested, along with inv and invall commands. Signed-off-by: Eric Auger --- arm/gic.c| 174

[kvm-unit-tests PATCH 12/16] arm/arm64: ITS: commands

2019-12-16 Thread Eric Auger
Implement main ITS commands. The code is largely inherited from the ITS driver. Signed-off-by: Eric Auger --- arm/Makefile.common | 2 +- lib/arm/asm/gic-v3-its.h | 36 +++ lib/arm/gic-v3-its-cmd.c | 462 +++ 3 files changed, 499 insertions(+), 1

[kvm-unit-tests PATCH 02/16] arm: gic: Provide per-IRQ helper functions

2019-12-16 Thread Eric Auger
From: Andre Przywara A common theme when accessing per-IRQ parameters in the GIC distributor is to set fields of a certain bit width in a range of MMIO registers. Examples are the enabled status (one bit per IRQ), the level/edge configuration (2 bits per IRQ) or the priority (8 bits per IRQ). Ad

[kvm-unit-tests PATCH 14/16] arm/run: Allow Migration tests

2019-12-16 Thread Eric Auger
ar implement is minimalist as it just reads the data register. It is just meant to read the single character emitted at the end of the migration by the runner script. It is not meant to read more data (FIFOs are not enabled). Signed-off-by: Eric Auger --- arm/Makefile.common | 2 +- arm/run

[kvm-unit-tests PATCH 15/16] arm/arm64: ITS: migration tests

2019-12-16 Thread Eric Auger
This test maps LPIs (populates the device table, the collection table, interrupt translation tables, configuration table), migrates and make sure the translation is correct on the destination. Signed-off-by: Eric Auger --- arm/gic.c| 55

[kvm-unit-tests PATCH 00/10] KVM: arm64: PMUv3 Event Counter Tests

2019-12-16 Thread Eric Auger
per functions Andrew Jones (1): arm64: Provide read/write_sysreg_s Eric Auger (8): arm: pmu: Let pmu tests take a sub-test parameter arm: pmu: Add a pmu struct arm: pmu: Check Required Event Support arm: pmu: Basic event counter Tests arm: pmu: Test chained counter arm: pmu: test 32-

[kvm-unit-tests PATCH 01/10] arm64: Provide read/write_sysreg_s

2019-12-16 Thread Eric Auger
From: Andrew Jones Sometimes we need to test access to system registers which are missing assembler mnemonics. Signed-off-by: Andrew Jones Reviewed-by: Alexandru Elisei --- lib/arm64/asm/sysreg.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lib/arm64/asm/sysreg.h b/lib/arm

[kvm-unit-tests PATCH 04/10] arm: pmu: Check Required Event Support

2019-12-16 Thread Eric Auger
unconditionally required. This test currently fails on TCG as neither INST_RETIRED or INST_SPEC are supported. Signed-off-by: Eric Auger --- v1 ->v2: - add a comment to explain the PMCEID0/1 splits --- arm/pmu.c | 71 +++ arm/unittests.cfg |

[kvm-unit-tests PATCH 10/10] arm: pmu: Test overflow interrupts

2019-12-16 Thread Eric Auger
Test overflows for MEM_ACCESS and SW_INCR events. Also tests overflows with 64-bit events. Signed-off-by: Eric Auger --- arm/pmu.c | 134 ++ arm/unittests.cfg | 6 +++ 2 files changed, 140 insertions(+) diff --git a/arm/pmu.c b/arm/pmu.c

[kvm-unit-tests PATCH 09/10] arm/arm64: gic: Introduce setup_irq() helper

2019-12-16 Thread Eric Auger
ipi_enable() code would be reusable for other interrupts than IPI. Let's rename it setup_irq() and pass an interrupt handler pointer. We also export it to use it in other tests such as the PMU's one. Signed-off-by: Eric Auger --- arm/gic.c | 24 +++- l

[kvm-unit-tests PATCH 06/10] arm: pmu: Test chained counter

2019-12-16 Thread Eric Auger
Add 2 tests exercising chained counters. The first one uses CPU_CYCLES and the second one uses SW_INCR. Signed-off-by: Eric Auger --- arm/pmu.c | 128 ++ arm/unittests.cfg | 12 + 2 files changed, 140 insertions(+) diff --git a/arm/pmu.c

[kvm-unit-tests PATCH 02/10] arm: pmu: Let pmu tests take a sub-test parameter

2019-12-16 Thread Eric Auger
As we intend to introduce more PMU tests, let's add a sub-test parameter that will allow to categorize them. Existing tests are in the cycle-counter category. Signed-off-by: Eric Auger --- arm/pmu.c | 24 +++- arm/unittests.cfg | 7 --- 2 files change

[kvm-unit-tests PATCH 07/10] arm: pmu: test 32-bit <-> 64-bit transitions

2019-12-16 Thread Eric Auger
Test configurations where we transit from 32b to 64b counters and conversely. Also tests configuration where chain counters are configured but only one counter is enabled. Signed-off-by: Eric Auger --- arm/pmu.c | 135 ++ arm/unittests.cfg

[kvm-unit-tests PATCH 03/10] arm: pmu: Add a pmu struct

2019-12-16 Thread Eric Auger
This struct aims at storing information potentially used by all tests such as the pmu version, the read-only part of the PMCR, the number of implemented event counters, ... Signed-off-by: Eric Auger --- arm/pmu.c | 30 +- 1 file changed, 25 insertions(+), 5 deletions

[kvm-unit-tests PATCH 08/10] arm: gic: Provide per-IRQ helper functions

2019-12-16 Thread Eric Auger
From: Andre Przywara A common theme when accessing per-IRQ parameters in the GIC distributor is to set fields of a certain bit width in a range of MMIO registers. Examples are the enabled status (one bit per IRQ), the level/edge configuration (2 bits per IRQ) or the priority (8 bits per IRQ). Ad

[kvm-unit-tests PATCH 05/10] arm: pmu: Basic event counter Tests

2019-12-16 Thread Eric Auger
overflow bit is set after the execution of the asm loop. - mem-access: counts MEM_ACCESS event on counters #0 and #1 with and without 32-bit overflow. Signed-off-by: Eric Auger --- arm/pmu.c | 261 ++ arm/unittests.cfg | 18 2 files

[PATCH v6] migration: Support QLIST migration

2019-11-22 Thread Eric Auger
Signed-off-by: Eric Auger --- v5 - v6: - by doing more advanced testing with virtio-iommu migration I noticed this was broken. "prev" field was not set properly. I improved the tests to manipulate both the next and prev fields. - Removed Peter and Juan's R-b --- include/

[PATCH for-5.0 v11 01/20] migration: Support QLIST migration

2019-11-22 Thread Eric Auger
Signed-off-by: Eric Auger --- v5 - v6: - by doing more advanced testing with virtio-iommu migration I noticed this was broken. "prev" field was not set properly. I improved the tests to manipulate both the next and prev fields. - Removed Peter and Juan's R-b --- include/

[PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device

2019-11-22 Thread Eric Auger
reas it is already attached to another address space, first detach it - fix some error values - page_sizes = TARGET_PAGE_MASK; - I haven't changed the unmap() semantics yet, waiting for the next virtio-iommu spec revision. v1 -> v2: - fix redefinition of viommu_as typedef Eric Auger (

[PATCH for-5.0 v11 03/20] virtio-iommu: Decode the command payload

2019-11-22 Thread Eric Auger
This patch adds the command payload decoding and introduces the functions that will do the actual command handling. Those functions are not yet implemented. Signed-off-by: Eric Auger --- v10 -> v11: - use a macro for handle command functions v9 -> v10: - make virtio_iommu_handle_

[PATCH for-5.0 v11 04/20] virtio-iommu: Add the iommu regions

2019-11-22 Thread Eric Auger
This patch initializes the iommu memory regions so that PCIe end point transactions get translated. The translation function is not yet implemented though. Signed-off-by: Eric Auger --- v10 -> v11: - use g_hash_table_new_full for allocating as_by_busptr v9 -> v10: - remove pc/virt m

[PATCH for-5.0 v11 06/20] virtio-iommu: Implement attach/detach command

2019-11-22 Thread Eric Auger
This patch implements the endpoint attach/detach to/from a domain. Signed-off-by: Eric Auger --- --- hw/virtio/virtio-iommu.c | 43 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index

[PATCH for-5.0 v11 05/20] virtio-iommu: Endpoint and domains structs and helpers

2019-11-22 Thread Eric Auger
This patch introduce domain and endpoint internal datatypes. Both are stored in RB trees. The domain owns a list of endpoints attached to it. Helpers to get/put end points and domains are introduced. get() helpers will become static in subsequent patches. Signed-off-by: Eric Auger --- v10

[PATCH for-5.0 v11 07/20] virtio-iommu: Implement map/unmap

2019-11-22 Thread Eric Auger
This patch implements virtio_iommu_map/unmap. Signed-off-by: Eric Auger --- v10 -> v11: - revisit the implementation of unmap according to Peter's suggestion - removed virt_addr and size from viommu_mapping struct - use g_tree_lookup_extended() - return VIRTIO_IOMMU_S_RANGE in case a

[PATCH for-5.0 v11 16/20] hw/arm/virt-acpi-build: Introduce fill_iort_idmap helper

2019-11-22 Thread Eric Auger
To avoid code duplication, let's introduce an helper that fills one IORT ID mappings array index. Signed-off-by: Eric Auger --- v8: new --- hw/arm/virt-acpi-build.c | 43 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/hw/arm/virt

[PATCH for-5.0 v11 08/20] virtio-iommu: Implement translate

2019-11-22 Thread Eric Auger
This patch implements the translate callback Signed-off-by: Eric Auger --- v10 -> v11: - take into account the new value struct and use g_tree_lookup_extended - switched to error_report_once v6 -> v7: - implemented bypass-mode v5 -> v6: - replace error_report by qemu_log_mask

[PATCH for-5.0 v11 11/20] hw/arm/virt: Add the virtio-iommu device tree mappings

2019-11-22 Thread Eric Auger
Adds the "virtio,pci-iommu" node in the host bridge node and the RID mapping, excluding the IOMMU RID. Signed-off-by: Eric Auger --- v10 -> v11: - remove msi_bypass v8 -> v9: - disable msi-bypass property - addition of the subnode is handled is the hotplug handler

[PATCH for-5.0 v11 12/20] qapi: Introduce DEFINE_PROP_INTERVAL

2019-11-22 Thread Eric Auger
: Eric Auger --- hw/core/qdev-properties.c| 90 include/exec/memory.h| 6 +++ include/hw/qdev-properties.h | 3 ++ include/qemu/typedefs.h | 1 + 4 files changed, 100 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev

[PATCH for-5.0 v11 02/20] virtio-iommu: Add skeleton

2019-11-22 Thread Eric Auger
This patchs adds the skeleton for the virtio-iommu device. Signed-off-by: Eric Auger --- v9 -> v10: - mutex initialized here - initialize tail - included hw/qdev-properties.h - removed g_memdup - removed s->config.domain_range.start = 0; v9 -> v10: - expose VIRTIO_IOMMU_F_MMIO fe

[PATCH for-5.0 v11 20/20] tests: Add virtio-iommu test

2019-11-22 Thread Eric Auger
This adds the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API. To run the tests: make tests/qos-test QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 tests/qos-test V=1 Signed-off-by: Eric Auger --- tests/Makefile.include | 2

[PATCH for-5.0 v11 13/20] virtio-iommu: Implement probe request

2019-11-22 Thread Eric Auger
This patch implements the PROBE request. At the moment, no reserved regions are returned as none are registered per device. Only a NONE property is returned. Signed-off-by: Eric Auger --- v9 -> v10 - fully rewrite the code in preparation of reserved_regions array property introduction

[PATCH for-5.0 v11 09/20] virtio-iommu: Implement fault reporting

2019-11-22 Thread Eric Auger
The event queue allows to report asynchronous errors. The translate function now injects faults when relevant. Signed-off-by: Eric Auger --- v10 -> v11: - change a virtio_error into an error_report_once (no buffer available for output faults) --- hw/virtio/trace-events | 1 + hw/vir

[PATCH for-5.0 v11 14/20] virtio-iommu: Handle reserved regions in the translation process

2019-11-22 Thread Eric Auger
an MSI region: we bypass the translation. Signed-off-by: Eric Auger --- v10 -> v11: - directly use the reserved_regions properties array v9 -> v10: - in case of MSI region, we immediatly return --- hw/virtio/virtio-iommu.c | 17 + 1 file changed, 17 insertions(+) diff -

[PATCH for-5.0 v11 10/20] virtio-iommu-pci: Add virtio iommu pci support

2019-11-22 Thread Eric Auger
This patch adds virtio-iommu-pci, which is the pci proxy for the virtio-iommu device. Signed-off-by: Eric Auger --- v10 -> v11: - add the reserved_regions array property v9 -> v10: - include "hw/qdev-properties.h" header v8 -> v9: - add the msi-bypass property - create

[PATCH for-5.0 v11 18/20] virtio-iommu: Support migration

2019-11-22 Thread Eric Auger
it re-allocates all the nodes while reconstructing the trees/lists. So in post_load we re-construct the relationship between endpoints and domains. Signed-off-by: Eric Auger --- hw/virtio/virtio-iommu.c | 127 --- 1 file changed, 117 insertions(+), 10 del

[PATCH for-5.0 v11 15/20] virtio-iommu-pci: Add array of Interval properties

2019-11-22 Thread Eric Auger
The machine may need to pass reserved regions to the virtio-iommu-pci device (such as the MSI window on x86). So let's add an array of Interval properties. Signed-off-by: Eric Auger --- hw/virtio/virtio-iommu-pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/virtio/virtio-

[PATCH for-5.0 v11 17/20] hw/arm/virt-acpi-build: Add virtio-iommu node in IORT table

2019-11-22 Thread Eric Auger
-iommu specification. Signed-off-by: Eric Auger --- v8 -> v9: - iommu RID is not fixed anymore v7 -> v8: - exclude the iommu RID (0x8) in the root complex ID mapping --- hw/arm/virt-acpi-build.c| 50 ++--- include/hw/acpi/acpi-defs.h | 21 +

[PATCH for-5.0 v11 19/20] pc: Add support for virtio-iommu-pci

2019-11-22 Thread Eric Auger
. We also declare the [0xfee0 - 0xfeef] MSI reserved region so that it gets bypassed by the IOMMU. Signed-off-by: Eric Auger --- hw/i386/acpi-build.c | 72 hw/i386/pc.c | 15 - include/hw/i386/pc.h | 2 ++ 3 files changed, 88

[Qemu-devel] [PATCH for-4.2 v10 00/15] VIRTIO-IOMMU device

2019-07-30 Thread Eric Auger
e next virtio-iommu spec revision. v1 -> v2: - fix redifinition of viommu_as typedef Eric Auger (15): update-linux-headers: Import virtio_iommu.h linux-headers: update against 5.3-rc2 virtio-iommu: Add skeleton virtio-iommu: Decode the command payload virtio-iommu: Add the iommu regions

[Qemu-devel] [PATCH for-4.2 v10 01/15] update-linux-headers: Import virtio_iommu.h

2019-07-30 Thread Eric Auger
Update the script to update the virtio_iommu.h header. Signed-off-by: Eric Auger --- scripts/update-linux-headers.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index f76d77363b..7805291ca0 100755 --- a/scripts/update

[Qemu-devel] [PATCH for-4.2 v10 02/15] linux-headers: update against 5.3-rc2

2019-07-30 Thread Eric Auger
Sync headers against 5.3-rc2 (commit 2a11c76e5301) Signed-off-by: Eric Auger --- include/standard-headers/asm-x86/bootparam.h | 2 + include/standard-headers/asm-x86/kvm_para.h | 3 + include/standard-headers/linux/ethtool.h | 2 + include/standard-headers/linux/pci_regs.h

[Qemu-devel] [PATCH for-4.2 v10 05/15] virtio-iommu: Add the iommu regions

2019-07-30 Thread Eric Auger
This patch initializes the iommu memory regions so that PCIe end point transactions get translated. The translation function is not yet implemented though. Signed-off-by: Eric Auger --- v9 -> v10: - remove pc/virt machine headers - virtio_iommu_find_add_as: mr_index introduced in that pa

[Qemu-devel] [PATCH for-4.2 v10 10/15] virtio-iommu: Implement probe request

2019-07-30 Thread Eric Auger
This patch implements the PROBE request. At the moment, no reserved regions are returned as none are registered per device. Only a NONE property is returned. Signed-off-by: Eric Auger --- v8 -> v9: - fix filling of properties (changes induced by v0.7 -> v0.8 spec evolution) -

[Qemu-devel] [PATCH for-4.2 v10 07/15] virtio-iommu: Implement attach/detach command

2019-07-30 Thread Eric Auger
This patch implements the endpoint attach/detach to/from a domain. Signed-off-by: Eric Auger --- --- hw/virtio/virtio-iommu.c | 40 ++-- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index

[Qemu-devel] [PATCH for-4.2 v10 06/15] virtio-iommu: Endpoint and domains structs and helpers

2019-07-30 Thread Eric Auger
This patch introduce domain and endpoint internal datatypes. Both are stored in RB trees. The domain owns a list of endpoints attached to it. Helpers to get/put end points and domains are introduced. get() helpers will become static in subsequent patches. Signed-off-by: Eric Auger Reviewed-by

[Qemu-devel] [PATCH for-4.2 v10 03/15] virtio-iommu: Add skeleton

2019-07-30 Thread Eric Auger
This patchs adds the skeleton for the virtio-iommu device. Signed-off-by: Eric Auger --- v9 -> v10: - expose VIRTIO_IOMMU_F_MMIO feature - s/domain_bits/domain_range struct - change error codes - enforce unmigratable - Kconfig v7 -> v8: - expose VIRTIO_IOMMU_F_BYPASS and VIRTIO_F_VER

[Qemu-devel] [PATCH for-4.2 v10 13/15] virtio_iommu: Handle reserved regions in translation process

2019-07-30 Thread Eric Auger
an MSI region: we bypass the translation. Signed-off-by: Eric Auger --- v9 -> v10: - in case of MSI region, we immediatly return --- hw/virtio/virtio-iommu.c | 16 1 file changed, 16 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 8e54a17

[Qemu-devel] [PATCH for-4.2 v10 11/15] virtio-iommu: Expose the IOAPIC MSI reserved region when relevant

2019-07-30 Thread Eric Auger
-by: Eric Auger --- v8 -> v9: - pass IOAPIC_RANGE_END to virtio_iommu_register_resv_region - take into account the change in the struct virtio_iommu_probe_resv_mem definition - We just introduce the field here. A property will be introduced later on at pci proxy level. --- hw/virtio/vir

[Qemu-devel] [PATCH for-4.2 v10 08/15] virtio-iommu: Implement map/unmap

2019-07-30 Thread Eric Auger
This patch implements virtio_iommu_map/unmap. Signed-off-by: Eric Auger --- v5 -> v6: - use new v0.6 fields - replace error_report by qemu_log_mask v3 -> v4: - implement unmap semantics as specified in v0.4 --- hw/virtio/trace-events | 3 ++ hw/virtio/virtio-iommu.

[Qemu-devel] [PATCH for-4.2 v10 04/15] virtio-iommu: Decode the command payload

2019-07-30 Thread Eric Auger
This patch adds the command payload decoding and introduces the functions that will do the actual command handling. Those functions are not yet implemented. Signed-off-by: Eric Auger --- v9 -> v10: - make virtio_iommu_handle_* more compact and remove get_payload_size v7 -> v8: - hand

[Qemu-devel] [PATCH for-4.2 v10 12/15] virtio-iommu: Implement fault reporting

2019-07-30 Thread Eric Auger
The event queue allows to report asynchronous errors. The translate function now injects faults when relevant. Signed-off-by: Eric Auger --- hw/virtio/trace-events | 1 + hw/virtio/virtio-iommu.c | 67 ++-- 2 files changed, 65 insertions(+), 3 deletions

[Qemu-devel] [PATCH for-4.2 v10 15/15] hw/arm/virt: Add the virtio-iommu device tree mappings

2019-07-30 Thread Eric Auger
Adds the "virtio,pci-iommu" node in the host bridge node and the RID mapping, excluding the IOMMU RID. Signed-off-by: Eric Auger --- v8 -> v9: - disable msi-bypass property - addition of the subnode is handled is the hotplug handler and IOMMU RID is notimposed anymore v6 ->

[Qemu-devel] [PATCH for-4.2 v10 09/15] virtio-iommu: Implement translate

2019-07-30 Thread Eric Auger
This patch implements the translate callback Signed-off-by: Eric Auger --- v6 -> v7: - implemented bypass-mode v5 -> v6: - replace error_report by qemu_log_mask v4 -> v5: - check the device domain is not NULL - s/printf/error_report - set flags to IOMMU_NONE in case of all translati

[Qemu-devel] [PATCH for-4.2 v10 14/15] virtio-iommu-pci: Add virtio iommu pci support

2019-07-30 Thread Eric Auger
This patch adds virtio-iommu-pci, which is the pci proxy for the virtio-iommu device. Signed-off-by: Eric Auger --- v8 -> v9: - add the msi-bypass property - create virtio-iommu-pci.c --- hw/virtio/Makefile.objs | 1 + hw/virtio/virtio-iommu-pci.c |

[PATCH v14 01/11] virtio-iommu: Add skeleton

2020-02-07 Thread Eric Auger
This patchs adds the skeleton for the virtio-iommu device. Signed-off-by: Eric Auger Reviewed-by: Peter Xu --- v13 -> v14: - use device_class_set_props - updated copyright's year v12 -> v13 - removed IOMMU_PCI_BUS_MAX and IOMMU_PCI_DEVFN_MAX v11 -> v12: - remove s_by_

[PATCH v14 00/11] VIRTIO-IOMMU device

2020-02-07 Thread Eric Auger
MMU MemoryRegion - add mutex init - fix as->mappings deletion using g_tree_ref/unref - when a dev is attached whereas it is already attached to another address space, first detach it - fix some error values - page_sizes = TARGET_PAGE_MASK; - I haven't changed the unmap() semantics yet, wai

<    5   6   7   8   9   10   11   12   13   14   >