From patchwork Wed Jul 4 09:38:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10506335 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 E9370603D7 for ; Wed, 4 Jul 2018 09:39:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7B81285D8 for ; Wed, 4 Jul 2018 09:39:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B964328DD7; Wed, 4 Jul 2018 09:39:37 +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=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E0C228DD1 for ; Wed, 4 Jul 2018 09:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K0633VJfj1MLXK2DzLcTGQBk4fYObgYV0WvgLWc/2P0=; b=AKOCWbA5UfUuIR FOFJple/DJN0nRH7wKTdyixQqBTufeCCnHIWCFMa60wYmnNN49ZCFHthtnHGRaF053QvhmIipq032 LkAfHRwC60O4qsnW24BJ1YW/eMzvle9rzHpao6/jIZ2JxuMnlCrzYA8uLRb8LNsqQFBQuVEVphJDp ELgFcxcasCY9TCxmTqlb1ColITsPR88zu0eFPSi2RZJRt/U6NBku+DYqRHIWN1epxtqCYip6iOqNv TggqIRWNbRijZWcu3IZjLojBIzpHHjmUN677Mu1j9OX4d2yLppMW57wZNL/3BMqSOOLkgApqFJtC8 6DBR4n0OKn2dbIauA6Nw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1faeG2-00015g-Ip; Wed, 04 Jul 2018 09:39:30 +0000 Received: from mail-db5eur03hn031f.outbound.protection.outlook.com ([2a01:111:f400:fe0a::31f] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1faeFI-0000Tz-DZ for linux-arm-kernel@lists.infradead.org; Wed, 04 Jul 2018 09:38:52 +0000 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=grz5X/5pDop3iiXySbBAJK4c3ONW8PPJVGUDopmoq74=; b=FuIUFzSP/oY2YG7LXoeNQ9UisMwzLBwbPHN+G94sR36C6aOutWmFoEp/02WwuojZj5kUoMPtg4By75HNP7joybvOeeTWgs+MlP8lald1kjOn+/2bBEUifgKtJWRftzzUYNLwttups3/ZVPHNRDzjtdYhSS+r0LHV1L6IOUMU1Nw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christoffer.Dall@arm.com; Received: from localhost (217.140.96.140) by DB6PR0801MB2039.eurprd08.prod.outlook.com (2603:10a6:4:76::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Wed, 4 Jul 2018 09:38:31 +0000 From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/6] KVM: arm/arm64: vgic: Keep track of implementation revision Date: Wed, 4 Jul 2018 11:38:16 +0200 Message-Id: <1530697100-22419-3-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: DB7PR03CA0053.eurprd03.prod.outlook.com (2603:10a6:5:2a::30) To DB6PR0801MB2039.eurprd08.prod.outlook.com (2603:10a6:4:76::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 782a9dd8-818f-41fe-c956-08d5e191e7bb 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:DB6PR0801MB2039; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB2039; 3:sg9hrvQ75RjxkUeRtmAuaffnfGduhjDHC836dPggrAA+Sh5YYwvcidEQmaqQmJJG7qJ8NWAO46UVgwkuO2pF/aRPSlpfbqoVgozL5oqjBv7Y8PH3sc5e8drc+ynOz8HQVJo6y43uJK2znJ9hAdQh3dYiwmmXFuGbKUxVwL2AejNAdMuA2ZhlP5YsbRggLHv+jE/xLq1RK9vDi1hLPixQcyIA9Y/hKSCcDg1yv2JoXCPjjr+hWhjjsnqDYZDdrwMr; 25:kr3xR+c9hmh7smHHki/AjGySAGMiURDyLaaXCxgzsnMgu8DyXMITs9CZ3coxFPydcVfodltw6d1XY8yFI4huB1OBr/OBqn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eD; 4:KNYiNpjpOd9l5+TFOh5MPIt7bX/zvq/P5oeU/7Gt32uZ0vRPICbIhf0JiKVcWIIumEVcnVSAJqqyfTzSTSt5gySgHgw8ZOTecQ++up9NybPnYfw0gGTavoIvYRawEn34+J3Mri1WHUqYu336MH07UYLj8XCC5R7atSGvgF586/ujBNhM18rkbX5kcA+lDkA+u9c2JTXmZc55aRFlXyRz2OgUw5cw/aSS0ut7di2+LeWZ09bm4x2I4TNjI4hQ7akVPnp6VwXZac09NCsF0+2pOdE8Ocd9pSSx4Uz6k0PL1sgC/274mc9tu3Q+FHfYPELYFLJdwV5Kr91aqFWbMu+L5jDU4nUHYYOJC5ak04qAroImLqxGptL2pWNHqgLQHYDO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(209352067349851)(223705240517415); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB2039; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB2039; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6069001)(396003)(346002)(376002)(366004)(39860400002)(136003)(189003)(199004)(40434004)(6496006)(5660300001)(52116002)(81166006)(51416003)(2171002)(26005)(81156014)(5024004)(44832011)(446003)(6666003)(8936002)(50226002)(476003)(36756003)(486006)(2616005)(956004)(50466002)(68736007)(8746002)(14444005)(53936002)(66066001)(47776003)(8676002)(72206003)(11346002)(48376002)(2906002)(76506005)(54906003)(105586002)(186003)(305945005)(106356001)(6486002)(7736002)(76176011)(6116002)(25786009)(386003)(478600001)(3846002)(16526019)(86362001)(575784001)(4326008)(97736004)(316002)(23200700001); DIR:OUT; SFP:1501; SCL:5; SRVR:DB6PR0801MB2039; 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; DB6PR0801MB2039; 23:XUm+B1e/RejaZGLuRU0zonHhyyBjtOjR9wXR2iT?= =?us-ascii?Q?E8gYWILo8abxQkoyYqXhuLsAGuA1QfQugKmcCUUGru20C/QviOb3h5/zTMr7?= =?us-ascii?Q?Eukrkvs/tT3htdCXM2PJ4S6wUdA4UC1dXwf7m1bu4cLG1+gvZP/LyAqmsxVn?= =?us-ascii?Q?p/5BrCF7yhEL0OCfHzhHGdvEa+KOWXuLQXnRUukgllqnAioBGKzrMl9eGA8k?= =?us-ascii?Q?nKP8DEVq9P1gH9U97t9qn4ad9UBCv9slWxgMSp3nLu3TvahRiPflZieksAQA?= =?us-ascii?Q?wDrZMGaEUpjtMsHQFHBqMcqqs3m8YozFn8RuxX678jHDA3opswZ71rR+J+tZ?= =?us-ascii?Q?oogew7nJpbBLgeKdsrqzK0rT7d0A0Qt1MYH0p7bmaLoyFtrXo8KVK7QzsYvA?= =?us-ascii?Q?d2GDSflaGylg2CUU5dlmuOhr5YuY9umPIPEirJeESiuGYL9CQiE9mDME29k0?= =?us-ascii?Q?e6lTRTgPILc8amgU6LNlf0niylLvwU2dT+ur1c8sCU7iQU9uOrAJlwdbq8KI?= =?us-ascii?Q?OKD52xrvSHYeV7KUTuMhFpdDjguavlVPThUMBFS6R64qfK3tzPBuZ5fmGUr8?= =?us-ascii?Q?F0PST6I1N7sJJstZCzaI66fjc96CP9zjufs3qulBQUQrx9HWfTvPnzhtdCCL?= =?us-ascii?Q?uvu0ORlW7+3oR3F3nSA8kCw3uA2B4+7BOOHTlx0NxiXCzzx9cWClR35ZNcs7?= =?us-ascii?Q?9M/Cpo65jrLLONS6V6jJ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1qm+ltpylKJh3UMVTwRmLX/rZSkrv/U3G9gSRIFkBba2ZnuIz8RiygSGzOKQLFIRkw0gD/ODWMariadiLfA== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB2039; 7:xrdSHsqLrcyfsz9GWsn1Xm3OHlBV1WQ35U4tartqVsFb4A9CPJL/5Qz+CwhHlP5j5DRiVG7t83TrQGvtQjwbAm5AOBJx8jj1UP5gzlZsqV57mwNkiYATq+oRQj9zkTKqyXDLqdH+3m/7GKydu6LhQ7CwkkpZPTR/FmHPqwJ9iQyH6UxX0fvLmVieCFlUqmlwEEaTIkMhJx8IA0ctLXNYbKArkaF0oLez7vMLaMvBNVbt8YsuC8al4wa98MzD3XrU X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 09:38:31.5113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 782a9dd8-818f-41fe-c956-08d5e191e7bb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2039 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180704_023845_023271_3406C7A1 X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , kvm@vger.kernel.org, Marc Zyngier , Andre Przywara , Christoffer Dall , Eric Auger Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As we are about to tweak implementation aspects of the VGIC emulation, while still preserving some level of backwards compatibility support, add a field to keep track of the implementation revision field which is reported to the VM and to userspace. Signed-off-by: Christoffer Dall --- include/kvm/arm_vgic.h | 3 +++ virt/kvm/arm/vgic/vgic-init.c | 1 + virt/kvm/arm/vgic/vgic-mmio-v2.c | 6 ++++-- virt/kvm/arm/vgic/vgic-mmio-v3.c | 6 ++++-- 4 files changed, 12 insertions(+), 4 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/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index cfdd248..7e64c46 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -217,6 +217,9 @@ struct vgic_dist { /* vGIC model the kernel emulates for the guest (GICv2 or GICv3) */ u32 vgic_model; + /* Implementation revision as reported in the GICD_IIDR */ + u32 implementation_rev; + /* Do injected MSIs require an additional device ID? */ bool msis_require_devid; diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index b714179..8b6fc45 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c @@ -298,6 +298,7 @@ int vgic_init(struct kvm *kvm) vgic_debug_init(kvm); + dist->implementation_rev = 0; 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 af44e569..f0c5351 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v2.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c @@ -25,19 +25,21 @@ static unsigned long vgic_mmio_read_v2_misc(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len) { + struct vgic_dist *vgic = &vcpu->kvm->arch.vgic; u32 value; switch (addr & 0x0c) { case GIC_DIST_CTRL: - value = vcpu->kvm->arch.vgic.enabled ? GICD_ENABLE : 0; + value = vgic->enabled ? GICD_ENABLE : 0; break; case GIC_DIST_CTR: - value = vcpu->kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS; + value = vgic->nr_spis + VGIC_NR_PRIVATE_IRQS; value = (value >> 5) - 1; value |= (atomic_read(&vcpu->kvm->online_vcpus) - 1) << 5; break; case GIC_DIST_IIDR: value = (PRODUCT_ID_KVM << GICD_IIDR_PRODUCT_ID_SHIFT) | + (vgic->implementation_rev << GICD_IIDR_REVISION_SHIFT) | (IMPLEMENTER_ARM << GICD_IIDR_IMPLEMENTER_SHIFT); break; default: diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index c03f424..ebe10a0 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c @@ -62,16 +62,17 @@ bool vgic_supports_direct_msis(struct kvm *kvm) static unsigned long vgic_mmio_read_v3_misc(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len) { + struct vgic_dist *vgic = &vcpu->kvm->arch.vgic; u32 value = 0; switch (addr & 0x0c) { case GICD_CTLR: - if (vcpu->kvm->arch.vgic.enabled) + if (vgic->enabled) value |= GICD_CTLR_ENABLE_SS_G1; value |= GICD_CTLR_ARE_NS | GICD_CTLR_DS; break; case GICD_TYPER: - value = vcpu->kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS; + value = vgic->nr_spis + VGIC_NR_PRIVATE_IRQS; value = (value >> 5) - 1; if (vgic_has_its(vcpu->kvm)) { value |= (INTERRUPT_ID_BITS_ITS - 1) << 19; @@ -82,6 +83,7 @@ static unsigned long vgic_mmio_read_v3_misc(struct kvm_vcpu *vcpu, break; case GICD_IIDR: value = (PRODUCT_ID_KVM << GICD_IIDR_PRODUCT_ID_SHIFT) | + (vgic->implementation_rev << GICD_IIDR_REVISION_SHIFT) | (IMPLEMENTER_ARM << GICD_IIDR_IMPLEMENTER_SHIFT); break; default: