Re: [kvmtool PATCH 21/17] kvmtool: arm: Add support for creating VM with PA size

2018-04-30 Thread Suzuki K Poulose
On 30/04/18 15:17, Julien Grall wrote: Hi, On 27/03/18 14:15, Suzuki K Poulose wrote: diff --git a/arm/kvm.c b/arm/kvm.c index 5701d41..a9a9140 100644 --- a/arm/kvm.c +++ b/arm/kvm.c @@ -11,6 +11,8 @@   #include   #include +unsigned long kvm_arm_type; +   struct kvm_ext kvm_req_ext[] = {

Re: [kvmtool PATCH 21/17] kvmtool: arm: Add support for creating VM with PA size

2018-04-30 Thread Julien Grall
Hi, On 27/03/18 14:15, Suzuki K Poulose wrote: diff --git a/arm/kvm.c b/arm/kvm.c index 5701d41..a9a9140 100644 --- a/arm/kvm.c +++ b/arm/kvm.c @@ -11,6 +11,8 @@ #include #include +unsigned long kvm_arm_type; + struct kvm_ext kvm_req_ext[] = { {

[PATCH v6 12/12] KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to 512

2018-04-30 Thread Eric Auger
Let's raise the number of supported vcpus along with vgic v3 now that HW is looming with more physical CPUs. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- v4 -> v5: - addded Christoffer's A-b --- include/kvm/arm_vgic.h | 2 +- 1

[PATCH v6 11/12] KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Eric Auger
Now all the internals are ready to handle multiple redistributor regions, let's allow the userspace to register them. Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall --- v5 -> v6: - added Christoffer's R-b v4 -> v5: - s/uint_t/u - fix

[PATCH v6 10/12] KVM: arm/arm64: Add KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Eric Auger
This new attribute allows the userspace to set the base address of a reditributor region, relaxing the constraint of having all consecutive redistibutor frames contiguous. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- v3 -> v4: -

[PATCH v6 09/12] KVM: arm/arm64: Check all vcpu redistributors are set on map_resources

2018-04-30 Thread Eric Auger
On vcpu first run, we eventually know the actual number of vcpus. This is a synchronization point to check all redistributors were assigned. On kvm_vgic_map_resources() we check both dist and redist were set, eventually check potential base address inconsistencies. Signed-off-by: Eric Auger

[PATCH v6 05/12] KVM: arm/arm64: Revisit Redistributor TYPER last bit computation

2018-04-30 Thread Eric Auger
The TYPER of an redistributor reflects whether the rdist is the last one of the redistributor region. Let's compare the TYPER GPA against the address of the last occupied slot within the redistributor region. Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall

[PATCH v6 06/12] KVM: arm/arm64: Adapt vgic_v3_check_base to multiple rdist regions

2018-04-30 Thread Eric Auger
vgic_v3_check_base() currently only handles the case of a unique legacy redistributor region whose size is not explicitly set but inferred, instead, from the number of online vcpus. We adapt it to handle the case of multiple redistributor regions with explicitly defined size. We rely on two new

[PATCH v6 07/12] KVM: arm/arm64: Helper to register a new redistributor region

2018-04-30 Thread Eric Auger
We introduce a new helper that creates and inserts a new redistributor region into the rdist region list. This helper both handles the case where the redistributor region size is known at registration time and the legacy case where it is not (eventually depending on the number of online vcpus).

[PATCH v6 04/12] KVM: arm/arm64: Helper to locate free rdist index

2018-04-30 Thread Eric Auger
We introduce vgic_v3_rdist_free_slot to help identifying where we can place a new 2x64KB redistributor. Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall --- v3 -> v4: - add details to vgic_v3_rdist_free_slot kernel doc comment - Added

[PATCH v6 03/12] KVM: arm/arm64: Replace the single rdist region by a list

