From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24EC8C001DB for ; Mon, 14 Aug 2023 09:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References: Cc:To:Subject:MIME-Version:Date:Message-ID:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pcBa1KZAo+NHPDzYcvx8gHF4cgSFmgyHn6/jW10feUg=; b=CUlLGpPBpAkyCi PNVFRanzeMKuMp2kyuEV/in14edNjop+f+5CmEQHP5OZkcyplfr7OSkI2klEMiWIOZqHUozqwD2/W lzaDDHo+bmqWYiKGuXpcB/erqMIcEjSw5jG+CMQ/NRfC8dhqGxDnzfeVR4W3IMEzRBZDk6PLI6rXl nHkmEsn9MXYX8Qv0cSyC7hctgmKdE51IMC+1OgtGlCDWzQA6u4ZscriobpGkKf8MXObLtR9MTfMBX X19txV0+NlEjxX9MaFpjQyTLP2HLW3qUCd+Wz7ceaxtypYSO5TS8V4fGnCKb4Pa0M62pPnjLdgj8y AVzy8B1rygHCjFABaWQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVU1P-00GdEV-3B; Mon, 14 Aug 2023 09:37:59 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVU1N-00GdDf-18 for linux-arm-kernel@lists.infradead.org; Mon, 14 Aug 2023 09:37:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692005875; 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=6UMVQwV2rUoWUqSvlE90BxYjgE4xdcHRUCKaIBUbHGo=; b=Jt+M32043plOnZhw+E77zRmfeRvIUZiuixLScktx3FOT4srSBaq1AbR4tS9C9geSBMwGqB z2FDi5sUObkug7pZJo11ErlpwB+ReIFLMXKbTBUz9I97Di1NMp15paFwqfmAqc76rlfBjg YC43i0nhU4Ssm7sAcXBhXU76zbmzREA= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-509-ucGjIIUuMxagYvpg4aUuuA-1; Mon, 14 Aug 2023 05:37:53 -0400 X-MC-Unique: ucGjIIUuMxagYvpg4aUuuA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4103d071083so38655851cf.2 for ; Mon, 14 Aug 2023 02:37:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692005873; x=1692610673; 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=6UMVQwV2rUoWUqSvlE90BxYjgE4xdcHRUCKaIBUbHGo=; b=at0BbbeG/1O6tFuNbzYL3bKORyhaZlfMYTBdgwo6WqKWaPZt0u2PA0SOkN3+AnztWC RLby6ndU0W6rTzPj//cYPNqLORvlDcUoma475JPrDJ9fc/a0ujgX1RkRIM/2az8nUz9P yY79qP7lRaTI6PQfAMAXw+maNHBBcMu2YicSHBrsC5H3xqVQYshIUD5P/eUpfXvbdvxa GO6J1GZLEciZOMHc+50Pi9Pqxq6NLfdaQhX7/DR9ivWN2oljf/4hLivVcML+wHkUEnDz RgMU0Q2M3bnKTQLn1xh4ZTe+o8Fpvy8GLT2HyewkPGaI0bncOyCfAQ3d81NaaNF/2/Dy PY7g== X-Gm-Message-State: AOJu0Yz73jRPanjD4IkP+VBWpvOcJUGC3fLFI+qWkZ4oxxeHoyKQQZXX LOrSOcqbofjHwhsG4TggAs3B/wD1azeb3entbxaWOQMyWqS+wmQnEk3mZoyuigAXvsnssZhE48g uCYIbcA9IsLCYzGMhs5amTgnhX6B+8cXQh1A= X-Received: by 2002:ac8:570a:0:b0:403:6ac5:e761 with SMTP id 10-20020ac8570a000000b004036ac5e761mr12853500qtw.62.1692005873555; Mon, 14 Aug 2023 02:37:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0lAfb5V+jcAmkdMUWENM/cDVWzSccIaYQkbJhIrzb3dcQbbMk8WUbXBkdEvwwlbiesHpERA== X-Received: by 2002:ac8:570a:0:b0:403:6ac5:e761 with SMTP id 10-20020ac8570a000000b004036ac5e761mr12853490qtw.62.1692005873339; Mon, 14 Aug 2023 02:37:53 -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 j14-20020a0ce00e000000b00646e0411e8csm1728993qvk.30.2023.08.14.02.37.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 02:37:52 -0700 (PDT) Message-ID: Date: Mon, 14 Aug 2023 11:37:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v3 23/27] KVM: arm64: nv: Add SVC trap forwarding To: Marc Zyngier , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Mark Brown , Mark Rutland , Will Deacon , Alexandru Elisei , Andre Przywara , Chase Conklin , Ganapatrao Kulkarni , Darren Hart , Miguel Luis , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu References: <20230808114711.2013842-1-maz@kernel.org> <20230808114711.2013842-24-maz@kernel.org> From: Eric Auger In-Reply-To: <20230808114711.2013842-24-maz@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230814_023757_465618_3FAE32EB X-CRM114-Status: GOOD ( 18.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: eric.auger@redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marc, On 8/8/23 13:47, Marc Zyngier wrote: > HFGITR_EL2 allows the trap of SVC instructions to EL2. Allow these > traps to be forwarded. Take this opportunity to deny any 32bit activity > when NV is enabled. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/arm.c | 4 ++++ > arch/arm64/kvm/handle_exit.c | 12 ++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 72dc53a75d1c..8b51570a76f8 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -818,6 +819,9 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcpu) > if (likely(!vcpu_mode_is_32bit(vcpu))) > return false; > > + if (vcpu_has_nv(vcpu)) > + return true; > + > return !kvm_supports_32bit_el0(); > } > > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index 6dcd6604b6bc..3b86d534b995 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -226,6 +226,17 @@ static int kvm_handle_eret(struct kvm_vcpu *vcpu) > return 1; > } > > +static int handle_svc(struct kvm_vcpu *vcpu) > +{ > + /* > + * So far, SVC traps only for NV via HFGITR_EL2. A SVC from a > + * 32bit guest would be caught by vpcu_mode_is_bad_32bit(), so > + * we should only have to deal with a 64 bit exception. > + */ > + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_esr(vcpu)); > + return 1; > +} > + > static exit_handle_fn arm_exit_handlers[] = { > [0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec, > [ESR_ELx_EC_WFx] = kvm_handle_wfx, > @@ -239,6 +250,7 @@ static exit_handle_fn arm_exit_handlers[] = { > [ESR_ELx_EC_SMC32] = handle_smc, > [ESR_ELx_EC_HVC64] = handle_hvc, > [ESR_ELx_EC_SMC64] = handle_smc, > + [ESR_ELx_EC_SVC64] = handle_svc, > [ESR_ELx_EC_SYS64] = kvm_handle_sys_reg, > [ESR_ELx_EC_SVE] = handle_sve, > [ESR_ELx_EC_ERET] = kvm_handle_eret, Reviewed-by: Eric Auger Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel