Re: KVM: arm64: A new approach for SPE support

2023-01-04 Thread Alexandru Elisei
Hi Mark, Thank you for having a look! On Wed, Jan 04, 2023 at 09:19:25AM +, Mark Rutland wrote: > On Tue, Jan 03, 2023 at 02:27:59PM +0000, Alexandru Elisei wrote: > > Hi, > > > > Gentle ping regarding this. > > Hi Alexandru, > > Sorry for the delay; th

Re: KVM: arm64: A new approach for SPE support

2023-01-03 Thread Alexandru Elisei
Hi, Gentle ping regarding this. Thanks, Alex On Wed, Nov 23, 2022 at 11:40:45AM +, Alexandru Elisei wrote: > The previous discussion about how best to add SPE support to KVM [1] is > heading in the direction of pinning at EL2 only the buffer, when the guest > enables profiling

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2023-01-03 Thread Alexandru Elisei
01:41:56PM +0100, Alexandru Elisei wrote: > > Hi Oliver, > > > > On Tue, Sep 13, 2022 at 11:58:47AM +0100, Oliver Upton wrote: > > > Hey Alex, > > > > > > On Mon, Sep 12, 2022 at 03:50:46PM +0100, Alexandru Elisei wrote: > > > > > > [.

Re: [kvm-unit-tests PATCH] arm: Remove MAX_SMP probe loop

2022-12-20 Thread Alexandru Elisei
Hi, On Mon, Dec 19, 2022 at 06:52:50PM +, Colton Lewis wrote: > This loop logic is broken for machines with a number of CPUs that > isn't a power of two. A machine with 8 CPUs will test with MAX_SMP=8 > but a machine with 12 CPUs will test with MAX_SMP=6 because 12 >> 2 == > 6. This can, in

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-14 Thread Alexandru Elisei
Hi, On Tue, Dec 13, 2022 at 10:01:06AM -0800, Ricardo Koller wrote: > On Tue, Dec 13, 2022 at 04:43:38PM +0000, Alexandru Elisei wrote: > > Hi, > > > > On Tue, Dec 13, 2022 at 08:21:24AM -0800, Ricardo Koller wrote: > > > On Tue, Dec 13, 2022 at 12:36:14PM

Re: [kvm-unit-tests PATCH 3/3] arm: pmu: Add tests for 64-bit overflows

2022-12-14 Thread Alexandru Elisei
Hi, On Tue, Dec 13, 2022 at 10:04:04AM -0800, Ricardo Koller wrote: > On Tue, Dec 13, 2022 at 05:03:40PM +0000, Alexandru Elisei wrote: > > Hi, > > > > Checked that all places where ALL_SET/PRE_OVERFLOW were used are now taking > > into account the fact that counters

Re: [kvm-unit-tests PATCH 3/3] arm: pmu: Add tests for 64-bit overflows

2022-12-13 Thread Alexandru Elisei
Hi, Checked that all places where ALL_SET/PRE_OVERFLOW were used are now taking into account the fact that counters are programmed to be 64bit. In the case of 64bit counters, the printf format specifier is %ld, which means that ALL_SET_64 and PRE_OVERFLOW_64 are now displayed as negative

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-13 Thread Alexandru Elisei
Hi, On Tue, Dec 13, 2022 at 08:21:24AM -0800, Ricardo Koller wrote: > On Tue, Dec 13, 2022 at 12:36:14PM +0000, Alexandru Elisei wrote: > > Hi, > > > > Some more comments below. > > > > On Fri, Dec 02, 2022 at 04:55:25AM +, Ricardo Koller wrote: &

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-13 Thread Alexandru Elisei
Hi, Some more comments below. On Fri, Dec 02, 2022 at 04:55:25AM +, Ricardo Koller wrote: > PMUv3p5 uses 64-bit counters irrespective of whether the PMU is configured > for overflowing at 32 or 64-bits. The consequence is that tests that check > the counter values after overflowing should

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-12 Thread Alexandru Elisei
Hi, On Mon, Dec 12, 2022 at 09:05:02AM +, Marc Zyngier wrote: > Alex, > > On Sun, 11 Dec 2022 11:40:39 +, > Alexandru Elisei wrote: > > > > A simple "hey, you're wrong here, the PMU extensions do not follow the > > principles of the ID scheme for

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-11 Thread Alexandru Elisei
Hi Marc, On Sat, Dec 10, 2022 at 11:01:53AM +, Marc Zyngier wrote: > On Fri, 09 Dec 2022 17:47:14 +, > Alexandru Elisei wrote: > > > > Hi, > > > > On Fri, Dec 02, 2022 at 04:55:25AM +, Ricardo Koller wrote: > > > PMUv3p5 uses 64-bit c

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Fix overflow checks for PMUv3p5 long counters

2022-12-09 Thread Alexandru Elisei
Hi, On Fri, Dec 02, 2022 at 04:55:25AM +, Ricardo Koller wrote: > PMUv3p5 uses 64-bit counters irrespective of whether the PMU is configured > for overflowing at 32 or 64-bits. The consequence is that tests that check > the counter values after overflowing should not assume that values will

[kvm-unit-tests PATCH v2 1/2] arm/arm64: mmu: Teach virt_to_pte_phys() about block descriptors

2022-11-24 Thread Alexandru Elisei
granularity, which can lead to erroneous addresses being returned in the case of block mappings. Signed-off-by: Alexandru Elisei --- lib/arm/mmu.c | 89 +++ 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c

[kvm-unit-tests PATCH v2 0/2] arm/arm64: teach virt_to_pte_phys() about block descriptors

2022-11-24 Thread Alexandru Elisei
turns NULL for an invalid descriptor. Lightly tested on a rockpro64 (4k and 64k pages, arm64 and arm, qemu only) because the changes from the previous version are trivial. Alexandru Elisei (2): arm/arm64: mmu: Teach virt_to_pte_phys() about block descriptors arm/arm64: mmu: Rename mmu_get_pte() -&g

[kvm-unit-tests PATCH v2 2/2] arm/arm64: mmu: Rename mmu_get_pte() -> follow_pte()

2022-11-24 Thread Alexandru Elisei
supplied as the argument, not to translate the virtual address to a physical address using the current translation; that's what virt_to_phys() does. Signed-off-by: Alexandru Elisei --- lib/arm/asm/mmu-api.h | 2 +- lib/arm/mmu.c | 9 +++-- 2 files changed, 4 insertions(+), 7 deletions

KVM: arm64: A new approach for SPE support

2022-11-23 Thread Alexandru Elisei
The previous discussion about how best to add SPE support to KVM [1] is heading in the direction of pinning at EL2 only the buffer, when the guest enables profiling, instead of pinning the entire VM memory. Although better than pinning the entire VM at EL2, it still has some disadvantages: 1.

Re: [kvm-unit-tests PATCH] MAINTAINERS: new kvmarm mailing list

2022-10-26 Thread Alexandru Elisei
in Linux since commit ac107abef197 ("KVM: arm64: Advertise new kvmarm mailing list"): Reviewed-by: Alexandru Elisei Thanks, Alex > > Signed-off-by: Cornelia Huck > --- > MAINTAINERS | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff -

Re: [kvm-unit-tests PATCH 1/3] lib/vmalloc: Treat virt_to_pte_phys() as returning a physical address

2022-10-06 Thread Alexandru Elisei
Hi, On Thu, Oct 06, 2022 at 01:35:52PM +0200, Claudio Imbrenda wrote: > On Thu, 6 Oct 2022 12:12:39 +0100 > Alexandru Elisei wrote: > > > All architectures that implements virt_to_pte_phys() (s390x, x86, arm and > > arm64) return a physical address from the function. T

[kvm-unit-tests PATCH 3/3] arm/arm64: mmu: Rename mmu_get_pte() -> follow_pte()

2022-10-06 Thread Alexandru Elisei
supplied as the argument, not to translate the virtual address to a physical address using the current translation; that's what virt_to_phys() does. Signed-off-by: Alexandru Elisei --- lib/arm/asm/mmu-api.h | 2 +- lib/arm/mmu.c | 9 +++-- 2 files changed, 4 insertions(+), 7 deletions

[kvm-unit-tests PATCH 2/3] arm/arm64: mmu: Teach virt_to_pte_phys() about block descriptors

2022-10-06 Thread Alexandru Elisei
granularity, which can lead to erroneous addresses being returned in the case of block mappings. Signed-off-by: Alexandru Elisei --- lib/arm/mmu.c | 89 +++ 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c

[kvm-unit-tests PATCH 1/3] lib/vmalloc: Treat virt_to_pte_phys() as returning a physical address

2022-10-06 Thread Alexandru Elisei
table entry instead) is not feasible, because it is possible for an architecture to use the upper bits of the table entry to store metadata about the page. Cc: Paolo Bonzini Cc: Thomas Huth Cc: Andrew Jones Cc: Laurent Vivier Cc: Janosch Frank Cc: Claudio Imbrenda Signed-off-by: Alexandru