2018-04-30 Thread Eric Auger
At the moment KVM supports a single rdist region. We want to support several separate rdist regions so let's introduce a list of them. This patch currently only cares about a single entry in this list as the functionality to register several redist regions is not yet there. So this only translates

[PATCH v6 02/12] KVM: arm/arm64: Document KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Eric Auger
We introduce a new KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute in KVM_DEV_ARM_VGIC_GRP_ADDR group. It allows userspace to provide the base address and size of a redistributor region Compared to KVM_VGIC_V3_ADDR_TYPE_REDIST, this new attribute allows to declare several separate redistributor

[PATCH v6 01/12] KVM: arm/arm64: Set dist->spis to NULL after kfree

2018-04-30 Thread Eric Auger
in case kvm_vgic_map_resources() fails, typically if the vgic distributor is not defined, __kvm_vgic_destroy will be called several times. Indeed kvm_vgic_map_resources() is called on first vcpu run. As a result dist->spis is freeed more than once and on the second time it causes a "kernel BUG at

[PATCH v6 00/12] KVM: arm/arm64: Allow multiple GICv3 redistributor regions

2018-04-30 Thread Eric Auger
At the moment the KVM VGICv3 only supports a single redistributor region (whose base address is set through the GICv3 kvm device KVM_DEV_ARM_VGIC_GRP_ADDR/KVM_VGIC_V3_ADDR_TYPE_REDIST). There, all the redistributors are laid out contiguously. The size of this single redistributor region is not set

Re: [PATCH v5 11/12] KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Christoffer Dall
On Mon, Apr 30, 2018 at 11:07:43AM +0200, Eric Auger wrote: > Now all the internals are ready to handle multiple redistributor > regions, let's allow the userspace to register them. > > Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall >

Re: [PATCH v5 02/12] KVM: arm/arm64: Document KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Peter Maydell
On 30 April 2018 at 10:07, Eric Auger wrote: > We introduce a new KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute in > KVM_DEV_ARM_VGIC_GRP_ADDR group. Hi; one minor grammar nit in the docs below, otherwise Reviewed-by: Peter Maydell > It allows

Re: [PATCH v5 07/12] KVM: arm/arm64: Helper to register a new redistributor region

2018-04-30 Thread Christoffer Dall
On Mon, Apr 30, 2018 at 11:07:39AM +0200, Eric Auger wrote: > We introduce a new helper that creates and inserts a new redistributor > region into the rdist region list. This helper both handles the case > where the redistributor region size is known at registration time > and the legacy case

Re: [PATCH v5 02/12] KVM: arm/arm64: Document KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Christoffer Dall
On Mon, Apr 30, 2018 at 11:07:34AM +0200, Eric Auger wrote: > We introduce a new KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute in > KVM_DEV_ARM_VGIC_GRP_ADDR group. It allows userspace to provide the > base address and size of a redistributor region > > Compared to KVM_VGIC_V3_ADDR_TYPE_REDIST,

[PATCH v5 12/12] KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to 512

2018-04-30 Thread Eric Auger
Let's raise the number of supported vcpus along with vgic v3 now that HW is looming with more physical CPUs. Signed-off-by: Eric Auger Acked-by: Christoffer Dall --- v4 -> v5: - addded Christoffer's A-b --- include/kvm/arm_vgic.h | 2 +- 1

[PATCH v5 11/12] KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Eric Auger
Now all the internals are ready to handle multiple redistributor regions, let's allow the userspace to register them. Signed-off-by: Eric Auger --- v4 -> v5: - s/uint_t/u - fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read - fix read path - return -ENOENT instead of -ENODEV

[PATCH v5 06/12] KVM: arm/arm64: Adapt vgic_v3_check_base to multiple rdist regions

2018-04-30 Thread Eric Auger
vgic_v3_check_base() currently only handles the case of a unique legacy redistributor region whose size is not explicitly set but inferred, instead, from the number of online vcpus. We adapt it to handle the case of multiple redistributor regions with explicitly defined size. We rely on two new

