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 74CB7C433F5 for ; Tue, 5 Apr 2022 01:53:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BC3E24B0B6; Mon, 4 Apr 2022 21:53:34 -0400 (EDT) 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 9qCaMqxYrGFK; Mon, 4 Apr 2022 21:53:33 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A1C444B133; Mon, 4 Apr 2022 21:53:33 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 8EA144B133 for ; Mon, 4 Apr 2022 21:53:32 -0400 (EDT) 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 wvKoQKmXSdkF for ; Mon, 4 Apr 2022 21:53:31 -0400 (EDT) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 68BE74B0B6 for ; Mon, 4 Apr 2022 21:53:31 -0400 (EDT) Received: by mail-pj1-f54.google.com with SMTP id u14so6629247pjj.0 for ; Mon, 04 Apr 2022 18:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=hKqK2Pm2eE7pi3Ug4MDSplWp6AxG/hOn5Qku1eSKQhG9yDshjLSjZBsk1GryTF+1Ye LMX8CJHD2NmLxUjWfI432ZBJm3E8MZAz1B82TFwrvg6H6JZ5SXBqwZyupGGPYmVOm8d7 orqCrKIGjiH5ewtJlE2rGiQwCxTSLtIXPnF1kNbyl7/gVPSVvPQFAlG6oJHzsi2iXQmr iNg/aNvho1x1E9wnQ4GTOxGYdXlWWVbthRX0NHng5F+dYV4m7GFYpWFkeE12KcI+LMy7 YCITxwMBqEAXS7JbfWHZcHEEyT+/LLTHlCXzri/ju5TTcYmDleiEmRL+QGKc5Kk3NH52 cHlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=FCFonAVyOkK4ZaQN1vG31xuQB12RO+jnjq0tuTw4lSggNgI6B9knon8yUZ50ZYSEtv I+tXa9tcBGdcyoKJYvap2JIeS3xf80R6762wCleTIDBpT1YVmHpdUyJ2HVsS1Lq/Ihbn LPtx2ryIAW12D90kQuZLOuW8avZ8ETILZF05O0+u0xeWjRY0N4fbhdCmnACxcNlGzn0r 9U/9ecyHHVfRvCmdGV6g9fgK7ybCtaClxvTZ2BWmx7xDeMaPw16CERXbKQQjHGCjY+NK L0Ihg7Nx2NWG3HAmIygCzYFrNRkqvdCdkmp6r46ZVIz7DkpTMe9NtdsE8jiNRQdVMbbO X6Qg== X-Gm-Message-State: AOAM530yV9W3a2e+H1g69bw/PyJ+uIM21jrrE7Hw/+t+1NcGpi6ltKnO c2ZkZ8trL9oARkFiFUJC3IxO1nV5ACchbUuUDfAFSA== X-Google-Smtp-Source: ABdhPJy3M4KOifOVTacqoNTW1CPwfWP6Y9YsIhhYUubrpWrjIexOpeAwjfsgkWyb/C+hfOn/XAg/ItUHqA6cerQoWLA= X-Received: by 2002:a17:902:c1ca:b0:156:a187:b7ee with SMTP id c10-20020a170902c1ca00b00156a187b7eemr1035059plc.122.1649123610270; Mon, 04 Apr 2022 18:53:30 -0700 (PDT) MIME-Version: 1.0 References: <20220401010832.3425787-1-oupton@google.com> <20220401010832.3425787-4-oupton@google.com> In-Reply-To: From: Reiji Watanabe Date: Mon, 4 Apr 2022 18:53:14 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Start trapping ID registers for 32 bit guests To: Oliver Upton Cc: kvm@vger.kernel.org, Marc Zyngier , Peter Shier , kvmarm@lists.cs.columbia.edu, Linux ARM 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 Oliver, On Sun, Apr 3, 2022 at 10:46 PM Oliver Upton wrote: > > Hi Reiji, > > On Sun, Apr 03, 2022 at 09:45:15PM -0700, Reiji Watanabe wrote: > > On Thu, Mar 31, 2022 at 6:08 PM Oliver Upton wrote: > > > > > > To date KVM has not trapped ID register accesses from AArch32, meaning > > > that guests get an unconstrained view of what hardware supports. This > > > can be a serious problem because we try to base the guest's feature > > > registers on values that are safe system-wide. Furthermore, KVM does not > > > implement the latest ISA in the PMU and Debug architecture, so we > > > constrain these fields to supported values. > > > > > > Since KVM now correctly handles CP15 and CP10 register traps, we no > > > longer need to clear HCR_EL2.TID3 for 32 bit guests and will instead > > > emulate reads with their safe values. > > > > > > Signed-off-by: Oliver Upton > > > > Reviewed-by: Reiji Watanabe > > > > BTW, due to this, on a system that supports PMUv3, ID_DFR0_E1 value will > > become 0 for the aarch32 guest without PMUv3. This is the correct behavior, > > but it affects migration. I'm not sure how much we should care about > > migration of the aarch32 guest though (and it will be resolved once ID > > registers become configurable anyway). > > I believe userspace has been accessing the sanitised values of these > feature registers the entire time, so we should be OK on the UAPI side. You are right:) I totally forgot this was just about trapping. Sorry for the noise. Thanks, Reiji _______________________________________________ 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 27DACC433F5 for ; Tue, 5 Apr 2022 01:54:47 +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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/orEqUw3GC65yMa5wKA5l9BEeYwfrZXOszSzcS/Ei1k=; b=VzCX8LVxiUcVfk BOEPOOTO5AaTEBVih4+ifNdK92aJ0qu7HOOCGyGhzUdxyoDqAMC+DnCbWM0+wn5LWZyAdhcFMfm0A Ldg0a5lIOEoL2CW1bIJLdDAJxmxD0HFk11VQK3SU+PA2MqC5P7xpj7tKCJ3be6uwfqHNBd4OQTF41 hRyIhPeoWPAlYQkXD8lCtAwRzihWN6vdv8Bcq45CCHdpEnrVIL5ExCtVNhwX3UYG2rt7jXBl4vhPb AHK7mwXyUyeYgBt2Bntgkoz3gy+VULiWkjDriYYel5TbQvmgZj47hVVTHxM3I/KmBGZEtW8IG2gN0 g3poefvfi8ogZOk19eSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbYO2-00GphE-A8; Tue, 05 Apr 2022 01:53:38 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbYNz-00GpgL-EY for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2022 01:53:36 +0000 Received: by mail-pj1-x1034.google.com with SMTP id gt4so4561132pjb.4 for ; Mon, 04 Apr 2022 18:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=hKqK2Pm2eE7pi3Ug4MDSplWp6AxG/hOn5Qku1eSKQhG9yDshjLSjZBsk1GryTF+1Ye LMX8CJHD2NmLxUjWfI432ZBJm3E8MZAz1B82TFwrvg6H6JZ5SXBqwZyupGGPYmVOm8d7 orqCrKIGjiH5ewtJlE2rGiQwCxTSLtIXPnF1kNbyl7/gVPSVvPQFAlG6oJHzsi2iXQmr iNg/aNvho1x1E9wnQ4GTOxGYdXlWWVbthRX0NHng5F+dYV4m7GFYpWFkeE12KcI+LMy7 YCITxwMBqEAXS7JbfWHZcHEEyT+/LLTHlCXzri/ju5TTcYmDleiEmRL+QGKc5Kk3NH52 cHlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=nnX7JdIJK4CVP+Xk23/D2k6WzPLM4Y0BFb9FR8QhNPTRXKwGQLrP5fAnlBNF74KTAw fYBKHJGwfts/52GL/jg1dZi+3blenSn1OJkIxvVr5s3flYUk60Pez6PZdpO9Xr/K0cQH Z/rjor4sznOlE3hRu/CB7JaFQsoKBLu8YvFUhZNAYgx7dl+q11ZOMefALzoFJXFJwMMS qr9LisAifR9GITzTi13DFr3kCQBFlskd8c28UA5DcQRpAXTdBGEPTrd+6D7SRfriK9y7 03U+OGxdFZN8X/M2MfVAebm3NtWB/F1n4YZmM7AQGHZ62ESfJtxBFsQP/qiZQ9GKO0mW YzIw== X-Gm-Message-State: AOAM532nIrOf9N3UX9o6GFgUe5T1E7d7KJTnD5FvV3707zS+hx8k9KEy qKFEaOH4kdwKWxPnoQT/864DUnYgLVDNOa3R6Lli6g== X-Google-Smtp-Source: ABdhPJy3M4KOifOVTacqoNTW1CPwfWP6Y9YsIhhYUubrpWrjIexOpeAwjfsgkWyb/C+hfOn/XAg/ItUHqA6cerQoWLA= X-Received: by 2002:a17:902:c1ca:b0:156:a187:b7ee with SMTP id c10-20020a170902c1ca00b00156a187b7eemr1035059plc.122.1649123610270; Mon, 04 Apr 2022 18:53:30 -0700 (PDT) MIME-Version: 1.0 References: <20220401010832.3425787-1-oupton@google.com> <20220401010832.3425787-4-oupton@google.com> In-Reply-To: From: Reiji Watanabe Date: Mon, 4 Apr 2022 18:53:14 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Start trapping ID registers for 32 bit guests To: Oliver Upton 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220404_185335_523902_7C4D5243 X-CRM114-Status: GOOD ( 21.74 ) 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 Oliver, On Sun, Apr 3, 2022 at 10:46 PM Oliver Upton wrote: > > Hi Reiji, > > On Sun, Apr 03, 2022 at 09:45:15PM -0700, Reiji Watanabe wrote: > > On Thu, Mar 31, 2022 at 6:08 PM Oliver Upton wrote: > > > > > > To date KVM has not trapped ID register accesses from AArch32, meaning > > > that guests get an unconstrained view of what hardware supports. This > > > can be a serious problem because we try to base the guest's feature > > > registers on values that are safe system-wide. Furthermore, KVM does not > > > implement the latest ISA in the PMU and Debug architecture, so we > > > constrain these fields to supported values. > > > > > > Since KVM now correctly handles CP15 and CP10 register traps, we no > > > longer need to clear HCR_EL2.TID3 for 32 bit guests and will instead > > > emulate reads with their safe values. > > > > > > Signed-off-by: Oliver Upton > > > > Reviewed-by: Reiji Watanabe > > > > BTW, due to this, on a system that supports PMUv3, ID_DFR0_E1 value will > > become 0 for the aarch32 guest without PMUv3. This is the correct behavior, > > but it affects migration. I'm not sure how much we should care about > > migration of the aarch32 guest though (and it will be resolved once ID > > registers become configurable anyway). > > I believe userspace has been accessing the sanitised values of these > feature registers the entire time, so we should be OK on the UAPI side. You are right:) I totally forgot this was just about trapping. Sorry for the noise. Thanks, Reiji _______________________________________________ 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 54C86C433EF for ; Tue, 5 Apr 2022 02:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiDECrl (ORCPT ); Mon, 4 Apr 2022 22:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbiDECr3 (ORCPT ); Mon, 4 Apr 2022 22:47:29 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C682ED7B for ; Mon, 4 Apr 2022 18:53:30 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id kw18so4202249pjb.5 for ; Mon, 04 Apr 2022 18:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=hKqK2Pm2eE7pi3Ug4MDSplWp6AxG/hOn5Qku1eSKQhG9yDshjLSjZBsk1GryTF+1Ye LMX8CJHD2NmLxUjWfI432ZBJm3E8MZAz1B82TFwrvg6H6JZ5SXBqwZyupGGPYmVOm8d7 orqCrKIGjiH5ewtJlE2rGiQwCxTSLtIXPnF1kNbyl7/gVPSVvPQFAlG6oJHzsi2iXQmr iNg/aNvho1x1E9wnQ4GTOxGYdXlWWVbthRX0NHng5F+dYV4m7GFYpWFkeE12KcI+LMy7 YCITxwMBqEAXS7JbfWHZcHEEyT+/LLTHlCXzri/ju5TTcYmDleiEmRL+QGKc5Kk3NH52 cHlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s1jP08lvjc+iEpUnhqHS81takUv7ectwk3mZXZaMX7A=; b=j88R5xcfX0J8MR42ZfaVgfJYFB0MsruJsvG216zNK+p+xqAZXPbqDn/kcQnR+RNuD/ HSPRkv+47VaxB90CqQ2kN2bHBzq4TZYk7IKCdQeumVPW580afb9YMO0y3HtGsnz+6Di6 aNP5yMskaE8QlWCCRK5GysrOXzrkPY+DsZsaYHbjK6l9J4l7jx7IB6IRNy4hjOYaUhA8 ZuFlYw/MTcvQaGs60UpTBsUei5ROp/ZObosIX6fW/E5QQawrNnXBwsppS0rpEBE+2wjX WONyIJNFpLGF3BGrMijzxUOxh8pczXt71dYI/9rZBZVU7dytFUPAlJut3hN5wzfuXZmG 9pFw== X-Gm-Message-State: AOAM531OwG+LM91YGb7UBl2FrZjanPgO8zXoCbdWwxhqhkpPu6eNE+mM 0bC4/BiRVieujrAEJaIidNpvsLW58oM9K1QE0lPyPA== X-Google-Smtp-Source: ABdhPJy3M4KOifOVTacqoNTW1CPwfWP6Y9YsIhhYUubrpWrjIexOpeAwjfsgkWyb/C+hfOn/XAg/ItUHqA6cerQoWLA= X-Received: by 2002:a17:902:c1ca:b0:156:a187:b7ee with SMTP id c10-20020a170902c1ca00b00156a187b7eemr1035059plc.122.1649123610270; Mon, 04 Apr 2022 18:53:30 -0700 (PDT) MIME-Version: 1.0 References: <20220401010832.3425787-1-oupton@google.com> <20220401010832.3425787-4-oupton@google.com> In-Reply-To: From: Reiji Watanabe Date: Mon, 4 Apr 2022 18:53:14 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Start trapping ID registers for 32 bit guests To: Oliver Upton 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Oliver, On Sun, Apr 3, 2022 at 10:46 PM Oliver Upton wrote: > > Hi Reiji, > > On Sun, Apr 03, 2022 at 09:45:15PM -0700, Reiji Watanabe wrote: > > On Thu, Mar 31, 2022 at 6:08 PM Oliver Upton wrote: > > > > > > To date KVM has not trapped ID register accesses from AArch32, meaning > > > that guests get an unconstrained view of what hardware supports. This > > > can be a serious problem because we try to base the guest's feature > > > registers on values that are safe system-wide. Furthermore, KVM does not > > > implement the latest ISA in the PMU and Debug architecture, so we > > > constrain these fields to supported values. > > > > > > Since KVM now correctly handles CP15 and CP10 register traps, we no > > > longer need to clear HCR_EL2.TID3 for 32 bit guests and will instead > > > emulate reads with their safe values. > > > > > > Signed-off-by: Oliver Upton > > > > Reviewed-by: Reiji Watanabe > > > > BTW, due to this, on a system that supports PMUv3, ID_DFR0_E1 value will > > become 0 for the aarch32 guest without PMUv3. This is the correct behavior, > > but it affects migration. I'm not sure how much we should care about > > migration of the aarch32 guest though (and it will be resolved once ID > > registers become configurable anyway). > > I believe userspace has been accessing the sanitised values of these > feature registers the entire time, so we should be OK on the UAPI side. You are right:) I totally forgot this was just about trapping. Sorry for the noise. Thanks, Reiji