Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp11871pxv; Wed, 21 Jul 2021 14:05:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPMExeSX1h42qrz9vsO/uf1s9gUfAIiQu73riShu8cjefXs8UWmh5OpfHDiQYiOajBN0BZ X-Received: by 2002:a02:94e5:: with SMTP id x92mr32583504jah.107.1626901415093; Wed, 21 Jul 2021 14:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626901415; cv=none; d=google.com; s=arc-20160816; b=xrGkiMkakQzsbG8lHvKRfoAgE9CM48grYTBoFvt/C1ZQCSMgn+3QQNCWmR23JcwXLi TWp/94+wCs/MQQFV3chyBNE5f/UWklCbqKqQndLJDaPVS+AuBXaNzlvfYfbx97LLOzGZ YoIiHpFNKchEEpVDa9SlqauV/mKz6K2RLTcfFIG3J/xYZ60iB10O7gBB8vus7Pkwarrc /6WvQi3Qd7pD+YIikXkPmDOJl1Y3z6A7m+2MBN64IhUNdco3Ow8XSuDrrPlHFDeMehSk 8BvEmVCd3bihvTJRnP9g/2itmal7XOKEA9PdsIWQiDqvMWQyEtOdIdEiqt58PslQ2SD5 Pj6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AxTvururg15eAgQqT/Vw3IaCmq/AtpICOLNE7tzoQWM=; b=q73YwX2HCuVhsHaYqt19WIFUp3rS8ewUQ0OnaM+S0AO1IS98qBJXjRl/tEmIqjPsPL qE/dg362zSlPHqyRI92VELs5D5bR7jzrgWrG9cUUrpu6iAki0hjkzAN2h6+PeoctbS8K wXlgVgr6aeFLcHPVBlqERJCCuWSk4Q6gNx5lPL/Tbbq07GP4Gwo4BumH6WPErTW0UAWF yUw/DFMq/SPVe01LdJJwNpa1H73fwm6uvK9Xvp2nznC7opt5uCgln1QRFNP5kpS89TsA 7e2+hqxi0acaRVkk9hs2WZotq2Q9rAPGOGjqM6cKVUHOPijX5ont7WZaVs4HsdrVt09R PKUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0WASEAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si7577618ioc.54.2021.07.21.14.03.23; Wed, 21 Jul 2021 14:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0WASEAs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236545AbhGURGW (ORCPT + 99 others); Wed, 21 Jul 2021 13:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236498AbhGURGV (ORCPT ); Wed, 21 Jul 2021 13:06:21 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04332C061757 for ; Wed, 21 Jul 2021 10:46:57 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id gb6so4479841ejc.5 for ; Wed, 21 Jul 2021 10:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AxTvururg15eAgQqT/Vw3IaCmq/AtpICOLNE7tzoQWM=; b=s0WASEAsAruBpiL/ESXJp2VeA5h+VTH0uEnk+LjAD3MHgy72GUAmI0zBPcvrD8s0SA BWd9ei0B8Hv1rK7VYNbIu6CBlaBhnbfO64qTWXLIdQniLZyup1q2j9Bl5Ub6BeGijcX8 o2GowuJAhyePRBqL1PylmSGGCsNgtoGiloJFlPnxkrNT2U81r5Mxayn2fG2GDKvW/6Wr JHGyMNfwDGxoCXuUwC54Cph9OIE9di/Zn5VNuNjuxY1xSE8IY6oZOFZOwV1+s5UgN5EL WdegzQ2TXCJbEAUWTyI+Nys4iqZoAnBRb0CZnuj1SZTVekfvqquMS7B2ygo0sDqp4kYi SlKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AxTvururg15eAgQqT/Vw3IaCmq/AtpICOLNE7tzoQWM=; b=Hi04sIyZqKnU2I3DuS6CQ6atJnG92VOhKB+Si2dUTPZgVZEJGJniHk8nVuxGJw0fTA zquEJRax92k3+V0asWG1LRbyBu6rBrEJc72TxDmwDcgE28RtcJ+FktBNplgfeshxrsIs 8y9Fww7+J6gVabei9JvoUJjhr0i3OhdirBPSb6na7rxHglF3gDDZmfJUgUOVYGZB+D39 qnoXxV1ShzSLcw/iph+QtSdOE24Q+UnFdi7AUxJYfhf56S76jvg3mIcoXlz6QeaRe0Zz pPSUaXfp5pd3yO3YFFWyBQHMtgtp5AyHwqzDUX4Z2U1CUFaLfpD8dhGj5wmoV00qMXJJ PyGg== X-Gm-Message-State: AOAM531Po77/NxgFvgmKdtjq16IPEcAGgmv2BcX2rYlKcef7vYhIfk4U dP2uP0idPzzNepffj6SZkAEo/A== X-Received: by 2002:a17:907:170c:: with SMTP id le12mr41029420ejc.288.1626889615495; Wed, 21 Jul 2021 10:46:55 -0700 (PDT) Received: from myrica (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id qo6sm8570087ejb.122.2021.07.21.10.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 10:46:55 -0700 (PDT) Date: Wed, 21 Jul 2021 19:46:34 +0200 From: Jean-Philippe Brucker To: Oliver Upton Cc: Alexandru Elisei , salil.mehta@huawei.com, lorenzo.pieralisi@arm.com, kvm@vger.kernel.org, corbet@lwn.net, maz@kernel.org, linux-kernel@vger.kernel.org, jonathan.cameron@huawei.com, catalin.marinas@arm.com, pbonzini@redhat.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 0/5] KVM: arm64: Pass PSCI to userspace Message-ID: References: <20210608154805.216869-1-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 12:37:52PM -0700, Oliver Upton wrote: > On Mon, Jul 19, 2021 at 11:02 AM Jean-Philippe Brucker > wrote: > > We forward the whole PSCI function range, so it's either KVM or userspace. > > If KVM manages PSCI and the guest calls an unimplemented function, that > > returns directly to the guest without going to userspace. > > > > The concern is valid for any other range, though. If userspace enables the > > HVC cap it receives function calls that at some point KVM might need to > > handle itself. So we need some negotiation between user and KVM about the > > specific HVC ranges that userspace can and will handle. > > Are we going to use KVM_CAPs for every interesting HVC range that > userspace may want to trap? I wonder if a more generic interface for > hypercall filtering would have merit to handle the aforementioned > cases, and whatever else a VMM will want to intercept down the line. > > For example, x86 has the concept of 'MSR filtering', wherein userspace > can specify a set of registers that it wants to intercept. Doing > something similar for HVCs would avoid the need for a kernel change > each time a VMM wishes to intercept a new hypercall. Yes we could introduce a VM device group for this: * User reads attribute KVM_ARM_VM_HVC_NR_SLOTS, which defines the number of available HVC ranges. * User writes attribute KVM_ARM_VM_HVC_SET_RANGE with one range struct kvm_arm_hvc_range { __u32 slot; #define KVM_ARM_HVC_USER (1 << 0) /* Enable range. 0 disables it */ __u16 flags; __u16 imm; __u32 fn_start; __u32 fn_end; }; * KVM forwards any HVC within this range to userspace. * If one of the ranges is PSCI functions, disable KVM PSCI. Since it's more work for KVM to keep track of ranges, I didn't include it in the RFC, and I'm going to leave it to the next person dealing with this stuff :) Thanks, Jean