Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2386245rdg; Mon, 16 Oct 2023 02:52:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPlXh2Uhc8y9VLKrZkzbT+tFoMaf/Z2W3Wsw6++8g96clp2O73nmApdGHvy1uVayj7vEtA X-Received: by 2002:aca:1a03:0:b0:3ae:17af:738f with SMTP id a3-20020aca1a03000000b003ae17af738fmr34308403oia.45.1697449967818; Mon, 16 Oct 2023 02:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697449967; cv=none; d=google.com; s=arc-20160816; b=xlgicqqIz5YFf9aiHlnFwZWUjOPoj40iWMBzlcerNRIXWQ+R/6ruAQDyugRC9Hwu1s AvPoAbWysaLyTup2FORKF2NvBXu7Dt4kShpb1aJez2Cgk0ZJzFC+DjAzW1ffslDk5WqK xELf7VxR2Sty0qCsAcqLgu1surU0EBjDYpGXtlHrbmnQdyCyZlNHLQe7HFs2capMZOv4 fw/HykvB8KEHHWHhs1GTZEvvGytziORrk78HcRtSflpXX3TJ/NXGQH6p3KVGBwT5cSl2 hG9qQel0ftW0kk8n5xc4baB/adVmdfng4ugcXJjSenNZZHYWo34TXjXyUvUQh0oyXHFi pzTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:reply-to:user-agent :mime-version:date:message-id:dkim-signature; bh=Fj634e+VaD+ebYjjG6WWajLk8f8HNx2dl58LD2RwMjg=; fh=nP7TzuPmNItD7cijwgLSuAM1pTGqR/+HMZE9fPJLN7k=; b=gJ8ldE2He1Ylr2Oc5ljBw8Ow/C4TI3MQw2lTNfBu9EYkNGYctlaVNH8UTPxYAVlgTb vktVGXqPuxT/D+kRDr2ZDFUsqGNQV5/j1+0cGC31zfwQAG7N4NUagTJuotJen8ZJkKHm kl8TnQ4MEPi2ArogiGdtF5bTV7jZbLDs8Zux69CZ9EMybBplc3YyVyNO6Tu7Ul15shsq Kl9cmphxyEivPFoPcCNqTGmzN9MIBZZElaALEXt/XRq/6gGMRc6YeWH8/q2p3TtzAmGD ARJtQPEWSFifBj9qnhw1U4RztbRy/Ve/LkhdaF8lqazmCD0pmPLYV/uRMbohtNDEB0dD Yq5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZIetIRVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x5-20020a654145000000b00584e65212d4si9938421pgp.609.2023.10.16.02.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 02:52:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZIetIRVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D902380B2323; Mon, 16 Oct 2023 02:52:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbjJPJwp (ORCPT + 99 others); Mon, 16 Oct 2023 05:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjJPJwn (ORCPT ); Mon, 16 Oct 2023 05:52:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB9AE8 for ; Mon, 16 Oct 2023 02:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697449913; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fj634e+VaD+ebYjjG6WWajLk8f8HNx2dl58LD2RwMjg=; b=ZIetIRVjByNZZ6KgzMvOwe0H8n5LaBdofIHtT8Xv++/iv4zgwFNX121/tLYcFConYQiLjf 5Y1rxPPoauoJ5Cei13aHLH6c6r2ovYJHNgk199cPNwrTekNBu7wpGZoizJcY10Np5elXtR sS+xQ4wuYDMh/7k9Cx6hln9+UTBd7IE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-644-GloTaaQNOSOA6XGMQlSs5g-1; Mon, 16 Oct 2023 05:51:52 -0400 X-MC-Unique: GloTaaQNOSOA6XGMQlSs5g-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-65afd7515aaso50400156d6.0 for ; Mon, 16 Oct 2023 02:51:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697449911; x=1698054711; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fj634e+VaD+ebYjjG6WWajLk8f8HNx2dl58LD2RwMjg=; b=UNSSjH1O0ThPJcgPQoKCX4d3E4mA+kDmk9758pE/noZVCQop7to6c6kKT9S+qXe8uS hn6C1xsFWXbCo/Qr4abxOcCV3V95ux0dHp/+olUzHTqZBcnQJTVZtufkcvgWlbt4CMfB 91OAre7s6Ecgb/CN3YuYXjkJClOdq8kbqm1Zctf5sAEIe60yQ8qYR/CBHUHsxMvTPSlO UZTF3iX1NxcSX63l3XQpQwVsvuGz89Lng5t1n58a2Xbae9rme5s/pvKXuU7JlGV62RgS DRgooCqbzykHjJ99KrTjk4iG+UJDOM5BM0wJfLC0xRA3Izze1nCBNbwuCDhLCQ7e4NYn XbjA== X-Gm-Message-State: AOJu0YxLvlLNObAMzeWSxJ/ifeQ/rF90/NCkYnJ+BHElCFXcZGBhwr1B 0U0MstNo9Ft/7A+SB+az1+k1TZoK8Dzw50ruQ0R1hrKCqpZzCDAXwUrcVhTr+Bd6hgR/IoZvgE0 sCQuynDazTWA/W+zTIdZ0sl2g X-Received: by 2002:ac8:5916:0:b0:410:90c7:5185 with SMTP id 22-20020ac85916000000b0041090c75185mr42288208qty.54.1697449911580; Mon, 16 Oct 2023 02:51:51 -0700 (PDT) X-Received: by 2002:ac8:5916:0:b0:410:90c7:5185 with SMTP id 22-20020ac85916000000b0041090c75185mr42288195qty.54.1697449911350; Mon, 16 Oct 2023 02:51:51 -0700 (PDT) Received: from ?IPV6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id v8-20020a05622a188800b00418142e802bsm2904361qtc.6.2023.10.16.02.51.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 02:51:50 -0700 (PDT) Message-ID: <47f2d130-c077-d3fe-e0ea-6bb7c86190a0@redhat.com> Date: Mon, 16 Oct 2023 11:51:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Reply-To: eric.auger@redhat.com Subject: Re: [PATCH v3 3/3] arm64/kvm: Fine grain _EL2 system registers list that affect nested virtualization Content-Language: en-US To: Marc Zyngier Cc: Miguel Luis , Catalin Marinas , Will Deacon , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Jing Zhang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev References: <20231011180103.91774-1-miguel.luis@oracle.com> <20231011180103.91774-4-miguel.luis@oracle.com> <7df53e6b-9141-de85-b7a3-b9eb092ef7b4@redhat.com> From: Eric Auger In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 02:52:47 -0700 (PDT) Hi Marc, On 10/12/23 22:36, Marc Zyngier wrote: > On 2023-10-12 16:22, Eric Auger wrote: >> Hi Miguel, >> >> On 10/11/23 20:01, Miguel Luis wrote: >>> Implement a fine grained approach in the _EL2 sysreg ranges. >>> >>> Fixes: d0fc0a2519a6 ("KVM: arm64: nv: Add trap forwarding for HCR_EL2") >>> Signed-off-by: Miguel Luis >>> --- >>>  arch/arm64/kvm/emulate-nested.c | 88 ++++++++++++++++++++++++++++++--- >>>  1 file changed, 82 insertions(+), 6 deletions(-) >>> >>> diff --git a/arch/arm64/kvm/emulate-nested.c >>> b/arch/arm64/kvm/emulate-nested.c >>> index 9ced1bf0c2b7..3af49e130ee6 100644 >>> --- a/arch/arm64/kvm/emulate-nested.c >>> +++ b/arch/arm64/kvm/emulate-nested.c >>> @@ -648,15 +648,91 @@ static const struct encoding_to_trap_config >>> encoding_to_cgt[] __initconst = { >>>      SR_TRAP(SYS_APGAKEYLO_EL1,    CGT_HCR_APK), >>>      SR_TRAP(SYS_APGAKEYHI_EL1,    CGT_HCR_APK), >>>      /* All _EL2 registers */ >>> -    SR_RANGE_TRAP(sys_reg(3, 4, 0, 0, 0), >>> -              sys_reg(3, 4, 3, 15, 7), CGT_HCR_NV), >>> +    SR_TRAP(SYS_VPIDR_EL2,        CGT_HCR_NV), >> I think you miss DBGVCR32_EL2 > > I don't think this register should be part of this list. We don't > support AArch32 with NV, and the spec says that DBGVCR32_EL2 UNDEFs > when EL1 doesn't support AArch32. > > So the change that needs to happen is to inject an UNDEF when trapping > a DBGVCR32_EL2and not forward the trap to the guest. OK this makes sense Thanks Eric > > Thanks, > >         M.