[kvm-unit-tests PATCH 0/3] arm/arm64: mmu cleanups and fixes

2022-10-06 Thread Alexandru Elisei
with qemu and kvmtool; arm, with qemu and kvmtool. Alexandru Elisei (3): lib/vmalloc: Treat virt_to_pte_phys() as returning a physical address arm/arm64: mmu: Teach virt_to_pte_phys() about block descriptors arm/arm64: mmu: Rename mmu_get_pte() -> follow_pte() lib/arm/asm/mmu-api.h |

Re: [kvm-unit-tests PATCH v3 0/3] arm: pmu: Fixes for bare metal

2022-10-06 Thread Alexandru Elisei
Hi Eric, On Wed, Oct 05, 2022 at 11:50:09AM +0200, Eric Auger wrote: > Hi Alexandru, > > On 10/5/22 11:21, Alexandru Elisei wrote: > > Hi Eric, > > > > On Tue, Oct 04, 2022 at 07:31:25PM +0200, Eric Auger wrote: > >> Hi Alexandru, > >> > >> O

Re: [kvm-unit-tests PATCH v3 0/3] arm: pmu: Fixes for bare metal

2022-10-05 Thread Alexandru Elisei
Hi, On Wed, Oct 05, 2022 at 10:21:12AM +0100, Alexandru Elisei wrote: > Hi Eric, > > On Tue, Oct 04, 2022 at 07:31:25PM +0200, Eric Auger wrote: > > Hi Alexandru, > > > > On 10/4/22 18:58, Alexandru Elisei wrote: > > > Hi Eric, > > > > > >

Re: [kvm-unit-tests PATCH v3 0/3] arm: pmu: Fixes for bare metal

2022-10-05 Thread Alexandru Elisei
Hi Eric, On Tue, Oct 04, 2022 at 07:31:25PM +0200, Eric Auger wrote: > Hi Alexandru, > > On 10/4/22 18:58, Alexandru Elisei wrote: > > Hi Eric, > > > > On Tue, Oct 04, 2022 at 06:20:23PM +0200, Eric Auger wrote: > >> Hi Ricardo, Marc, > >&g

Re: [kvm-unit-tests PATCH v3 0/3] arm: pmu: Fixes for bare metal

