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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AAC1C433F5 for ; Wed, 15 Dec 2021 13:09:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C17C14B15E; Wed, 15 Dec 2021 08:09:36 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UpUuehUXUsIL; Wed, 15 Dec 2021 08:09:35 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 58D744B159; Wed, 15 Dec 2021 08:09:35 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C938A4B159 for ; Wed, 15 Dec 2021 08:09:33 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KXPenQq08RZ8 for ; Wed, 15 Dec 2021 08:09:32 -0500 (EST) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id E12264B156 for ; Wed, 15 Dec 2021 08:09:32 -0500 (EST) Received: by mail-io1-f47.google.com with SMTP id z18so29974243iof.5 for ; Wed, 15 Dec 2021 05:09:32 -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=lkJppnLb/sd2lm4fGWuAquIfk4zjwO4sZQWz8v7fdJnamh9QHCF9ElM7l9A48dof5t ep6esGfCrvs5RXqyq7IT2fnJh8lKBX7ldwunru7TT/cmxqKCYpnEycJJF1IcBTmjyMmL RwBVBmsP2/0/CEbdF/J+9JOD94iBQEzcv6aaYe57VS6lHsXVLVWJ51j/XhnlAGmmSwaw 68vYE5ydmekum71phtVxNMslB+xwNrXwyRT2nwP9LVIrbepr4rEf49uUWljEfOzsK5mA HBIKzcaA1CeIdl4oUFQe37Q2Iy/BSSvoVWlHyGt/XKmTew/TOShdEcAcAKUU4sF8+u44 BP9g== X-Gm-Message-State: AOAM533LZE+WgBy504uBqVDQ7ILrcsQx2qOs4wFvbhqviwyJOvNvbHXQ FWq4qIqsqSZQ04ebyqLK5QzCEw== 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 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: Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Peter Shier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 101A6C433F5 for ; Wed, 15 Dec 2021 13:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbhLONJj (ORCPT ); Wed, 15 Dec 2021 08:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237349AbhLONJd (ORCPT ); Wed, 15 Dec 2021 08:09:33 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA91C061747 for ; Wed, 15 Dec 2021 05:09:32 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id q72so29924603iod.12 for ; Wed, 15 Dec 2021 05:09:32 -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=EFkBIr3IEpysZxnc4QvXJg9IyidauQqsPrgBbXdTDCZ9pZDwzNF+tcW1WdLVymEcg3 N+l3jxGFBu+MYep/IJ1AheTfwRTsNDqRCf0ssHDC2YOXBkqggQKqnQET5yxzOV3ESKk7 Ut8mtvuzo/WNaAIIudBiFQltsdGoHY39qXE5DA9sg9nG/5QkCkTHauUXSz5ArkmQXeQA ZAF9qdbCv4IPlZkJ0Uk4AzR+ygLbNpodf3a78dsH6wWzSMtUuPCp+FypTqFvsL60kOiW WmsD0N5Rn4RTfVGsofwjQHh/1FqFADHHp3/I7CcZFLlOcQHNsA50rQzVTIExciE5bkDL zmCA== X-Gm-Message-State: AOAM533vLv/rc/af+icfxbevDZw0BAZxn+0sZsBXwuFc/Wyyw6GulYst lLAXzyKsvrEWVA46lfgItCU2D3bWuIAp6Q== 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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