Re: [PATCH v6 06/21] arm64: Move VHE-specific SPE setup to mutate_to_vhe()

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 09:30:08AM +, Marc Zyngier wrote: > Hi Will, > > On 2021-02-03 21:13, Will Deacon wrote: > > Hi Marc, > > > > On Mon, Feb 01, 2021 at 11:56:22AM +, Marc Zyngier wrote: > > > There isn't much that a VHE kernel needs on top of whatever has > > > been done for nVHE,

Re: [PATCH v6 06/21] arm64: Move VHE-specific SPE setup to mutate_to_vhe()

2021-02-04 Thread Marc Zyngier
Hi Will, On 2021-02-03 21:13, Will Deacon wrote: Hi Marc, On Mon, Feb 01, 2021 at 11:56:22AM +, Marc Zyngier wrote: There isn't much that a VHE kernel needs on top of whatever has been done for nVHE, so let's move the little we need to the VHE stub (the SPE setup), and drop the

Re: [PATCH v6 06/21] arm64: Move VHE-specific SPE setup to mutate_to_vhe()

2021-02-04 Thread Marc Zyngier
On 2021-02-04 09:34, Will Deacon wrote: On Thu, Feb 04, 2021 at 09:30:08AM +, Marc Zyngier wrote: [...] I think the following patch addresses the above issue, which I'll squash with the original patch. Please shout if I missed anything. Thanks, M. diff --git

Re: [PATCH v2 6/7] KVM: arm64: Upgrade PMU support to ARMv8.4

2021-02-04 Thread Alexandru Elisei
Hi, On 2/3/21 1:28 PM, Marc Zyngier wrote: > On 2021-02-03 12:39, Auger Eric wrote: >> Hi, >> >> On 2/3/21 12:20 PM, Marc Zyngier wrote: >>> On 2021-02-03 11:07, Auger Eric wrote: Hi Marc, On 2/3/21 11:36 AM, Marc Zyngier wrote: > Hi Eric, > > On 2021-01-27 17:53, Auger Eric

Re: [PATCH v7 2/3] arm64: kvm: Introduce MTE VCPU feature

2021-02-04 Thread Steven Price
On 02/02/2021 17:12, Marc Zyngier wrote: On 2021-01-15 15:28, Steven Price wrote: Add a new VM feature 'KVM_ARM_CAP_MTE' which enables memory tagging for a VM. This exposes the feature to the guest and automatically tags memory pages touched by the VM as PG_mte_tagged (and clears the tags

Re: [PATCH v7 1/3] arm64: kvm: Save/restore MTE registers

2021-02-04 Thread Steven Price
On 02/02/2021 15:36, Marc Zyngier wrote: On 2021-01-15 15:28, Steven Price wrote: Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet. Signed-off-by: Steven Price ---  

Re: [PATCH v2 6/7] KVM: arm64: Upgrade PMU support to ARMv8.4

2021-02-04 Thread Marc Zyngier
On 2021-02-04 12:32, Alexandru Elisei wrote: Hi, On 2/3/21 1:28 PM, Marc Zyngier wrote: On 2021-02-03 12:39, Auger Eric wrote: Hi, On 2/3/21 12:20 PM, Marc Zyngier wrote: On 2021-02-03 11:07, Auger Eric wrote: Hi Marc, On 2/3/21 11:36 AM, Marc Zyngier wrote: Hi Eric, On 2021-01-27 17:53,

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > > > + * __find_buddy(pool, page 0, order 0) => page 1 > > > + * __find_buddy(pool, page 0,

Re: [RFC PATCH v2 17/26] KVM: arm64: Elevate Hyp mappings creation at EL2

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 15:31:39 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:15PM +, Quentin Perret wrote: > > Previous commits have introduced infrastructure at EL2 to enable the Hyp > > code to manage its own memory, and more specifically its stage 1 page > > tables.

Re: [RFC PATCH v2 24/26] KVM: arm64: Make memcache anonymous in pgtable allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 02:24:44PM +, Quentin Perret wrote: > On Wednesday 03 Feb 2021 at 15:59:44 (+), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:22PM +, Quentin Perret wrote: > > > The current stage2 page-table allocator uses a memcache to get > > > pre-allocated pages when

Re: [RFC PATCH v2 26/26] KVM: arm64: Wrap the host with a stage 2

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 02:26:35PM +, Quentin Perret wrote: > On Wednesday 03 Feb 2021 at 16:11:47 (+), Will Deacon wrote: > > On Fri, Jan 08, 2021 at 12:15:24PM +, Quentin Perret wrote: > > > When KVM runs in protected nVHE mode, make use of a stage 2 page-table > > > to give the

Re: [RFC PATCH v2 16/26] KVM: arm64: Prepare Hyp memory protection

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 14:37:10 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:14PM +, Quentin Perret wrote: > > +static inline unsigned long __hyp_pgtable_max_pages(unsigned long nr_pages) > > +{ > > + unsigned long total = 0, i; > > + > > + /* Provision the worst case

Re: [PATCH v7 1/3] arm64: kvm: Save/restore MTE registers

2021-02-04 Thread Marc Zyngier
On 2021-02-04 14:33, Steven Price wrote: On 02/02/2021 15:36, Marc Zyngier wrote: On 2021-01-15 15:28, Steven Price wrote: Define the new system registers that MTE introduces and context switch them. The MTE feature is still hidden from the ID register as it isn't supported in a VM yet.

Re: [RFC] Use SMMU HTTU for DMA dirty page tracking

2021-02-04 Thread Keqian Zhu
Hi Jean and Kevin, FYI, I have send out the SMMUv3 HTTU support for DMA dirty tracking[1] a week ago. Thanks, Keqian [1] https://lore.kernel.org/linux-iommu/20210128151742.18840-1-zhukeqi...@huawei.com/ On 2020/5/27 17:14, Jean-Philippe Brucker wrote: > On Wed, May 27, 2020 at 08:40:47AM

RE: [RFC] Use SMMU HTTU for DMA dirty page tracking

2021-02-04 Thread Tian, Kevin
> From: Keqian Zhu > Sent: Friday, February 5, 2021 11:31 AM > > Hi Jean and Kevin, > > FYI, I have send out the SMMUv3 HTTU support for DMA dirty tracking[1] a > week ago. > > Thanks, > Keqian > > [1] https://lore.kernel.org/linux-iommu/20210128151742.18840-1- > zhukeqi...@huawei.com/

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > Just feels a bit backwards having __find_buddy() take an order parameter, > yet then return a page of the wrong order! __hyp_extract_page() always > passes the p->order as the order, Gotcha, so maybe this is just a naming problem.

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 18:24:05 (+), Will Deacon wrote: > On Thu, Feb 04, 2021 at 06:19:36PM +, Quentin Perret wrote: > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > Just feels a bit backwards having __find_buddy() take an order parameter, > > > yet then

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 17:48:49 (+), Will Deacon wrote: > On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > > > On Tuesday 02 Feb 2021

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 18:13:18 (+), Will Deacon wrote: > I was going from memory, but the loop in __hyp_alloc_pages() searches up to > HYP_MAX_ORDER, whereas this is _never_ going to succeed beyond some per-pool > order determined by the size of the pool. But I doubt it matters -- I >

Re: [RFC PATCH v2 21/26] KVM: arm64: Refactor kvm_arm_setup_stage2()

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 15:53:54 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:19PM +, Quentin Perret wrote: > > In order to re-use some of the stage 2 setup at EL2, factor parts of > > kvm_arm_setup_stage2() out into static inline functions. > > > > No functional change

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 06:01:12PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 17:48:49 (+), Will Deacon wrote: > > On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > > > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > > > On Wed, Feb 03, 2021

Re: [RFC PATCH v2 23/26] KVM: arm64: Refactor __populate_fault_info()

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 15:58:32 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:21PM +, Quentin Perret wrote: > > Refactor __populate_fault_info() to introduce __get_fault_info() which > > will be used once the host is wrapped in a stage 2. > > > > Signed-off-by: Quentin

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Quentin Perret
On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > > On Fri, Jan 08, 2021 at 12:15:10PM +, Quentin Perret wrote: > > > > + *

Re: [RFC PATCH 06/11] iommu/arm-smmu-v3: Scan leaf TTD to sync hardware dirty log

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun During dirty log tracking, user will try to retrieve dirty log from iommu if it supports hardware dirty log. This adds a new interface named sync_dirty_log in iommu layer and arm smmuv3 implements it, which scans leaf TTD and treats it's

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 06:19:36PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > Just feels a bit backwards having __find_buddy() take an order parameter, > > yet then return a page of the wrong order! __hyp_extract_page() always > > passes the

Re: [RFC PATCH v2 24/26] KVM: arm64: Make memcache anonymous in pgtable allocator

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 15:59:44 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:22PM +, Quentin Perret wrote: > > The current stage2 page-table allocator uses a memcache to get > > pre-allocated pages when it needs any. To allow re-using this code at > > EL2 which uses a

Re: [PATCHv2] kvm: arm64: Add SVE support for nVHE.

2021-02-04 Thread Dave Martin
On Tue, Feb 02, 2021 at 07:52:54PM +0100, Daniel Kiss wrote: > CPUs that support SVE are architecturally required to support the > Virtualization Host Extensions (VHE), so far the kernel supported > SVE alongside KVM with VHE enabled. In same cases it is desired to > run nVHE config even when VHE

Re: [RFC PATCH v2 12/26] KVM: arm64: Introduce a Hyp buddy page allocator

2021-02-04 Thread Will Deacon
On Thu, Feb 04, 2021 at 02:52:52PM +, Quentin Perret wrote: > On Thursday 04 Feb 2021 at 14:31:08 (+), Will Deacon wrote: > > On Wed, Feb 03, 2021 at 06:33:30PM +, Quentin Perret wrote: > > > On Tuesday 02 Feb 2021 at 18:13:08 (+), Will Deacon wrote: > > > > On Fri, Jan 08, 2021 at

Re: [RFC PATCH 04/11] iommu/arm-smmu-v3: Split block descriptor to a span of page

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun Block descriptor is not a proper granule for dirty log tracking. This adds a new interface named split_block in iommu layer and arm smmuv3 implements it, which splits block descriptor to an equivalent span of page descriptors. During

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun The SMMU which supports HTTU (Hardware Translation Table Update) can update the access flag and the dirty state of TTD by hardware. It is essential to track dirty pages of DMA. This adds feature detection, none functional change.

Re: [RFC PATCH v2 26/26] KVM: arm64: Wrap the host with a stage 2

2021-02-04 Thread Quentin Perret
On Wednesday 03 Feb 2021 at 16:11:47 (+), Will Deacon wrote: > On Fri, Jan 08, 2021 at 12:15:24PM +, Quentin Perret wrote: > > When KVM runs in protected nVHE mode, make use of a stage 2 page-table > > to give the hypervisor some control over the host memory accesses. At > > the moment all

Re: [RFC PATCH 05/11] iommu/arm-smmu-v3: Merge a span of page to block descriptor

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun When stop dirty log tracking, we need to recover all block descriptors which are splited when start dirty log tracking. This adds a new interface named merge_page in iommu layer and arm smmuv3 implements it, which reinstall block