2022-10-04 Thread Alexandru Elisei
Hi Eric, On Tue, Oct 04, 2022 at 06:20:23PM +0200, Eric Auger wrote: > Hi Ricardo, Marc, > > On 8/5/22 02:41, Ricardo Koller wrote: > > There are some tests that fail when running on bare metal (including a > > passthrough prototype). There are three issues with the tests. The > > first one is

Re: [kvm-unit-tests RFC PATCH 05/19] lib/alloc_phys: Remove locking

2022-09-26 Thread Alexandru Elisei
Hi, On Tue, Sep 20, 2022 at 04:59:52PM +0200, Andrew Jones wrote: > On Tue, Sep 20, 2022 at 02:20:48PM +0100, Alexandru Elisei wrote: > > Hi, > > > > On Tue, Sep 20, 2022 at 10:45:53AM +0200, Andrew Jones wrote: > > > On Tue, Aug 09, 2022 at 10:15:44AM

Re: [kvm-unit-tests RFC PATCH 13/19] arm: page.h: Add missing libcflat.h include

2022-09-26 Thread Alexandru Elisei
> On Tue, Aug 09, 2022 at 10:15:52AM +0100, Alexandru Elisei wrote: > > Include libcflat from page.h to avoid error like this one: > > > > /path/to/kvm-unit-tests/lib/asm/page.h:19:9: error: unknown type name ‘u64’ > >19 | typedef u64 pteval_t; > > |

Re: [kvm-unit-tests RFC PATCH 07/19] arm/arm64: Mark the phys_end parameter as unused in setup_mmu()

2022-09-26 Thread Alexandru Elisei
Hi, On Tue, Sep 20, 2022 at 10:58:15AM +0200, Andrew Jones wrote: > On Tue, Aug 09, 2022 at 10:15:46AM +0100, Alexandru Elisei wrote: > > phys_end was used to cap the linearly mapped memory to 3G to allow 1G of > > room for the vmalloc area to grown down. This was made us

Re: [kvm-unit-tests RFC PATCH 05/19] lib/alloc_phys: Remove locking

2022-09-20 Thread Alexandru Elisei
Hi, On Tue, Sep 20, 2022 at 10:45:53AM +0200, Andrew Jones wrote: > On Tue, Aug 09, 2022 at 10:15:44AM +0100, Alexandru Elisei wrote: > > With powerpc moving the page allocator, there are no architectures left > > which use the physical allocator after the boot setup: arm, a

Re: [kvm-unit-tests RFC PATCH 06/19] lib/alloc_phys: Remove allocation accounting

2022-09-20 Thread Alexandru Elisei
Hi, On Tue, Sep 20, 2022 at 10:40:47AM +0200, Andrew Jones wrote: > On Tue, Aug 09, 2022 at 10:15:45AM +0100, Alexandru Elisei wrote: > > The page allocator has better allocation tracking and is used by all > > architectures, while the physical allocator is now never used for

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-09-13 Thread Alexandru Elisei
Hi Oliver, On Tue, Sep 13, 2022 at 11:58:47AM +0100, Oliver Upton wrote: > Hey Alex, > > On Mon, Sep 12, 2022 at 03:50:46PM +0100, Alexandru Elisei wrote: > > [...] > > > > Yeah, that would be good to follow up on what other OSes are doing. > > >

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-09-12 Thread Alexandru Elisei
Hi Oliver, On Wed, Aug 17, 2022 at 10:05:51AM -0500, Oliver Upton wrote: > Hi Alex, > > On Fri, Aug 12, 2022 at 02:05:45PM +0100, Alexandru Elisei wrote: > > Hi Oliver, > > > > Just a note, for some reason some of your emails, but not all, don't show > >

Re: [PATCH] arm:Add PSCI_CPU_OFF testscase to arm/psci testsuite.

2022-09-09 Thread Alexandru Elisei
Hi, The patch doesn't apply on top of master (commit 7362976db651 ("x86/pmu: Run the "emulation" test iff forced emulation is available")). I think it doesn't apply correctly because you've used an email client which converts tabs to spaces. Another thing that I spotted while trying to figure

[kvm-unit-tests PATCH] arm/psci: Test that CPU 1 has been successfully brought online

2022-09-09 Thread Alexandru Elisei
. Since the CPU 1 thread is now being set up properly by kvm-unit-tests when being brought online, it becomes possible to add other tests in the future that require all CPUs. Signed-off-by: Alexandru Elisei --- I got the idea for this patch when reviewing the CPU_OFF test [1]. Nonetheless, I think

Re: [PATCH v2 0/2] KVM: arm64: Uphold 64bit-only behavior on asymmetric systems

2022-08-17 Thread Alexandru Elisei
Hi, On Wed, Aug 17, 2022 at 11:07:10AM +0100, Marc Zyngier wrote: > On Tue, 16 Aug 2022 20:25:52 +0100, > Oliver Upton wrote: > > > > Small series to fix a couple issues around when 64bit-only behavior is > > applied. As KVM is more restrictive than the kernel in terms of 32bit > > support (no

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-08-12 Thread Alexandru Elisei
wrote: > On Wed, Aug 10, 2022 at 10:37:26AM +0100, Alexandru Elisei wrote: > > Hi, > > > > On Tue, Aug 09, 2022 at 01:43:32PM -0500, Oliver Upton wrote: > > > Hi Alex, > > > > > > On Tue, Aug 09, 2022 at 03:01:36PM +0100, Alexandru Elisei wrote: &g

Re: [kvm-unit-tests RFC PATCH 09/19] arm/arm64: Zero secondary CPUs' stack

2022-08-10 Thread Alexandru Elisei
Hi Nikos, On Tue, Aug 09, 2022 at 01:56:13PM +0100, Nikos Nikoleris wrote: > On 09/08/2022 10:15, Alexandru Elisei wrote: > > For the boot CPU, the entire stack is zeroed in the entry code. For the > > secondaries, only struct thread_info, which lives at the bottom of the >

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-08-10 Thread Alexandru Elisei
Hi, On Tue, Aug 09, 2022 at 01:43:32PM -0500, Oliver Upton wrote: > Hi Alex, > > On Tue, Aug 09, 2022 at 03:01:36PM +0100, Alexandru Elisei wrote: > > [...] > > > > > To summarize the approaches we've discussed so far: > > > > > > > > 1.

Re: [kvm-unit-tests RFC PATCH 19/19] arm/arm64: Rework the cache maintenance in asm_mmu_disable

2022-08-10 Thread Alexandru Elisei
atch might look very confusing. On Tue, Aug 09, 2022 at 08:48:40PM +0100, Nikos Nikoleris wrote: > On 09/08/2022 17:53, Alexandru Elisei wrote: > > Hi, > > > > On Tue, Aug 09, 2022 at 04:53:18PM +0100, Nikos Nikoleris wrote: > > > On 09/08/2022 15:22, Alexandru Elisei w

Re: [kvm-unit-tests RFC PATCH 19/19] arm/arm64: Rework the cache maintenance in asm_mmu_disable

2022-08-09 Thread Alexandru Elisei
Hi, On Tue, Aug 09, 2022 at 04:53:18PM +0100, Nikos Nikoleris wrote: > On 09/08/2022 15:22, Alexandru Elisei wrote: > > On Tue, Aug 09, 2022 at 02:53:34PM +0100, Nikos Nikoleris wrote: > > > Hi Alex, > > > > > > On 09/08/2022 10:15, Alexandru Elisei wrot

Re: [kvm-unit-tests PATCH v3 1/3] arm: pmu: Add missing isb()'s after sys register writing

2022-08-09 Thread Alexandru Elisei
ead the correct > value for PMEVNCTR0_EL0 (from ARM DDI 0487H.a, page D13-5237). > > Signed-off-by: Ricardo Koller Looks good to me: Reviewed-by: Alexandru Elisei Thanks, Alex ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [kvm-unit-tests RFC PATCH 19/19] arm/arm64: Rework the cache maintenance in asm_mmu_disable

2022-08-09 Thread Alexandru Elisei
On Tue, Aug 09, 2022 at 02:53:34PM +0100, Nikos Nikoleris wrote: > Hi Alex, > > On 09/08/2022 10:15, Alexandru Elisei wrote: > > asm_mmu_disable is overly ambitious and provably incorrect: > > > > 1. It tries to clean and invalidate the data caches for the *entire*

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-08-09 Thread Alexandru Elisei
Hi, On Tue, Aug 02, 2022 at 12:34:40PM -0700, Oliver Upton wrote: > Hi folks, > > On Tue, Aug 02, 2022 at 10:49:07AM +0100, Alexandru Elisei wrote: > > > > > A funkier approach might be to defer pinning of the buffer until the > > > > > SPE is > &

Re: [kvm-unit-tests RFC PATCH 00/19] arm/arm64: Rework cache maintenance at boot

2022-08-09 Thread Alexandru Elisei
Hi, Forgot to add a link to the gitlab branch with the series [1]. [1] https://gitlab.arm.com/linux-arm/kvm-unit-tests-ae/-/tree/arm-arm64-rework-cache-maintenance-at-boot-v1 Thanks, Alex On Tue, Aug 09, 2022 at 10:15:39AM +0100, Alexandru Elisei wrote: > I got the idea for this series a

[kvm-unit-tests RFC PATCH 18/19] arm/arm64: Perform dcache maintenance at boot

2022-08-09 Thread Alexandru Elisei
or speculated read. Signed-off-by: Alexandru Elisei --- arm/cstart.S| 20 + arm/cstart64.S | 30 lib/arm/asm/pgtable.h | 8 ++ lib/arm/mmu.c | 4 +++ lib/arm/setup.c | 62 + lib/arm64/asm

[kvm-unit-tests RFC PATCH 19/19] arm/arm64: Rework the cache maintenance in asm_mmu_disable

2022-08-09 Thread Alexandru Elisei
if (*x != 0x50) { + pass = false; + break; + } + } + report(pass, "MMU disable cache maintenance"); Signed-off-by: Alexandru Elisei --- arm/cstart.S | 11 ++- arm/cstart64.S | 11 +-- 2 files changed, 11 i

[kvm-unit-tests RFC PATCH 17/19] arm/arm64: Configure secondaries' stack before enabling the MMU

2022-08-09 Thread Alexandru Elisei
, is cleaned to PoC. Signed-off-by: Alexandru Elisei --- arm/cstart.S | 20 ++-- arm/cstart64.S | 16 lib/arm/smp.c | 5 + 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/arm/cstart.S b/arm/cstart.S index 096a77c454f4..877559b367de 100644 --- a/arm

[kvm-unit-tests RFC PATCH 16/19] arm/arm64: Allocate secondaries' stack using the page allocator

2022-08-09 Thread Alexandru Elisei
oed in the entry code. Signed-off-by: Alexandru Elisei --- lib/arm/asm/thread_info.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h index eaa72582af86..190e082cbba0 100644 --- a/lib/arm/asm/thread_info.h +++ b/lib/arm/

[kvm-unit-tests RFC PATCH 15/19] lib/alloc_phys: Add callback to perform cache maintenance

2022-08-09 Thread Alexandru Elisei
Some architectures, like arm and arm64, require explicit cache maintenance to maintain the caches in sync with memory when toggling the caches. Add the function to do the required maintenance on the internal structures that the allocator maintains. Signed-off-by: Alexandru Elisei --- lib

[kvm-unit-tests RFC PATCH 14/19] arm/arm64: Add C functions for doing cache maintenance

2022-08-09 Thread Alexandru Elisei
Add C functions for doing cache maintenance, which will be used for implementing the necessary maintenance when kvm-unit-tests boots. Signed-off-by: Alexandru Elisei --- arm/Makefile.arm | 4 +- arm/Makefile.arm64 | 4 +- arm/Makefile.common| 4 +- lib/arm/asm

[kvm-unit-tests RFC PATCH 12/19] arm/arm64: assembler.h: Replace size with end address for dcache_by_line_op

2022-08-09 Thread Alexandru Elisei
ate after turning MMU off"). Signed-off-by: Alexandru Elisei --- arm/cstart.S | 1 - arm/cstart64.S| 1 - lib/arm/asm/assembler.h | 11 +-- lib/arm64/asm/assembler.h | 11 +-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arm/cstart.S b/a

[kvm-unit-tests RFC PATCH 11/19] arm/arm64: Map the UART when creating the translation tables

2022-08-09 Thread Alexandru Elisei
when creating the translation tables. Note that the address remains mapped even if the devicetree address is different. Signed-off-by: Alexandru Elisei --- lib/arm/io.c | 5 + lib/arm/io.h | 3 +++ lib/arm/mmu.c | 8 3 files changed, 16 insertions(+) diff --git a/lib/arm/io.c b/lib

[kvm-unit-tests RFC PATCH 13/19] arm: page.h: Add missing libcflat.h include

2022-08-09 Thread Alexandru Elisei
of the header already includes libcflat since commit a2d06852fe59 ("arm64: Add support for configuring the translation granule"). Signed-off-by: Alexandru Elisei --- lib/arm/asm/page.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h index 8e

[kvm-unit-tests RFC PATCH 10/19] arm/arm64: Enable the MMU early

2022-08-09 Thread Alexandru Elisei
Enable the MMU immediately after the physical allocator is initialized, to make reasoning about what cache maintenance operations are needed a lot easier. Signed-off-by: Alexandru Elisei --- lib/arm/asm/mmu-api.h | 1 + lib/arm/asm/pgtable.h | 42 --- lib/arm

[kvm-unit-tests RFC PATCH 09/19] arm/arm64: Zero secondary CPUs' stack

2022-08-09 Thread Alexandru Elisei
of the testsuite, as all the stacks now start with the same contents, which is zero. And now that all the stacks are zeroed in the entry code, there is no need to explicitely zero struct thread_info in thread_info_init(). Signed-off-by: Alexandru Elisei --- arm/cstart.S | 6 ++ arm/cstart64.S

[kvm-unit-tests RFC PATCH 08/19] arm/arm64: Use pgd_alloc() to allocate mmu_idmap

2022-08-09 Thread Alexandru Elisei
ld still have allocated a full page. Signed-off-by: Alexandru Elisei --- lib/arm/asm/pgtable.h | 4 ++-- lib/arm/mmu.c | 4 ++-- lib/arm64/asm/pgtable.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/arm/asm/pgtable.h b/lib/arm/asm/pgtable.h index

[kvm-unit-tests RFC PATCH 07/19] arm/arm64: Mark the phys_end parameter as unused in setup_mmu()

2022-08-09 Thread Alexandru Elisei
t changing their limits. Signed-off-by: Alexandru Elisei --- lib/arm/mmu.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c index e1a72fe4941f..8f936acafe8b 100644 --- a/lib/arm/mmu.c +++ b/lib/arm/mmu.c @@ -153,14 +153,10 @@ void mmu_set_

[kvm-unit-tests RFC PATCH 06/19] lib/alloc_phys: Remove allocation accounting

2022-08-09 Thread Alexandru Elisei
in the way it displays the use and free regions: the end of the region is now non-inclusive, to allow phys_alloc_show() to express that no memory has been used, or no memory is free, in which case the start and the end adresses are equal. Signed-off-by: Alexandru Elisei --- lib/alloc_phys.c | 65

[kvm-unit-tests RFC PATCH 04/19] powerpc: Use the page allocator

2022-08-09 Thread Alexandru Elisei
The spapr_hcall test makes two page sized allocations using the physical allocator. Initialize the page allocator and use alloc_page() directly. CC: Laurent Vivier CC: Thomas Huth CC: kvm-...@vger.kernel.org Signed-off-by: Alexandru Elisei --- lib/powerpc/setup.c | 8 powerpc

[kvm-unit-tests RFC PATCH 05/19] lib/alloc_phys: Remove locking

2022-08-09 Thread Alexandru Elisei
that allocate memory. Signed-off-by: Alexandru Elisei --- lib/alloc_phys.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/lib/alloc_phys.c b/lib/alloc_phys.c index efb783b34002..2e0b9c079d1d 100644 --- a/lib/alloc_phys.c +++ b/lib/alloc_phys.c @@ -21,7 +21,6 @@ struct

[kvm-unit-tests RFC PATCH 03/19] lib/alloc_phys: Use phys_alloc_aligned_safe and rename it to memalign_early

2022-08-09 Thread Alexandru Elisei
to phys_addr_t, to match the type of the top and base variables describing the available physical memory; this is a cosmetic change only, since libcflat.h defines phys_addr_t as an alias for u64. Signed-off-by: Alexandru Elisei --- lib/alloc_phys.c | 38 ++ 1 file

