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 AF81EC433EF for ; Mon, 4 Apr 2022 23:20:44 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WjjIlJstD1bmPBWkRwEgT+esnmKidpsx0M4czKT11yY=; b=DgaCZkkbExiEyM eCKwEVNLgomw63iS43UTelsV00LvgcXahKpflfu4UwBxreqJNyvwqYAdHS6bp33WPvq81a9gfh5Xb +g+44IrdSdeRm+7/uCsZwFA+kROpdCCtI2OEuQXvwlsd/b+mPUYhjxYrzFKrf4zU+cpJLBwdOHUPY umm0d21Z66a1R1IM1LxRiAUmi5MgVZ4l7mqYPM4YhcMOokbhvxCK5ffSC6sOHOYCj0QyRn0yXQxkR LelniGDEtMor7banwrq+mzh4RPhzIfl2CZ3W6OdM4dMXRGawl3bwYA1+bxu5QW0nFdFWPaYafQx1g qrYdL3k58f/VwQs9dvTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbVyy-00Gg1B-1X; Mon, 04 Apr 2022 23:19:36 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbVyu-00Gfzn-Tv for linux-arm-kernel@lists.infradead.org; Mon, 04 Apr 2022 23:19:34 +0000 Received: by mail-io1-xd30.google.com with SMTP id p22so13241547iod.2 for ; Mon, 04 Apr 2022 16:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4HQuxb/8RWMSgNIJitUFJzaBlGJWxUNK7LO21+WkcG4=; b=Et2iWkTnW2r9yego6aq6wuHaWBZ4EPhFdAlYbpl3fySBWEZ2suJ7cmpKbqAZVDEYJV penv5MLm4ibzzjyZiCG+sRGdi8Owm7364yw8WjIBdlTFlfXoBJO7+FNNr9McLPDqsk/+ Wk3JJz1J8PkUOamRTT2csAmTyuLOZGX07uWOwgNGZ1je/MbzCba3qb/ZUCyBExVSbyUT pMee689hFU90nSNMhNGDq3sULdZzSgRygc/zJleZXc6y0m6EZ+663aM9zSvn4AgP6AsS 4zwbH01jcZUOsOFgfWw1EUdI9wee7r/o5gNsIU9levXCN6L9MQE2pBXPeWowZWRd2Rr2 JePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4HQuxb/8RWMSgNIJitUFJzaBlGJWxUNK7LO21+WkcG4=; b=WBaPB2kRrMmlm89QiTM+UvSRcr+MvonDc1kXEWd6wOhtRJRbwVENZbMvFfm4HBE4tm 5Ddk+KQmvo9eW6oUPcE5mKg03hm0pmw+xlIgnsACEjW9xxen6jXfktyABHQ1ElV8hTRJ WkKLpo9qloQWQPbUmnRsTOinivCB0Vc7Qu/7vJwlea0VYHF654+qmW9OT2HRvFxi7SAr QAvDEzLKJQDduhyIEI9vXxsdC6YFTl8jA2p9PTgr15KOdFzePQEViPFcfYdksWxma3Gi 8EXswkFiU+p8sqRAp395GbzqBqccHaWBjFtaOC/0y28SCH1c4sNP4DE2Hn/4M4saSAt8 NHOw== X-Gm-Message-State: AOAM533gwCyw5w4+aRspUsT+r0g3Q/KpeYGVv/mlBdUGS+9RaKbhXKIR puEKkucZREWzc1cQxjhUknXU7g== X-Google-Smtp-Source: ABdhPJybHp4SBT2pqY9bfoXsSLyxE3+imCY7mtDDFkk9g25hqxAWHP1Ohh8UmDjlZHjJtCgPNsazsQ== X-Received: by 2002:a05:6602:80a:b0:649:f33:ecb2 with SMTP id z10-20020a056602080a00b006490f33ecb2mr344836iow.150.1649114369644; Mon, 04 Apr 2022 16:19:29 -0700 (PDT) Received: from google.com (194.225.68.34.bc.googleusercontent.com. [34.68.225.194]) by smtp.gmail.com with ESMTPSA id s10-20020a6b740a000000b006413d13477dsm7067073iog.33.2022.04.04.16.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:19:28 -0700 (PDT) Date: Mon, 4 Apr 2022 23:19:25 +0000 From: Oliver Upton To: Reiji Watanabe Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Linux ARM , Peter Shier , Ricardo Koller Subject: Re: [PATCH v2 2/3] KVM: arm64: Plumb cp10 ID traps through the AArch64 sysreg handler Message-ID: References: <20220401010832.3425787-1-oupton@google.com> <20220401010832.3425787-3-oupton@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220404_161933_025372_D224C73B X-CRM114-Status: GOOD ( 20.34 ) 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: , 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 On Mon, Apr 04, 2022 at 05:28:33AM +0000, Oliver Upton wrote: > Hi Reiji, > > On Sun, Apr 03, 2022 at 08:57:47PM -0700, Reiji Watanabe wrote: > > > +int kvm_handle_cp10_id(struct kvm_vcpu *vcpu) > > > +{ > > > + int Rt = kvm_vcpu_sys_get_rt(vcpu); > > > + u32 esr = kvm_vcpu_get_esr(vcpu); > > > + struct sys_reg_params params; > > > + int ret; > > > + > > > + /* UNDEF on any unhandled register or an attempted write */ > > > + if (!kvm_esr_cp10_id_to_sys64(esr, ¶ms) || params.is_write) { > > > + kvm_inject_undefined(vcpu); > > > > Nit: For debugging, it might be more useful to use unhandled_cp_access() > > (, which needs to be changed to support ESR_ELx_EC_CP10_ID though) > > rather than directly calling kvm_inject_undefined(). > > A very worthy nit, you spotted my laziness in shunting straight to > kvm_inject_undefined() :) > > Thinking about this a bit more deeply, this code should be dead. The > only time either of these conditions would happen is on a broken > implementation. Probably should still handle it gracefully in case the > CP10 handling in KVM becomes (or is in my own patch!) busted. Actually, on second thought: any objections to leaving this as-is? kvm_esr_cp10_id_to_sys64() spits out sys_reg_params that point at the MRS alias for the VMRS register. Even if that call succeeds, the params that get printed out by unhandled_cp_access() do not match the actual register the guest was accessing. And if the call fails, ->Op2 is uninitialized. Sorry for backtracking here. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel