From patchwork Wed Jul 4 09:38:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10506325 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 124FC60532 for ; Wed, 4 Jul 2018 09:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8B51285D8 for ; Wed, 4 Jul 2018 09:38:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF8B28DD5; Wed, 4 Jul 2018 09:38:47 +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 65800285D8 for ; Wed, 4 Jul 2018 09:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932878AbeGDJip (ORCPT ); Wed, 4 Jul 2018 05:38:45 -0400 Received: from mail-vi1eur04hn0224.outbound.protection.outlook.com ([104.47.14.224]:63840 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932673AbeGDJil (ORCPT ); Wed, 4 Jul 2018 05:38:41 -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=I1BieJHj2ufWxA7okb1Xau3bd0qQ+TWyp+P8GipWbXeJQ0QrLJ0pEpzNBqn7FzKzf0dIrb2Ty7XfdN+SrFUSifiNFMoe7kjNsHXqim9Njtt95XvmxYsTi8nvBDjOf48MFzVXLl52VomWUbrQHTePOs3SrxKhCtJ4ka0GLL1rVDo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christoffer.Dall@arm.com; Received: from localhost (217.140.96.140) by HE1PR0801MB2044.eurprd08.prod.outlook.com (2603:10a6:3:50::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Wed, 4 Jul 2018 09:38:37 +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 v2 3/6] KVM: arm/arm64: vgic: GICv2 IGROUPR should read as zero Date: Wed, 4 Jul 2018 11:38:17 +0200 Message-Id: <1530697100-22419-4-git-send-email-christoffer.dall@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530697100-22419-1-git-send-email-christoffer.dall@arm.com> References: <1530697100-22419-1-git-send-email-christoffer.dall@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: HE1PR0402CA0016.eurprd04.prod.outlook.com (2603:10a6:3:d0::26) To HE1PR0801MB2044.eurprd08.prod.outlook.com (2603:10a6:3:50::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6fac55b-d8a3-4887-c494-08d5e191eb34 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB2044; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2044; 3:ogkuQ+oRu9OZc/fE5S4fWaycKJVoPRh40xAeFQQf8kDm2W6uatOeI1N5g+7md0dwC1i1qmcVTJ5OX3dBaNViIytBGDHmLt692GZWWL+C+U6PukPi/YRlvTf0s6FjNnL8MFjNVW/8YGGaJEddsan/jPe4NT6j8L+IZjh4O2GXYYK3ZIiY3zK1N2yfyYt+uZPAc7cb1edSYPvc1ga1vuBM4xA+0Rx5LprGfCuT8CG4iTaDO2xYXS8WrYIlP1l6OBqH; 25:DywGf3E/rdRh8nSTQUiEI6U2pIgeY5bTgHCThG0yIMiXhv2hyh73pYaYsP2BrrNcvffdpX6FK3gliTL+V0V+fBuKZgLHlH6QNTxZ37gx7gRV3jBco2hIIxfcvrchdaVzZ1AvEFAmp5yuvjK0KnQj2LMZnuihXZyXBYJgkEZTtPdh49ZjbOtUm6mXd7lp/d6UYLUaqhYgTYJXbpHxrTmwrAyZHTPvXS2gh4MXx4tg24K6cY3h1zSPjESb5sk/lLGiFluwcJ+f3QCJgHgCb9NZFhFaG467ds9w1xBnYgDmq8bwqKA4PxCbSbDi394ZgYW1QJLSPneXdD3Z5sqdB1fK9Q==; 31:nqNFHBo8JBg+rbv7nDdBGOfne68LybC/awLciDraV2oZlUlo3CM6SA3Y1HhhZuhpoRQ2Nqyfs/rgx7ZVmWP9VvDmE2oBNRXxQm7MSbAd6amTifMXdidSGo/sNYuQdtIYxWrrosIdPGHmlwlv7SH8LWexwna3KAIA26p7kkbpV3dVUurhR0Or692eL3GAeiT6R7c09re/TKEylyOJpkc8JpXaDavmwVkIUWPkrbd492g= X-MS-TrafficTypeDiagnostic: HE1PR0801MB2044: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2044; 20:2QX2a6JUaarf/r7i88eLms/RXk3ZpuT+H4IlXrOK5enQm2xIFdd/r0bVEKd/UepqZF8E/3sxaRNUBBbn0I+Y+jbwUINV50pTYvaXMS+lB9KYK3omPuhHMfIy7bupLRYOnbSfslTQYPkIndfvvNYnJOSbdBGwxyDaxmQSZOghAxRs6XD3jgngvcBE31Up3r5gbC9ASsD7heSG+Qp9wcQjyWYnNfffAxKuF7byrWIHg4u4oaQ3n0MDgLRIOiGsLOSWELrmJiziS4JSveT1+JAKdb4gMu8svTdLvgCqAlVMgHqI0JP+QrrMrcEA/LPqbuBrG5w1QLB+lf7+ZQXItzA//dDDpalbPRLtosLswHUcVv8YlcceOQuBA4Ua4SQi4OFFOfzH3rWuWRIDWJdrAyrdv7TKwv3TIp/WGI7hb8SjkwtSOo+/3dQbNF9mGLskwHyhuwhMp/mLql1XPrpc/lLwa1+S9Xo0hDRwUz1j82iYYunjXJzJNVxzcOPH5WbIozEd; 4:u5kWipn5NhTKQJgUQ1kKxBDYcL2wuqajn2/J2aCSzYPytm0bIg+YchPKiEmC0/sBaUFl+h999dw7P1qFAdG5sVzuN67LZIPYLmCLg4q/w8XF7sEKutzntSJfbLjmRxe0erLPymMkGDhXwG7bJ5Rfmt3k6heGxhdhJJ25U3qZxaUtHSMCgSECZd+sdj1Og85bgnRU35VnoNSd0Oq3iWTiR3D4EHlIc+Ft3goKixN7LAFZ9UK/F9JCZHSjbhkTLBorrjQH7T7yWoJtpAIiGMkd/nsk1sJeEnH52BYlwUdc6iwPhoyT7DNDjq08NFQ4YnVcrAP+neAdFphDfMZt6gGXcIQ2jFonUFgASWwLwfokyX43LFz2fCjHpBxNiA1vTmeB 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)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB2044; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2044; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6069001)(396003)(136003)(366004)(39860400002)(346002)(376002)(40434004)(189003)(199004)(305945005)(52116002)(478600001)(36756003)(50466002)(5660300001)(6666003)(66066001)(7736002)(72206003)(6116002)(50226002)(6486002)(44832011)(97736004)(47776003)(68736007)(2616005)(956004)(446003)(486006)(3846002)(11346002)(476003)(26005)(386003)(76506005)(186003)(5024004)(2171002)(14444005)(25786009)(16526019)(53936002)(6496006)(86362001)(4326008)(575784001)(106356001)(105586002)(316002)(54906003)(8746002)(2906002)(8936002)(76176011)(51416003)(81156014)(81166006)(8676002)(48376002)(23200700001); DIR:OUT; SFP:1501; SCL:5; SRVR:HE1PR0801MB2044; 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; HE1PR0801MB2044; 23:Eb5A95o5zmKhdSRyFPJGLTtbPqZRkPOFKIGxjHr?= =?us-ascii?Q?NApolONWI3zCJqRWHDGstV8xI333eHwMvxx5CHFvMf4S2HE3xeQWAxqQer4i?= =?us-ascii?Q?zYbT//l3gl7HXNGcPf5Xs0YBLecFCuJLp/V4yQ6SH0Pqxs3sawJRTaJky1ZE?= =?us-ascii?Q?JpDOMRqme6sBtxLlp3yOH8as824eB3kZreLtzKrczWz/pPVyU3WNsnxc2tcU?= =?us-ascii?Q?+SbCyi3/l4cqPuIl/nIr5hoaaDmv2SlJvINcakkyTqoltcEMojJd9LTPaJJW?= =?us-ascii?Q?ELCMPHaP5uhv/chImAyqBVQ5hogOOJefrs6csRlMH+VWOMS/JIv2FS+Q0wk4?= =?us-ascii?Q?FisLu8jmM0u3cbV70XL5z1DVRF/e8MqwQhVXwLc/q1Ie6C75wYdtQmcdBytj?= =?us-ascii?Q?yYPNLRM5EVs+T1vX8SZuBgLpew4vsavujYa19oYUxHJJozfXU9buDec7hehP?= =?us-ascii?Q?NNr3M5mzlGVZlr3tSfpyP6/shFbeZxTcP853wW5GKztflYY0hcVhdoiTQj4L?= =?us-ascii?Q?F102pg3MEeUnJ5HDYx8q4BNukPc+EtCvHvgLx0SZMPjh+edgp5zaY3pNhH10?= =?us-ascii?Q?3+SRoROcOh2c6um9S5yJOpCRlitpyGBz7cr92lii5dAHhH6SbpJw3LxMeqYo?= =?us-ascii?Q?XZZzuw7MrotqBoBpB2bFQcgcKyV+IFC5gRta218UjFLWohPZzY/KyzqYgatk?= =?us-ascii?Q?Jo6DlRkiaSRWGSlXfpF/0ZQcL4n4JN6Xpgc+rwSQajUBf0w9yIVSzSCcCXgX?= =?us-ascii?Q?RPZezRFJFezysnjLcf4ogd1dEALnh7rOj4ZprUvKNs46c1GX7pk4kYHhnuKW?= =?us-ascii?Q?BdY4VMLpx0PjAyyPTJY0Z1ikm843bpzjdOf56SC8bgZ1tDDb5Vtec2TlKhdR?= =?us-ascii?Q?JjtQTZp56JGytSI6ffy1eA26sIW86xFP4SFFcVZeFFpgBL3B9gKi+uMRM7Fl?= =?us-ascii?Q?3c4iiA7ZeT/GFPBtEl7P3ZivBeS46xx329MlaJbD+WviI5vi/BlKhm/LrGGB?= =?us-ascii?Q?pKlthoLW4inIY5SWXSn1SNGFeR1aSh8beFbokIoRPQjVgrstWQO0LC6O/Drc?= =?us-ascii?Q?1VYLLnRZTd3jbwrYnXoCsycJninNtjqh9CemQaXx2xIYqSojqPNSiUnY1Wy+?= =?us-ascii?Q?cifJLxeulvhg263YpK10RljwOgwGPg4U84Qt4P53IPZKmqP+4Iikoa2XgyQ7?= =?us-ascii?Q?JJqCdEE2eNq7IsvRG/EzliWf60P9s4QKQMG2GwAHQN4lqzN/cXSn5lXtB+I/?= =?us-ascii?Q?eD06iitWOaI3Arf7qAs5wGiMORUfNegLzVFeDhVffsG2xDpS7xfd8nvuV1yZ?= =?us-ascii?Q?moLi1jmS6DUXqylvIO5lDCTlFDME9vpRke8ZfnM+ipfhhXOCqXA2W9g4s+KF?= =?us-ascii?Q?e1KWjKZ6WLKcjy0dvmmE8J1Y9lWrzDg4sGo0gv/FugAvpJomr?= X-Microsoft-Antispam-Message-Info: Z6+2BPxb1raD5hddZZoYWmYnZiTgqzS2hsoM0da4YBaSxH57AgHJWIHIwXYNd1LSiiTWy4L/QDdGrpR8VWFa49lbDzkiWN8PBAnC6xgTjikciZgWVET8MDw1MvTtHfNr9D5Lgn0WxXmzJn0Tm9flkiPv67UQt4cODULaJMImpWEKKEgzhLUETmOzsqQYNO9BjPs2ks+Zm3+djZnK9wvqxawi6PH7troREjcFObYbc8DKwxxouVJpSbbgTqlja+DwS4cwdxrmvSdHhE6x8lIsk79ruajDQqSS+nq44b28mEg9TsrISaf4p3ORbEtR09rsxMIByWi50nUUZ7D+L22BZbUJg2OQefFqf38eoTUbPhIkGV+4nUwGNSyhwKQ5HEXTHCpkcxI71OcVCjAv8+oRmCQPaKoosLbFsudwV+pw7BDgohOpmC32/qzRy1/dnHcAP4c33ElTo75NfoChQsUmBRXFA39TPPW2vPudyC48dPuGVwvdatT+eszveI8gc7p3KKWD0f3/eNv/fwB/ixRYBwcv5HYzQJnmxpHqRsotv/dTIYhEVPMXr9YAgSiOfVKzKAU2sz9TmMPSh9KDmIKVXA== X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2044; 6:ZwwJ/BTByHzrMci2VjuKuW+WX5PPABhfYtNA8KyHBh+FP3lpyUB1hPEEQ8D4xlwCrfLzvdbgk83iF84ecGydw4WvRZMyl4GwZc8Bff+26iAUSVj7xa1lr108yquCzhwbJjt5P2+BSON3DK9GGwG6SNOS3aySh4gdnwMaihSark/vO+aIm3Imj1gVwFqk12TUAvpOwQJ1swhx8X0TO/SsU11W+dTAmxlscFGWDxEaD0Z6S8UnN23AMhEpWi/M9j3eNCvTrcL0CXdugQCIMB/KPPlVP5aP3Hqvk6pSs0cI3mRzIAf6ulW9TBS5OPIsiJSNBvvBD8QcCvsd0TXLuR14NUiS21kZFVKVVoB+AfBjt+cfouc3F7i+/DHvfaXUvbMxOgePRl7d8jKZnB27B/99W4ipEioC2/8cIutLOJm3iO/+9Y8EJ0AHyNYjPTp3nYLJLVpbw6SIP2sVhsII/XTQ1Q==; 5:GJIQ1OpD6boC2hv5Kx+3BXNDSpkyjbEB1/DSsDZIDhlJBcx5qm0cr9hlNikI9dtxpvE1kq0IX6JNKsRPBp+DaQZu1sBt4PPkMSNBEuB7vzmKGtUsoWrHurvkqWkK0WojBamT4WWL5FNzl1mIQdyeZ9uAKssF/iIX4RE+zGaTxZQ=; 24:WH/6XDzlvGoKiVZ5+CBIZbIemqScjA1oFYtfwVyScUU9nncdgoDqi2LbWxOnH1scou8O8WnhkzR4YTMN+16lcg== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2044; 7:8cqB61ek8NFg1XVaL+0o8ypYdb9GJOMVO3L5YxbLnNFaN24PWG4cw7Qm5scQhodnlKuW3AvjEZlxYT7ls86kSmp58N7iDGmiMGaAyBbjZnuH5jyvIrrfxhodW6fyyLwt2yPtNuyDf0I2Dl8JyyBEBH1Cogeo8JsZwWg0fQAfgNItdVGwRdNP09mOPgDUJX37XsQzkvrhm2r1mnPR0PItrDLeb0/dT8Rd10AazbmSy29fq1IUplSzvcbqMEKCchjm X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 09:38:37.2482 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6fac55b-d8a3-4887-c494-08d5e191eb34 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2044 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,