[kvm-unit-tests RFC PATCH 01/19] Makefile: Define __ASSEMBLY__ for assembly files

2022-08-09 Thread Alexandru Elisei
files which depend on it. Let's make sure that nobody gets this wrong and define it as a compiler constant when compiling assembly files. __ASSEMBLY__ is now defined for all .S files, even those that didn't set it explicitely before. Signed-off-by: Alexandru Elisei --- Makefile

[kvm-unit-tests RFC PATCH 02/19] lib/alloc_phys: Initialize align_min

2022-08-09 Thread Alexandru Elisei
the align_min field and changed it back to a static variable, but missed initializing it. Initialize align_min to DEFAULT_MINIMUM_ALIGNMENT, as it was intended. Signed-off-by: Alexandru Elisei --- lib/alloc_phys.c | 7 +++ lib/alloc_phys.h | 2 -- 2 files changed, 3 insertions(+), 6 dele

[kvm-unit-tests RFC PATCH 00/19] arm/arm64: Rework cache maintenance at boot

2022-08-09 Thread Alexandru Elisei
org/all/20220630100324.3153655-1-nikos.nikole...@arm.com/ Alexandru Elisei (19): Makefile: Define __ASSEMBLY__ for assembly files lib/alloc_phys: Initialize align_min lib/alloc_phys: Use phys_alloc_aligned_safe and rename it to memalign_early powerpc: Use the page allocator lib/al

Re: [kvm-unit-tests PATCH v2 1/3] arm: pmu: Add missing isb()'s after sys register writing

2022-08-04 Thread Alexandru Elisei
Hi, On Wed, Aug 03, 2022 at 11:23:26AM -0700, Ricardo Koller wrote: > There are various pmu tests that require an isb() between enabling > counting and the actual counting. This can lead to count registers > reporting less events than expected; the actual enabling happens after > some events have

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-08-02 Thread Alexandru Elisei
Hi, (+Oliver) On Mon, Aug 01, 2022 at 06:00:56PM +0100, Will Deacon wrote: > Hi Alex, > > On Mon, Jul 25, 2022 at 11:06:24AM +0100, Alexandru Elisei wrote: > > On Tue, Apr 19, 2022 at 03:10:13PM +0100, Will Deacon wrote: > > > On Tue, Apr 19, 2022 at 02:51:05PM +0100

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi, On Wed, Jul 27, 2022 at 12:18:41PM +0100, Marc Zyngier wrote: > On 2022-07-27 11:56, Alexandru Elisei wrote: > > Hi Marc, > > > > On Wed, Jul 27, 2022 at 10:30:59AM +0100, Marc Zyngier wrote: > > > On Tue, 26 Jul 2022 18:51:21 +0100, > > > Olive

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi, On Wed, Jul 27, 2022 at 12:08:11PM +0100, Marc Zyngier wrote: > On 2022-07-27 11:44, Alexandru Elisei wrote: > > On Wed, Jul 27, 2022 at 11:29:03AM +0100, Marc Zyngier wrote: > > > On 2022-07-27 11:19, Alexandru Elisei wrote: > > > > Hi Oliver, > > > &g

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi Oliver, On Tue, Jul 26, 2022 at 10:51:21AM -0700, Oliver Upton wrote: > Hi Alex, > > On Mon, Jul 25, 2022 at 11:06:24AM +0100, Alexandru Elisei wrote: > > [...] > > I'm also a bit confused on how we would manage to un-pin memory on the > way out with this. T

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi Marc, On Wed, Jul 27, 2022 at 10:30:59AM +0100, Marc Zyngier wrote: > On Tue, 26 Jul 2022 18:51:21 +0100, > Oliver Upton wrote: > > > > Hi Alex, > > > > On Mon, Jul 25, 2022 at 11:06:24AM +0100, Alexandru Elisei wrote: > > > > [...] > > >

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
On Wed, Jul 27, 2022 at 11:29:03AM +0100, Marc Zyngier wrote: > On 2022-07-27 11:19, Alexandru Elisei wrote: > > Hi Oliver, > > > > Thank you for the help, replies below. > > > > On Tue, Jul 26, 2022 at 10:51:21AM -0700, Oliver Upton wrote: > > > Hi Ale

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi Marc, On Wed, Jul 27, 2022 at 10:52:34AM +0100, Marc Zyngier wrote: > On Wed, 27 Jul 2022 10:30:59 +0100, > Marc Zyngier wrote: > > > > On Tue, 26 Jul 2022 18:51:21 +0100, > > Oliver Upton wrote: > > > > > > Doesn't pinning the buffer also imply pinning the stage 1 tables > > > responsible

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-27 Thread Alexandru Elisei
Hi Oliver, Thank you for the help, replies below. On Tue, Jul 26, 2022 at 10:51:21AM -0700, Oliver Upton wrote: > Hi Alex, > > On Mon, Jul 25, 2022 at 11:06:24AM +0100, Alexandru Elisei wrote: > > [...] > > > > A funkier approach might be to defer pinning

Re: [PATCH 33/89] KVM: arm64: Handle guest stage-2 page-tables entirely at EL2

2022-07-27 Thread Alexandru Elisei
Hi, On Wed, Jun 08, 2022 at 09:16:56AM +0800, Huang, Shaoqin wrote: > > On 6/1/2022 12:45 AM, Will Deacon wrote: > > On Fri, May 20, 2022 at 05:03:29PM +0100, Alexandru Elisei wrote: > > > On Thu, May 19, 2022 at 02:41:08PM +0100, Will Deacon wrote: > > > > Now

Re: KVM/arm64: SPE: Translate VA to IPA on a stage 2 fault instead of pinning VM memory

2022-07-25 Thread Alexandru Elisei
Hi, On Tue, Apr 19, 2022 at 03:10:13PM +0100, Will Deacon wrote: > On Tue, Apr 19, 2022 at 02:51:05PM +0100, Alexandru Elisei wrote: > > The approach I've taken so far in adding support for SPE in KVM [1] relies > > on pinning the entire VM memory to avoid SPE triggering

[PATCH kvmtool 1/1] Makefile: Introduce LIBFDT_DIR to specify libfdt location

2022-07-22 Thread Alexandru Elisei
measured to be about 100KB, or about 5% of the total executable size. Signed-off-by: Alexandru Elisei --- INSTALL | 12 +++- Makefile | 29 ++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/INSTALL b/INSTALL index 951b12339887..2a65735090a7 100644

[PATCH kvmtool 0/1] Introduce LIBFDT_DIR

2022-07-22 Thread Alexandru Elisei
/linux-arm-kernel/20220526171955.145563-1-alexandru.eli...@arm.com/ [2] https://toolchains.bootlin.com/ [3] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.1.0/ Alexandru Elisei (1): Makefile: Introduce LIBFDT_DIR to specify libfdt location INSTALL | 12

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Add missing isb()'s after sys register writing

2022-07-19 Thread Alexandru Elisei
Hi, On Mon, Jul 18, 2022 at 10:48:29AM -0700, Ricardo Koller wrote: > On Mon, Jul 18, 2022 at 05:38:23PM +0100, Alexandru Elisei wrote: > > Hi, > > > > On Mon, Jul 18, 2022 at 08:49:08AM -0700, Ricardo Koller wrote: > > > There are various pmu tests that req

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Add missing isb()'s after sys register writing

2022-07-19 Thread Alexandru Elisei
Hi, Since you're touching the PMU tests, I took the liberty to suggest changes somewhat related to this patch. If you don't want to implement them, let me know and I'll try to make a patch/series out of them. On Mon, Jul 18, 2022 at 08:49:08AM -0700, Ricardo Koller wrote: > There are various pmu

Re: [kvm-unit-tests PATCH 0/3] arm: pmu: Fixes for bare metal

2022-07-18 Thread Alexandru Elisei
Hi, I believe you're missing the updated email for the arm maintainer. Added it. Thanks, Alex On Mon, Jul 18, 2022 at 08:49:07AM -0700, Ricardo Koller wrote: > There are some tests that fail when running on bare metal (including a > passthrough prototype). There are three issues with the

Re: [kvm-unit-tests PATCH 1/3] arm: pmu: Add missing isb()'s after sys register writing

2022-07-18 Thread Alexandru Elisei
Hi, On Mon, Jul 18, 2022 at 08:49:08AM -0700, Ricardo Koller wrote: > There are various pmu tests that require an isb() between enabling > counting and the actual counting. This can lead to count registers > reporting less events than expected; the actual enabling happens after > some events have

Re: [RFC PATCH v5 15/38] perf: arm_spe_pmu: Move struct arm_spe_pmu to a separate header file

2022-07-06 Thread Alexandru Elisei
is series, it needs a little tweak to > build successfully as a module which I've appended below. > > Cheers, > Calvin > > On Wed, Nov 17, 2021 at 03:38:19PM +, Alexandru Elisei wrote: > > KVM will soon want to make use of struct arm_spe_pmu, move it to a separate &

[PATCH kvmtool] arm64: pvtime: Use correct region size

2022-06-29 Thread Alexandru Elisei
("aarch64: Add stolen time support") Reported-by: Pierre Gondois Signed-off-by: Alexandru Elisei --- arm/aarch64/pvtime.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arm/aarch64/pvtime.c b/arm/aarch64/pvtime.c index a49cf3ed5478..2933ac7ca959 100644 --- a/a

Re: [PATCH v4 kvmtool 00/12] arm64: Allow the user to set RAM base address

2022-06-22 Thread Alexandru Elisei
Hi Suzuki, Will, On Tue, Jun 21, 2022 at 06:03:22PM +0100, Suzuki K Poulose wrote: > On 16/06/2022 14:48, Alexandru Elisei wrote: > > The series can be found at [1]. It is loosely based on the patches that > > allow the user to define the VM memory layout (RAM + MMIO) [2]. I've &g

[PATCH v4 kvmtool 12/12] arm64: Allow the user to specify the RAM base address

2022-06-16 Thread Alexandru Elisei
Allow the user to specify the RAM base address by using -m/--mem size@addr command line argument. The base address must be above 2GB, as to not overlap with the MMIO I/O region. Reviewed-by: Andre Przywara Signed-off-by: Alexandru Elisei --- arm/aarch64/include/kvm/kvm-arch.h | 2 ++ arm

[PATCH v4 kvmtool 11/12] Introduce kvm__arch_default_ram_address()

2022-06-16 Thread Alexandru Elisei
Add a new function, kvm__arch_default_ram_address(), which returns the default address for guest RAM for each architecture. Reviewed-by: Andre Przywara Signed-off-by: Alexandru Elisei --- arm/aarch32/kvm.c | 5 + arm/aarch64/kvm.c | 5 + include/kvm/kvm.h | 1 + mips/kvm.c| 5

[PATCH v4 kvmtool 10/12] arm/arm64: Consolidate RAM initialization in kvm__init_ram()

2022-06-16 Thread Alexandru Elisei
: kvm__arch_enable_mte() and gic__create() are now called before mmap'ing the guest RAM. That is perfectly fine, as they don't use the host's mapping of the guest memory. Reviewed-by: Andre Przywara Signed-off-by: Julien Grall Signed-off-by: Alexandru Elisei --- arm/kvm.c | 52

[PATCH v4 kvmtool 09/12] kvm__arch_init: Remove hugetlbfs_path and ram_size as parameters

2022-06-16 Thread Alexandru Elisei
From: Julien Grall The kvm struct already contains a pointer to the configuration, which contains both hugetlbfs_path and ram_size, so is it not necessary to pass them as arguments to kvm__arch_init(). Reviewed-by: Andre Przywara Signed-off-by: Julien Grall Signed-off-by: Alexandru Elisei

[PATCH v4 kvmtool 08/12] builtin_run: Allow standard size specifiers for memory

2022-06-16 Thread Alexandru Elisei
of treating it as uninitialized, as kvmtool has done so far. Signed-off-by: Suzuki K Poulose Signed-off-by: Alexandru Elisei --- builtin-run.c | 59 ++- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/builtin-run.c b/builtin-run.c

[PATCH v4 kvmtool 07/12] arm/arm64: Kill the ARM_HIMAP_MAX_MEMORY() macro

2022-06-16 Thread Alexandru Elisei
The ARM_HIMAP_MAX_MEMORY() is a remnant of a time when KVM only supported 40 bits if IPA. There are no users left for this macro, remove it. Reviewed-by: Andre Przywara Signed-off-by: Alexandru Elisei --- arm/include/arm-common/kvm-arch.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arm

[PATCH v4 kvmtool 06/12] arm/arm64: Kill the ARM_MAX_MEMORY() macro

2022-06-16 Thread Alexandru Elisei
it. Reviewed-by: Andre Przywara Signed-off-by: Alexandru Elisei --- arm/aarch32/include/kvm/kvm-arch.h | 2 -- arm/aarch64/include/kvm/kvm-arch.h | 16 2 files changed, 18 deletions(-) diff --git a/arm/aarch32/include/kvm/kvm-arch.h b/arm/aarch32/include/kvm/kvm-arch.h index

[PATCH v4 kvmtool 05/12] arm/arm64: Fail if RAM size is too large for 32-bit guests

2022-06-16 Thread Alexandru Elisei
the wrong RAM size for 32-bit guests. Reviewed-by: Andre Przywara Signed-off-by: Alexandru Elisei --- arm/aarch32/kvm.c | 4 arm/aarch64/kvm.c | 5 + arm/kvm.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arm/aarch32/kvm.c b/arm/aarch32/kvm.c index

[PATCH v4 kvmtool 04/12] builtin-run: Add arch hook to validate VM configuration

2022-06-16 Thread Alexandru Elisei
Architectures are free to set their own command line options. Add an architecture specific hook to validate these options. For now, the hook does nothing, but it will be used in later patches. Signed-off-by: Alexandru Elisei --- Makefile | 1 + arm/aarch32/kvm.c | 5 + arm/aarch64

[PATCH v4 kvmtool 03/12] builtin-run: Rework RAM size validation

2022-06-16 Thread Alexandru Elisei
-by: Andre Przywara Signed-off-by: Alexandru Elisei --- builtin-run.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/builtin-run.c b/builtin-run.c index 2bf93fe13c92..e1770b3c9df2 100644 --- a/builtin-run.c +++ b/builtin-run.c @@ -509,6 +509,8 @@ static void

[PATCH v4 kvmtool 02/12] builtin-run: Always use RAM size in bytes

2022-06-16 Thread Alexandru Elisei
out the unit of measurement, especially once the user is allowed to specify the unit of measurement, always use ram_size in bytes. Signed-off-by: Alexandru Elisei --- builtin-run.c| 19 ++- include/kvm/kvm-config.h | 7 --- include/kvm/kvm.h| 2 +- 3 fi

[PATCH v4 kvmtool 01/12] Use MB for megabytes consistently

2022-06-16 Thread Alexandru Elisei
bytes instead of 2^20. Signed-off-by: Alexandru Elisei --- Documentation/kvmtool.1 | 4 ++-- builtin-run.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/kvmtool.1 b/Documentation/kvmtool.1 index 2b8c274dc3ff..25d46f8f51f9 100644 --- a/Documentation

[PATCH v4 kvmtool 00/12] arm64: Allow the user to set RAM base address

2022-06-16 Thread Alexandru Elisei
v4 [2] https://lkml.kernel.org/kvm/1569245722-23375-1-git-send-email-alexandru.eli...@arm.com/ Alexandru Elisei (9): Use MB for megabytes consistently builtin-run: Always use RAM size in bytes builtin-run: Rework RAM size validation builtin-run: Add arch hook to validate VM configura

Re: [PATCH v3 kvmtool 02/13] sizes.h: Make all sizes 64bit

2022-06-15 Thread Alexandru Elisei
Hi, On Mon, May 30, 2022 at 04:05:17PM +0100, Andre Przywara wrote: > On Wed, 25 May 2022 12:23:34 +0100 > Alexandru Elisei wrote: > > Hi, > > > Append ULL to all of the size definitions to make them 64bit and avoid > > overflows. > > I am not fully co

Re: [PATCH v2 11/19] KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set

2022-06-15 Thread Alexandru Elisei
Hi, On Fri, Jun 10, 2022 at 10:28:30AM +0100, Marc Zyngier wrote: > The ON_UNSUPPORTED_CPU flag is only there to track the sad fact > that we have ended-up on a CPU where we cannot really run. > > Since this is only for the host kernel's use, move it to the state > set. > > Reviewed-by: Fuad

  1   2   3   4   5   6   7   8   9   10   >