From patchwork Wed Jul 4 09:38:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10506329 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 EBF57601D7 for ; Wed, 4 Jul 2018 09:39:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC969285D8 for ; Wed, 4 Jul 2018 09:39:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0E3228DD5; Wed, 4 Jul 2018 09:39:12 +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=ham 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 3F8C028DD1 for ; Wed, 4 Jul 2018 09:39:12 +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=TaqDDoHD+tkvhYz3T6mNQOxr41/FBj7bhTufmhsWuyo=; b=p4now8E4S1QMu8 yGVnI58AksqobrmlfCWnhTvwGbZkoB6iGsnsb7dnI4GfjzfQVdfjbFNGbbePNgcT13J3M5s9zjbTY YQmlhHAvLRQa/zlQk8C8tr/dsxp6hzIQk/qFW9WSe0PaJ3sY1dR1ctGc7/XDj/ny9cwYbn/Am+qC7 7N41XnMTKYvAVorYXG70jS5Bk8+RwLbsuVr5OPMhLiAkR4eUpugGrESePJFm/+uBIJL5rAtCjPgf8 edeSRGSNY3xjjfc9Y0/mDNQjRRPQuRxWqJZ4PAvZIV7YM/YCHfiJCb3seOzgECXrjCZYPIhgVRFDz wQU3R3KhjwQu3YwIk+yQ==; 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 1faeFZ-0000kJ-8A; Wed, 04 Jul 2018 09:39:01 +0000 Received: from mail-ve1eur03hn0321.outbound.protection.outlook.com ([2a01:111:f400:fe09::321] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1faeFH-0000Te-0o for linux-arm-kernel@lists.infradead.org; Wed, 04 Jul 2018 09:38:48 +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=dB5eWhd3vLlQ9/Uqqutx6YUMnAbfyWDW2idEs/4NZBY=; b=LK6I84qoi07hkHp9nQG5f/kY8D6bGcnzwR9lC0ZEN6eH4b0Pse/7vyUQiZ9FQ+BMEzmOdYZaCPmBPfz0M8UtVY1T9VRbRRu58mp/NRSFPL9QycnKlWTRhEmyWxh79TQL2LJbEulXDdwI1mkb8kjVrHzNrRfsYwdnx/isCm+pg7E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christoffer.Dall@arm.com; Received: from localhost (217.140.96.140) by HE1PR0801MB2043.eurprd08.prod.outlook.com (2603:10a6:3:50::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:28 +0000 From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/6] KVM: arm/arm64: vgic: Define GICD_IIDR fields for GICv2 and GIv3 Date: Wed, 4 Jul 2018 11:38:15 +0200 Message-Id: <1530697100-22419-2-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: DB6PR0902CA0028.eurprd09.prod.outlook.com (2603:10a6:6:2::41) To HE1PR0801MB2043.eurprd08.prod.outlook.com (2603:10a6:3:50::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfbc5853-ae31-4d20-309b-08d5e191e60f 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:HE1PR0801MB2043; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2043; 3:3O07V6z2BUwtu1vlpRpeEMTp+z1XsUuoQbwfX+Kud9nEPe8SWtJmqkaaYy/snLvLIdNPc5BQ7qEf4x/vhlDcQyRG0M4Xp5YoOjjZs7KUbmoiha0ptUvptkh6iwJ0KpwStaf75kq4kInywj5JtvzdE2SODN6/2pe89eBw5Wn5viSkEbnVVpDQ5dUnlVYQ3TFu68whyc2wO/Cx62mc/Nb+Fsg6Yqyk+4TdluAW032SKkrmV2v53StRMEqvdc9vujYb; 25:vu47WVG5EoGfuEhuWh4g+48J1mkz3l1DBRdOUtAyiviZ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XjYxd0o3kM2SeQppnjbyL1XcMKaE5UG6; 4:Dre39mNWgt7q6p7LVtKHN3gSKxGb7Gu1olhNvVNHz9lX2PYVZhuWYKztceQ10fP3U4qGKFH2tF1DOIvfYxLSNbgvkBcqFb03A6DV8OdDVkQyCwdOj55FRduT2g5BrKCAdidtEkhjENsqnDpSOCprUmZrKI8cbYOKj+f0c4ko3rRxygT2oxZGEk0QtwrT+wJYB7nvAiWBkiyQxbGKrGw7J52pV5SjMNEoqh9Gd+UYbcfQ0j52xu32vNmP8BMneNT/pSTZfWFo0RpHzoRBtx7Kb1Y0kIXKxvJXRRNFWyzbd/wDBByXZqPzh1ZdVsb1bLQlUvP2XgIfMhQF08FxvsAvyOP0hFf8ew55qTMHWN+D3C2dQM0m8uObwqzuho2lPn/D+boSrbwgZJybbpITnB4TMutpJhElwJYec3sMQMuTfKA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(209352067349851)(192374486261705)(223705240517415); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB2043; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2043; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6069001)(39860400002)(366004)(346002)(376002)(136003)(396003)(40434004)(189003)(199004)(44832011)(11346002)(2616005)(446003)(486006)(956004)(47776003)(76506005)(105586002)(106356001)(51416003)(476003)(5024004)(6496006)(6666003)(54906003)(316002)(52116002)(68736007)(66066001)(3846002)(6116002)(36756003)(386003)(5660300001)(6486002)(186003)(76176011)(16526019)(26005)(81156014)(2906002)(7736002)(72206003)(8936002)(305945005)(50226002)(81166006)(97736004)(25786009)(8746002)(4326008)(53936002)(48376002)(8676002)(50466002)(14444005)(86362001)(478600001)(2171002)(23200700001); DIR:OUT; SFP:1501; SCL:5; SRVR:HE1PR0801MB2043; 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; HE1PR0801MB2043; 23:/XmF81MtsWJkuvm+dDYeyKm1VNXRfbQ4xE5r7NP?= =?us-ascii?Q?1kuMszXBr6kRPrkZyEpKwdiWV1d48Y9ZEtkzM+p78PQvrYXF0XFCjjys+umz?= =?us-ascii?Q?nIzNrLBWn9XKA6Kq/UVfoaWGx7b79HmfmeqBWBF3FIiOyGWDa5OnrvA4nSS0?= =?us-ascii?Q?APIOozuW0PZifKd4Dlxj1rA4DftFpf/Y9GbcYhWr+0noQctJW51FIojlmkeA?= =?us-ascii?Q?Se4gQbS81xn0Lwyieik6FrnfEvIqkSQf6te24D4mllou/rscsXHNBVxVk6kc?= =?us-ascii?Q?+LyXkC8YbXytktzuVWeCwlpV56qa5ZUzgtTrukUHOuQfhOCs/kY/+ue8CLwe?= =?us-ascii?Q?ml2/V3pYeC7jHOvGEl7Jw4dfL2z/jF/maW+skvyqE5fWdYqEWfZkl+YKBYMv?= =?us-ascii?Q?6vBJmt/RZAe+/9/tTFpLZ/9SKp+AwUi8jm/vpCrL2fEOSsR5RXph2kHIiabI?= =?us-ascii?Q?x1ZVHi/s5i8EKZbS/Ivefd7JVMF3+Tpu5QYN1deRLsqJjfBiLycha+ei73Oy?= =?us-ascii?Q?QWSpzp9HT5gjAuYfACNRlY+ybVBxzmo3DU6M1os/XzNDKb/HYLogrfYkoc/k?= =?us-ascii?Q?pL4rnF5orRTR3YVJYiRN0Dt+JswCyV2LRz9qgcWu12qf1Vm5QKgniZsz0x0L?= =?us-ascii?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dqhnxGeviNvyvjGyhvjFpC/q+yjVxEc+0ARPzSmTH6hbknk1etL5M3A=; 24:CvCxwkvLssddSVaazq0zZ9SCBDGqgfvS83Pj0oWhlc5hdYJUmZRQhNLkGj87iC1glzxl4yyRqCf+3hfPCRfz7w== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2043; 7:S8EEHRvUqNcyHnROBfGnNuTYT7t3Su68vITK+Q6GYpLONdCQJH22f3nRH/Y6Icv/l2W4xXbmFkxK3wbbfxEks0PZyDes3x5wepoPuc3HuY3Rc2eyPoCrJMA0H/6uuJ3yJ7UD5ra+15Xj0FuLHbqYy1L7Ei0StiDEOGSwkZTcXoEnCHYP8HihW/PpwYsAFwGq/P9piHPl0DW3DLRQ068HtNd+0oDzdMgVLkLEAUVPJ07g2Au+Rw2+9wk9Se+hNldN X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 09:38:28.6693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfbc5853-ae31-4d20-309b-08d5e191e60f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2043 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180704_023843_582521_861BAA66 X-CRM114-Status: GOOD ( 12.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 Instead of hardcoding the shifts and masks in the GICD_IIDR register emulation, let's add the definition of these fields to the GIC header files and use them. This will make things more obivous when we're going to bump the revision in the IIDR when we'll make guest-visible changes to the implementation. Signed-off-by: Christoffer Dall --- include/linux/irqchip/arm-gic-v3.h | 10 ++++++++++ include/linux/irqchip/arm-gic.h | 10 ++++++++++ virt/kvm/arm/vgic/vgic-mmio-v2.c | 3 ++- virt/kvm/arm/vgic/vgic-mmio-v3.c | 3 ++- 4 files changed, 24 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/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index cbb872c..b22f9df 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -61,6 +61,16 @@ #define GICD_CTLR_ENABLE_G1A (1U << 1) #define GICD_CTLR_ENABLE_G1 (1U << 0) +#define GICD_IIDR_IMPLEMENTER_SHIFT 0 +#define GICD_IIDR_IMPLEMENTER_MASK (0xfff << GICD_IIDR_IMPLEMENTER_SHIFT) +#define GICD_IIDR_REVISION_SHIFT 12 +#define GICD_IIDR_REVISION_MASK (0xf << GICD_IIDR_REVISION_SHIFT) +#define GICD_IIDR_VARIANT_SHIFT 16 +#define GICD_IIDR_VARIANT_MASK (0xf << GICD_IIDR_VARIANT_SHIFT) +#define GICD_IIDR_PRODUCT_ID_SHIFT 24 +#define GICD_IIDR_PRODUCT_ID_MASK (0xff << GICD_IIDR_PRODUCT_ID_SHIFT) + + /* * In systems with a single security state (what we emulate in KVM) * the meaning of the interrupt group enable bits is slightly different diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 68d8b1f..484f5bf 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h @@ -71,6 +71,16 @@ (GICD_INT_DEF_PRI << 8) |\ GICD_INT_DEF_PRI) +#define GICD_IIDR_IMPLEMENTER_SHIFT 0 +#define GICD_IIDR_IMPLEMENTER_MASK (0xfff << GICD_IIDR_IMPLEMENTER_SHIFT) +#define GICD_IIDR_REVISION_SHIFT 12 +#define GICD_IIDR_REVISION_MASK (0xf << GICD_IIDR_REVISION_SHIFT) +#define GICD_IIDR_VARIANT_SHIFT 16 +#define GICD_IIDR_VARIANT_MASK (0xf << GICD_IIDR_VARIANT_SHIFT) +#define GICD_IIDR_PRODUCT_ID_SHIFT 24 +#define GICD_IIDR_PRODUCT_ID_MASK (0xff << GICD_IIDR_PRODUCT_ID_SHIFT) + + #define GICH_HCR 0x0 #define GICH_VTR 0x4 #define GICH_VMCR 0x8 diff --git a/virt/kvm/arm/vgic/vgic-mmio-v2.c b/virt/kvm/arm/vgic/vgic-mmio-v2.c index ffc587b..af44e569 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v2.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v2.c @@ -37,7 +37,8 @@ static unsigned long vgic_mmio_read_v2_misc(struct kvm_vcpu *vcpu, value |= (atomic_read(&vcpu->kvm->online_vcpus) - 1) << 5; break; case GIC_DIST_IIDR: - value = (PRODUCT_ID_KVM << 24) | (IMPLEMENTER_ARM << 0); + value = (PRODUCT_ID_KVM << GICD_IIDR_PRODUCT_ID_SHIFT) | + (IMPLEMENTER_ARM << GICD_IIDR_IMPLEMENTER_SHIFT); break; default: return 0; diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c index 2877840..c03f424 100644 --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c @@ -81,7 +81,8 @@ static unsigned long vgic_mmio_read_v3_misc(struct kvm_vcpu *vcpu, } break; case GICD_IIDR: - value = (PRODUCT_ID_KVM << 24) | (IMPLEMENTER_ARM << 0); + value = (PRODUCT_ID_KVM << GICD_IIDR_PRODUCT_ID_SHIFT) | + (IMPLEMENTER_ARM << GICD_IIDR_IMPLEMENTER_SHIFT); break; default: return 0;