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 6A45FC433EF for ; Wed, 15 Dec 2021 13:11:06 +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=WAZJvDKzitPsbDyrEhjKZk2xYlSS8kv6ZwkwXKSDhgo=; b=0e95rlcYO2nzUW at4Wmxqafpkf05Z7pjYsK0u+xkuREIqObskRR3a9blR2uJJ3pC01y/Ce5mwnXMCAhAewFGA4VYyf6 xIVOz3xYNF/qZXD0Ao4niFBMmLT0SdP1KXOsm+CBWcb3Eit3yTj0gSQkIEYHe4UJZs9Z+5PBo0ec/ mINa4l9RdmRvjscrpyWqyV+mBixzs/Jfg4uVcJoaUYZJ1Byg1v0AIsib+kgFzgZqrN2ljTRtIkxEU FWnmzB96nasCIpmNJYKTG3g6J83Ba8e27UhHJXrhJNK6n/Ud7ziU/xJrH4Jf9ZdRf6iiyTqKn9S1D xa1QEnwBqOEs4vm0Xopg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxU2P-000uBJ-36; Wed, 15 Dec 2021 13:09:41 +0000 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxU2L-000u9H-Tf for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 13:09:39 +0000 Received: by mail-io1-xd31.google.com with SMTP id c3so29996566iob.6 for ; Wed, 15 Dec 2021 05:09:33 -0800 (PST) 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=o4iIShwRZXVs+Jqe3sjEL4qca2b6WBA7S1kQI8tQZtI=; b=YtPWBvOOukfpvhAJj/xlXfYe8gUBwnx8340HV/ecPejIFL3fKlsIoOnR0af5pSq7xP uYBx9sDiDfMX7GhmzKnez0oE+TrU1OrbESwb2i1d0zhGpBLq2cVSCxwWNGrPGcPx08KK IHDRff46Ut75ToL5XSc2IknpJwHetqXnPS3YmSeihIiGU+ourObiTDUfXX1/pXQSg7zi aZ+JBWfeWFHfPSm06flG4XgdvPr4Hu4i/pkSmPDCzq8q5iDu6o0K6nI5cOYJpAv50L+W KT9sz2A/VM7a0QM2zYopHRbLHjoEY/hx/3rQUpiw+5uS1cfVSAbcjUFxZuonSjRQ+7RT AH2w== 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=o4iIShwRZXVs+Jqe3sjEL4qca2b6WBA7S1kQI8tQZtI=; b=xPGgpe3olvA9JWpXVH855R/VwnTXYg+wh6xZyY1kcwOWusFZrsYuUcsfcDYO4A30QU PTghhCt43ei6a+k/aRTgqh+TLtUJBJdhU6vL5SeqruSF0BXZ1JAXoY/WM+zrxWhVFLe6 aMHWIc5Yb1TeTnbsurfQNUq1wTcuAZ87R8ady0vdjVJXDdb70U5y80r0rlwtWtxbIkDg SUSlT9GwPbLntP7a1ZnRSboDRoSYnwENh2CjwF1+Job2uDSms5Fp2//4dcHgwrfCQlCJ tAPP0pzG3CcxxPRGgnMt9clPWNS7tCAP+zazcvSnR9YTEUazzBxe8nHeHwhbPWL125I4 Q5gA== X-Gm-Message-State: AOAM5306pTKXXuprCqhf0omiqlmbGnW+oc0XDFRboClPtkVoI6f2BiHG dNomRogNXlP4+4XNHibhE2uNFA== X-Google-Smtp-Source: ABdhPJxHP9shiYlKk4jWXLjv34HJNRfwkTsv5D61mMoKrRdSXUIyH2G+QT3+Yuji/sEszZxl2Bdq1g== X-Received: by 2002:a05:6638:2503:: with SMTP id v3mr5510689jat.397.1639573772084; Wed, 15 Dec 2021 05:09:32 -0800 (PST) Received: from google.com (194.225.68.34.bc.googleusercontent.com. [34.68.225.194]) by smtp.gmail.com with ESMTPSA id t6sm1088516iov.39.2021.12.15.05.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 05:09:31 -0800 (PST) Date: Wed, 15 Dec 2021 13:09:28 +0000 From: Oliver Upton To: Mark Rutland Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , Peter Shier , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 1/6] KVM: arm64: Correctly treat writes to OSLSR_EL1 as undefined Message-ID: References: <20211214172812.2894560-1-oupton@google.com> <20211214172812.2894560-2-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-20211215_050937_996545_55978F3A X-CRM114-Status: GOOD ( 18.43 ) 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 Hi Mark, On Wed, Dec 15, 2021 at 11:39:58AM +0000, Mark Rutland wrote: > Hi Oliver, > > On Tue, Dec 14, 2021 at 05:28:07PM +0000, Oliver Upton wrote: > > Any valid implementation of the architecture should generate an > > undefined exception for writes to a read-only register, such as > > OSLSR_EL1. Nonetheless, the KVM handler actually implements write-ignore > > behavior. > > > > Align the trap handler for OSLSR_EL1 with hardware behavior. If such a > > write ever traps to EL2, inject an undef into the guest and print a > > warning. > > I think this can still be read amibguously, since we don't explicitly state > that writes to OSLSR_EL1 should never trap (and the implications of being > UNDEFINED are subtle). How about: > > | Writes to OSLSR_EL1 are UNDEFINED and should never trap from EL1 to EL2, but > | the KVM trap handler for OSLSR_EL1 handlees writes via ignore_write(). This > | is confusing to readers of the code, but shouldn't have any functional impact. > | > | For clarity, use write_to_read_only() rather than ignore_write(). If a trap > | is unexpectedly taken to EL2 in violation of the architecture, this will > | WARN_ONCE() and inject an undef into the guest. Agreed, I like your suggested changelog better :-) > With that: > > Reviewed-by: Mark Rutland Thanks! -- Best, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel