From patchwork Sat Jul 14 17:05:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10524773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E293601C2 for ; Sat, 14 Jul 2018 17:06:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3840328A0E for ; Sat, 14 Jul 2018 17:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29CA828A3F; Sat, 14 Jul 2018 17:06:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B82328A0E for ; Sat, 14 Jul 2018 17:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727439AbeGNRZw (ORCPT ); Sat, 14 Jul 2018 13:25:52 -0400 Received: from mail-am5eur02hn0212.outbound.protection.outlook.com ([104.47.4.212]:53181 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727252AbeGNRZw (ORCPT ); Sat, 14 Jul 2018 13:25:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wzMnP8XUN1VOsOBAb5Wk9Hmgbs0kuZUWLjCuIc/rY1o=; b=HiKR7H0PcEeyO/6JvcMoUNDOiHBwMQMELX7V9mO6lZcsIRKOAEb0ycNrDmu+OAhHrK3iXmTwGR+WvJba5gWuJYGHFVzF1BrNPd+pUto3/yz+rKAJkiZsJ1TkrPlSZapxIfAIMqQqOj23GJs3lxxKk/P5jEUXFk6zVgj5KrHyP2Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christoffer.Dall@arm.com; Received: from localhost (217.140.96.140) by VI1PR0801MB2047.eurprd08.prod.outlook.com (2603:10a6:800:8b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.18; Sat, 14 Jul 2018 17:06:06 +0000 From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Eric Auger , Andre Przywara , Peter Maydell , Christoffer Dall Subject: [PATCH v3 3/9] KVM: arm/arm64: vgic: GICv2 IGROUPR should read as zero Date: Sat, 14 Jul 2018 19:05:34 +0200 Message-Id: <1531587940-2490-4-git-send-email-christoffer.dall@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531587940-2490-1-git-send-email-christoffer.dall@arm.com> References: <1531587940-2490-1-git-send-email-christoffer.dall@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: AM4PR0701CA0008.eurprd07.prod.outlook.com (2603:10a6:200:42::18) To VI1PR0801MB2047.eurprd08.prod.outlook.com (2603:10a6:800:8b::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1ae7939-3be9-4446-e97a-08d5e9ac1696 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB2047; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB2047; 3:5ASEEjxpPWNX2X+w4Gqkbt90iuULRCeBFj3YHTF5crVSPOflqRxiSVM8VXn1c2GM8YdzbDDu0VCCE2OzwLMv5ZnuZhPYoTMwRI4PduUA3kv0zZ016RwMtiK4U6K8zonoeMdYvw1EFr1pbGFZb4BDdA1dM/6MVlQ87C2kKtIrFFgnO/heMp/Vy0ralRjah/s1LC6R9EH/E8e02++I/59YMEU+VCrRIGHk37vX4C3zpCW31sUuXpgTz3lk96OleXg+; 25:PtfnROEVx2qgBrzuOOWhv3yy8bmgc3y3cEmzUdhXQzccYo2rAVAEJg7Bf+ZzDQIGDTRgr1Gx9mUcRuv+Y9nU5OalVWmL+ldNKb94S4Tt+yfURpRacPMtz5LC4EQDO1in8/A1TbeNsRds4mchyZnQafCW2HiIoH+EJ4iAnWat7Grd5del3vVvTaM6PngUsIEanD7HvMDbd+caPS+rI0ewnZ30oLiAn0uPXIt4GI6TST0kTfwcvgTDGTSQz6isWCf1Fhz7833UDigxQYD8bMVoa3IjPMtgs0ilDOFJTky7K3FlFP7l1nYpXM7t6seW7wrajaZcf6zQ1QjBqJw8jwV1ng==; 31:eSYT41yHJKtNYCBawgO1QFMX0MGTX0Ya46+U957MlVn9oirdNGP4f/cs8c0f6oCMhlpinj5Nl+1CVJ9+g72NatcuBpzbTBKkCSU3hhrtph5Locz0cudJX2lQbwVj66oD/RRa1RTDbAsvJzBHPHg3RzFN3PTVmzLqpmckJFGQjaNsjj5uSR2lfgsjudC9CaopR6jI1d+ndguMqI+XOyACx7RBN4J+y7XDOPp3Jl36xKI= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2047: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB2047; 20:pp7jSsUTqEaE1+L4q10s1cqa6I1u0LD8Rao3nAKibohDzA+M0KHzQVtTUifLBb2A0KX2E1MbeYfSRdBNlwDdeLbXZp2B1gLo3JYix200A51Vc7mRmfC6GXYCZlXfDemhsLGHpiXkKT09wVIvnDtusGTwdF11PzO+T/mDnyZxkGjOuLpmA6AxXIP502Ot1+VtIYb/h64Le/C22erf7FBhvqWZlPcuK7T7u2iM/I+dR3I/yWURRV1PdNxX5AxCW3jNwUuMo3ba06+x6siiyO++/8VXX3MYY96B4QDOv8ZKOXLHhLk1q3f2mkDd/+bB1VWM5GJAq/sNGJixfZFmAEcTKmaU1a2tcRVHw9nkkfXphEL6Z/r9OsNaq56jJmP5vGXlwJ2fB56QN7BtrLSXBRxVvNcj00SX6mKWUCDs6R7ZM07fj79kFp8tViMPGPVRfJN/q/IzDTPM3Ym9516qvHbluxGrfBF/63WtAoXIlH1PRdiLS6dpxzQuJ2fvY4ka4idz; 4:cqhqmQ20DXXg7UUEs/pQgVhfDoOM08KSdfo2Hn/s+s0Ff3wgiTDa27oCocNx5Pen7nEWDLIhtbWzR5LA9EqWRZLoQCf21htOYTIFiRDCLx2fDQyovlnmfwnpYGhu9cnONSPsvAMr7KVmpr+FzuuXh/6PuwY6zr5nSG39LYWNvCfvLjMryozxz/ohWejW13FI8+WbGOy9jIFFX+hCY1e2EbO+nzYd0LUz/V/DxqV/N/NkbS7NNoGHeSsY+zIafFm4rgybRBx+mEK2AFF2FbeiEOm4k46UlvKyZZFmjEyofGVbhqQqMXsAfXn2HROBEkw72SL2NvymVaVxMnwx1Zfahr6Ai8kSBWFOwxzYD0HB4oIGbSGqEpq0PLOjiXiFAHNU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(20558992708506)(223705240517415); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0801MB2047; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB2047; X-Forefront-PRVS: 07334CBCCD X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6069001)(366004)(396003)(136003)(346002)(376002)(39850400004)(189003)(199004)(40434004)(81166006)(386003)(76506005)(8676002)(54906003)(2906002)(4326008)(68736007)(66066001)(81156014)(2171002)(2616005)(25786009)(47776003)(8936002)(16526019)(8746002)(956004)(11346002)(97736004)(44832011)(72206003)(50466002)(316002)(53936002)(446003)(476003)(486006)(305945005)(478600001)(106356001)(5660300001)(6496006)(6486002)(105586002)(48376002)(50226002)(5024004)(51416003)(6116002)(6666003)(52116002)(36756003)(186003)(575784001)(76176011)(3846002)(14444005)(86362001)(26005)(7736002)(23200700001); DIR:OUT; SFP:1501; SCL:5; SRVR:VI1PR0801MB2047; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB2047; 23:DY3hNHEy3XX5sts6ayHBmIwyfe20/NJjngSJ4ak?= =?us-ascii?Q?dsilrDVK4CCdU0U+TEuCTZzvNpfvI9/Dfz8NqrgEvfxfBSVP5ugLh54osdnC?= =?us-ascii?Q?k2KR4sGqGDqsqZgzfJosYJQi4eEdnb0q7sxpnrwT2W1XGqYJEsW67trNo5N1?= =?us-ascii?Q?yMc4iqQz5uMaUxevQe+dq3L3zZPXrDdgn0KZcj0w1EpsJG6uQiUhrTeiFfeU?= =?us-ascii?Q?CdmB1jtfRfsHknQlO23WiE9v6RcqcCRdSlAMFXoEu6AyMYZEzwHRrAWkNwsv?= =?us-ascii?Q?Hx6SD3vz/GXcf/Uy+C3XN2jjicRv9pLwWx+BLreraQCsDkNZP/gg6+RNVjDK?= =?us-ascii?Q?vVqPts4aPkk0RIbYgwZXFGoMoBbTY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BZC+AqphbBQa+fvY9M1eboKBGd9O4RccFkGFJR6fojxcqNuJNd25G3TgoyM6w6BqQOr+iHYkMMGH8YDPVJrZsPWDi3WQATaJBL5/35EgpapkF+xr2v9rWSydvQr/mV0T/VP6lqRXxcs5bbYBPHxVz3xcEb5ScARtPQkjMcT9rPfbcbbLaJug+oF/edxCpSd1IGP64/k+P1Rml5dvdhcDCXcdib+eglTzT00+yi2p7KFATZ2FtvY90IRvj+GYxBhshX+PKH/5zHNW5aI2uCKlfOEXFjWd1EsLulC8QO6z; 5:eQc8ltFW5YVvQ7/Jwx0CzBNjVEiJBcQDN6aUYm1+FufhMjWZelRRaeEmXNg89X8iz7uoGYAm8k4RISU4VqOb/HLkfsiFVwx6J94SjKIVBwaatkTOkj7r4Zrzv+UnQL2RsXiLJrUxBb2qGri8HW+1TGC1VQ9xCGf51H86IkXw368=; 24:ENPQ6YkazvazkajMFjS9/fWGuUeuQxcgbqsEfFZcM9BxmSAOlf8Y0RW5uK8yrwft+44/0B1CjvK3kPBeG8g+Qw== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB2047; 7:MQk1zA0U13xvSc/ytoeQCFM74c+7sL3NXDKVtM2awkColtXjSi0wFaq54LGlO3yNuPUVxys0A7esSAPQz4W85HbvsditnEP8xSh9WrmDmAoVutJssgrM5PtWYXdGqeQZ9Ow6p8ZjZNw0eiiYCVPR7/8juShzgpRnONbDM63EkqNUPT7Ivpl1WswaDj9id8JVMut1yf69jUGqA/ZaIC9KCiEOd36pV9LdLxJpPdrJjJURpfDgpHeNP/d4bPtYctVd X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2018 17:06:06.3517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1ae7939-3be9-4446-e97a-08d5e9ac1696 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2047 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We currently don't support grouping in the emulated VGIC, which is a known defect on KVM (not hurting any currently used guests as far as we're aware). This is currently handled by treating all interrupts as group 0 interrupts for an emulated GICv2 and always signaling interrupts as group 0 to the virtual CPU interface. However, when reading which group interrupts belongs to in the guest from the emulated VGIC, the VGIC currently reports group 1 instead of group 0, which is misleading. Fix this temporarily before introducing full group support by changing the hander to _raz instead of _rao. Fixes: fb848db39661a "KVM: arm/arm64: vgic-new: Add GICv2 MMIO handling framework" Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/arm/vgic/vgic-mmio-v2.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index 8b6fc45..230c922 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c @@ -298,7 +298,7 @@ int vgic_init(struct kvm *kvm) vgic_debug_init(kvm); - dist->implementation_rev = 0; + dist->implementation_rev = 1; dist->initialized = true; out: diff --git a/virt/kvm/arm/vgic/vgic-mmio-v2.c b/virt/kvm/arm/vgic/vgic-mmio-v2.c index f0c5351..db646f1 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v2.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c @@ -22,6 +22,12 @@ #include "vgic.h" #include "vgic-mmio.h" +/* + * The Revision field in the IIDR have the following meanings: + * + * Revision 1: Report GICv2 interrupts as group 0 instead of group 1 + */ + static unsigned long vgic_mmio_read_v2_misc(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len) { @@ -365,7 +371,7 @@ static const struct vgic_register_region vgic_v2_dist_registers[] = { vgic_mmio_read_v2_misc, vgic_mmio_write_v2_misc, 12, VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_IGROUP, - vgic_mmio_read_rao, vgic_mmio_write_wi, NULL, NULL, 1, + vgic_mmio_read_raz, vgic_mmio_write_wi, NULL, NULL, 1, VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ENABLE_SET, vgic_mmio_read_enable, vgic_mmio_write_senable, NULL, NULL, 1,