[PATCH v5 09/12] KVM: arm/arm64: Check all vcpu redistributors are set on map_resources

2018-04-30 Thread Eric Auger
On vcpu first run, we eventually know the actual number of vcpus. This is a synchronization point to check all redistributors were assigned. On kvm_vgic_map_resources() we check both dist and redist were set, eventually check potential base address inconsistencies. Signed-off-by: Eric Auger

[PATCH v5 07/12] KVM: arm/arm64: Helper to register a new redistributor region

2018-04-30 Thread Eric Auger
We introduce a new helper that creates and inserts a new redistributor region into the rdist region list. This helper both handles the case where the redistributor region size is known at registration time and the legacy case where it is not (eventually depending on the number of online vcpus).

[PATCH v5 08/12] KVM: arm/arm64: Check vcpu redist base before registering an iodev

2018-04-30 Thread Eric Auger
As we are going to register several redist regions, vgic_register_all_redist_iodevs() may be called several times. We need to register a redist_iodev for a given vcpu only once. So let's check if the base address has already been set. Initialize this latter in kvm_vgic_vcpu_early_init().

[PATCH v5 05/12] KVM: arm/arm64: Revisit Redistributor TYPER last bit computation

2018-04-30 Thread Eric Auger
The TYPER of an redistributor reflects whether the rdist is the last one of the redistributor region. Let's compare the TYPER GPA against the address of the last occupied slot within the redistributor region. Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall

[PATCH v5 04/12] KVM: arm/arm64: Helper to locate free rdist index

2018-04-30 Thread Eric Auger
We introduce vgic_v3_rdist_free_slot to help identifying where we can place a new 2x64KB redistributor. Signed-off-by: Eric Auger Reviewed-by: Christoffer Dall --- v3 -> v4: - add details to vgic_v3_rdist_free_slot kernel doc comment - Added

[PATCH v5 02/12] KVM: arm/arm64: Document KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Eric Auger
We introduce a new KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute in KVM_DEV_ARM_VGIC_GRP_ADDR group. It allows userspace to provide the base address and size of a redistributor region Compared to KVM_VGIC_V3_ADDR_TYPE_REDIST, this new attribute allows to declare several separate redistributor

[PATCH v5 03/12] KVM: arm/arm64: Replace the single rdist region by a list

2018-04-30 Thread Eric Auger
At the moment KVM supports a single rdist region. We want to support several separate rdist regions so let's introduce a list of them. This patch currently only cares about a single entry in this list as the functionality to register several redist regions is not yet there. So this only translates

[PATCH v5 00/12] KVM: arm/arm64: Allow multiple GICv3 redistributor regions

2018-04-30 Thread Eric Auger
At the moment the KVM VGICv3 only supports a single redistributor region (whose base address is set through the GICv3 kvm device KVM_DEV_ARM_VGIC_GRP_ADDR/KVM_VGIC_V3_ADDR_TYPE_REDIST). There, all the redistributors are laid out contiguously. The size of this single redistributor region is not set

[PATCH v5 01/12] KVM: arm/arm64: Set dist->spis to NULL after kfree

2018-04-30 Thread Eric Auger
in case kvm_vgic_map_resources() fails, typically if the vgic distributor is not defined, __kvm_vgic_destroy will be called several times. Indeed kvm_vgic_map_resources() is called on first vcpu run. As a result dist->spis is freeed more than once and on the second time it causes a "kernel BUG at

Re: [PATCH v3 11/12] KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION

2018-04-30 Thread Auger Eric
Hi Christoffer, On 04/24/2018 11:06 PM, Christoffer Dall wrote: > On Fri, Apr 13, 2018 at 10:20:57AM +0200, Eric Auger wrote: >> Now all the internals are ready to handle multiple redistributor >> regions, let's allow the userspace to register them. >> >> Signed-off-by: Eric Auger