Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp880352ybi; Fri, 2 Aug 2019 05:55:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIoEfbOzkam69WknkazXdcKFuDfx1G2CmaXDapC/86mehyAmI7kEC+BsQuNepfuxdM8JtO X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr4254203pjr.94.1564750509817; Fri, 02 Aug 2019 05:55:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1564750509; cv=pass; d=google.com; s=arc-20160816; b=f4UnfmJlyp19z7IgE0usO/U8h/fb05s1YF+agE4rMd1A86eSM+M677DajjZ1DwF21z isKN4EXVWHbNhJBkPi7p+N2pIOXueEdKh4hafIo00qTwqE6MDEyixdwwtwqHljDQWUyl qEezIlRsrToGnob5R3xIWqg4wCFk5zwwALvQb7thzeR3OeOqRFD+FGuim/Uap9pJBC1v xZ7SV/H/BYcgPXq0SwmwLTDypQ57T9xgvwYOjmmo+a2cY3Xlbyhn8qSivULnOoORaYyH +kThW+F6W686yRxO9q/DW+4xe1732hSKE87lzYk3YXqUCEmdh5wfqosA+OENSsAmBkIL tKog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :wdcipoutbound:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:ironport-sdr:dkim-signature; bh=caRpajzSVpBPjhqMi2IoMp9REmOb3dOIVMidSRAcrxg=; b=ocENEgIHuOG3h0yv2Wk/Iq1lDQJfP7Gvdjn3pt+Ra0aY6sERrJAMNpuTzLMdlF/qqO HFhFGrgYXo0pCTkGYn3MMOmdS1ZxiBjaxeWrER3OHbkLKW14G+z5rvuLTtg+7SxWI3Gv jXPZbnSM3+8LD/YSDXhKHvMgvNqRnxUeU7rrVS3g8oCzqeSTDP+BGWEwsGvZTJoE+e6j uzM1c8IJUkqAderPZF8dV03nhNiPHj2tGMXxNMYWfizqpYKlP5gK96wD3u9fMaIFqVMB Dlf6i+fqgFOm3pVCILeYHkH9sJcYR3eG4CxlPtl3LLuhtMoc7pBSDCjoo+z49T4Bn9Ml TzIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=gQj7q5hj; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=bA7Xifdv; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si35246236plf.250.2019.08.02.05.54.54; Fri, 02 Aug 2019 05:55:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=gQj7q5hj; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=bA7Xifdv; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390137AbfHBHrR (ORCPT + 99 others); Fri, 2 Aug 2019 03:47:17 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:62971 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390117AbfHBHrQ (ORCPT ); Fri, 2 Aug 2019 03:47:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1564732036; x=1596268036; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=E1j6Pb427CcQeVW7c3luwWNPehcIlXqi1Wpyb7HstMI=; b=gQj7q5hjzmxseMw4cGNWySREpQowLlAUK1H0/ZuzmBj5k6+FBSv1akZR 4TtrPrJSgxLTVEsGaye5YamkYBwNNAQFRKtxqDB4f6LL5pQ6+bGGvc5UR e+uDZ3FB2YGK4Mj0fXhnPzPILYBKAtlSSJWNmN8/I0D0WaXbCkgj8CMIi MtsUq7qQQ4YdnuAuBcVMNfFQUiajy8VMRDBdpe+Casl/ZUjX+MtyDXHNZ y5D5InEAwo196tzKXivqXU3cL787D18VFBTJvNghbLBuEA4khmBj+Z3Fs ThVmVbY+Q61of2tVF1mHKw/Q4WdkfH154shBZqB2ORQpylJYKqlJrPLfz Q==; IronPort-SDR: qYrVkP5WBdBMGxEfYAWdEbzEmupR5pfUZOIIxV6uBELECOuRln4J0FP5883v/unbpJQ5r8pBLV K+F9RjFdTbaaSRt21C6uC9XSiFZbfVwQjRPcymfRV2Gd+H51psJAkPDlrUHde2pR8jrH7mLQ6q kDBEaMPaFdT0As8JKGwFvI/v5YPAc8K6cmeJAaC86+WgpekqGtnojTQLuM6Hy40suvdyCNOtQo MWcxUuBOd5mWv+bGFa/mZ7vI9aZL4Mf4ZIIMNBfk7L1fgDGfBURKmCtYtyA9P7nnqSS5FmA7HG kZk= X-IronPort-AV: E=Sophos;i="5.64,337,1559491200"; d="scan'208";a="114783182" Received: from mail-by2nam01lp2054.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.54]) by ob1.hgst.iphmx.com with ESMTP; 02 Aug 2019 15:47:14 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kIAb3sxAmeemHt3aL5TadddqEiodKcJSmHCL0NmTZxAFFTC9SqO0cryHQpXon0/J8QTImgzsL8OF96vcq9ni10GPPJKxDrbDo/WQYrmYOaXOq8KEMuC6Ib/QiDlexENjf5T/5XXAOnWlNV4JtpU32Ulprovhi7krcyZwgb1IUXqHJkoh3lVmPAtwypDBD9+ucQHRBxEBFGw5BrsFd4YmK7TXuv/dACgtQB3R0aGw2NM6WizSPef0oLcKNdOsxF438qNuC1cWQTcSz7GT9lNtXS1YIBn9a4e2EKugVxUltu92MkwoEvjdwImMBeISFzn0cj7uM2EOVXlJHvcUwPphfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=caRpajzSVpBPjhqMi2IoMp9REmOb3dOIVMidSRAcrxg=; b=VQYoAtSyF6En6hg2dwyJLWgizg4Ut2vyKeHErhxxwljKrbuENIee4kcUtogl8VpyWIoxKgr1dpkSOYkLT6ctZVL37QkVIeNCyDfs7nyli8h30GIssWwUAeTpVxy6KZhk4zbURDTn68p6CnDPQ0/MDOVfVJWaJUEd3EISGQGyUP3wISodKUJoj173npEhtYMVffmoHeeezmS1L3FWImlm8uWNSs0y2jgBG0ATGyu33SEZQ9FXDwkY714tNlRgwSDE87U8/W+rFVOasZby/BhAswBsGcEh2hZWWFCr7UyRcALWD3iRJXR5S6A9loZJV2CVvTWK8HlNjJFOWr1YQ7VmJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=wdc.com;dmarc=pass action=none header.from=wdc.com;dkim=pass header.d=wdc.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=caRpajzSVpBPjhqMi2IoMp9REmOb3dOIVMidSRAcrxg=; b=bA7XifdvSX4xoPWHVqFxmAFGT8BrUtOPGV1BQz2TBWbEzPTUJXmcfw6NaQIdCgwx2OY42zPf13JT+3VrMjOzhdKCxSfSyA87cNwWAIpXb5QxU6zOlXPR62i41qwJiIj9w222KHRYqZX+bjKddtcchnOxfXP/EiTGYKy4IEgpgZY= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.246.15) by MN2PR04MB5566.namprd04.prod.outlook.com (20.178.248.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Fri, 2 Aug 2019 07:47:13 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::a815:e61a:b4aa:60c8]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::a815:e61a:b4aa:60c8%7]) with mapi id 15.20.2136.010; Fri, 2 Aug 2019 07:47:13 +0000 From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Paolo Bonzini , Radim K CC: Daniel Lezcano , Thomas Gleixner , Atish Patra , Alistair Francis , Damien Le Moal , Christoph Hellwig , Anup Patel , "kvm@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Anup Patel Subject: [RFC PATCH v2 03/19] RISC-V: Add hypervisor extension related CSR defines Thread-Topic: [RFC PATCH v2 03/19] RISC-V: Add hypervisor extension related CSR defines Thread-Index: AQHVSQZ/4jLg1fzj50ihG1e1f79rWA== Date: Fri, 2 Aug 2019 07:47:13 +0000 Message-ID: <20190802074620.115029-4-anup.patel@wdc.com> References: <20190802074620.115029-1-anup.patel@wdc.com> In-Reply-To: <20190802074620.115029-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::27) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:d8::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [106.51.20.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f4c24bc0-0e5d-494e-24e5-08d7171da1c7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:MN2PR04MB5566; x-ms-traffictypediagnostic: MN2PR04MB5566: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:5; x-forefront-prvs: 011787B9DD x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(346002)(376002)(39850400004)(136003)(366004)(396003)(189003)(199004)(36756003)(14454004)(7736002)(54906003)(6116002)(102836004)(110136005)(71190400001)(446003)(4326008)(3846002)(5660300002)(52116002)(66066001)(2906002)(25786009)(6486002)(6506007)(386003)(55236004)(76176011)(316002)(53936002)(6436002)(305945005)(9456002)(81156014)(64756008)(66476007)(78486014)(86362001)(66556008)(66946007)(8936002)(11346002)(476003)(68736007)(81166006)(2616005)(478600001)(486006)(26005)(1076003)(99286004)(50226002)(256004)(71200400001)(66446008)(186003)(6512007)(44832011)(8676002)(7416002);DIR:OUT;SFP:1102;SCL:1;SRVR:MN2PR04MB5566;H:MN2PR04MB6061.namprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NCNOkXcbm4ABGWWc2rDGmHSpc04xAHnliSNXFh24jiRa6ApQd7PGewSTnC/5rGt8cT8Ek61Rw/07KmbG/ccFCTCcf0Jm4SctwllHULR5erXhg2RY+jlxAjssQgVzZwjA9C76IuGEbESijqeceXgNbcOZw6engL0qZGQnTcgcfaZLwiByBt/Mv0A722t6sSqIUzucHIXVML8OYRpShLF6fJEDDol9U37Ii4vW6mwr2b9/P8I5bPNXZ80tcdfddqpwR+WWx5h7WnRq2rXhVe0zxtJsawHXYerXbe9foeOAWdIdGY6QxDxQn7/GChB/JAJzjhW1gJlffJa7GqqFLdTTQtI3KoUxDVCtJ4W8/M0hYYa9gY6eVN3jguT/fXVWzoIkMLfRzyDll2FlrtVHps+pkEd2HBPqXeXUCTlbD6KEoCg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4c24bc0-0e5d-494e-24e5-08d7171da1c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Aug 2019 07:47:13.3556 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Anup.Patel@wdc.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5566 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch extends asm/csr.h by adding RISC-V hypervisor extension related defines. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index a18923fa23c8..059c5cb22aaf 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -27,6 +27,8 @@ #define SR_XS_CLEAN _AC(0x00010000, UL) #define SR_XS_DIRTY _AC(0x00018000, UL) =20 +#define SR_MXR _AC(0x00080000, UL) + #ifndef CONFIG_64BIT #define SR_SD _AC(0x80000000, UL) /* FS/XS dirty */ #else @@ -59,10 +61,13 @@ =20 #define EXC_INST_MISALIGNED 0 #define EXC_INST_ACCESS 1 +#define EXC_INST_ILLEGAL 2 #define EXC_BREAKPOINT 3 #define EXC_LOAD_ACCESS 5 #define EXC_STORE_ACCESS 7 #define EXC_SYSCALL 8 +#define EXC_HYPERVISOR_SYSCALL 9 +#define EXC_SUPERVISOR_SYSCALL 10 #define EXC_INST_PAGE_FAULT 12 #define EXC_LOAD_PAGE_FAULT 13 #define EXC_STORE_PAGE_FAULT 15 @@ -72,6 +77,43 @@ #define SIE_STIE (_AC(0x1, UL) << IRQ_S_TIMER) #define SIE_SEIE (_AC(0x1, UL) << IRQ_S_EXT) =20 +/* HSTATUS flags */ +#define HSTATUS_VTSR _AC(0x00400000, UL) +#define HSTATUS_VTVM _AC(0x00100000, UL) +#define HSTATUS_SP2V _AC(0x00000200, UL) +#define HSTATUS_SP2P _AC(0x00000100, UL) +#define HSTATUS_SPV _AC(0x00000080, UL) +#define HSTATUS_STL _AC(0x00000040, UL) +#define HSTATUS_SPRV _AC(0x00000001, UL) + +/* HGATP flags */ +#define HGATP_MODE_OFF _AC(0, UL) +#define HGATP_MODE_SV32X4 _AC(1, UL) +#define HGATP_MODE_SV39X4 _AC(8, UL) +#define HGATP_MODE_SV48X4 _AC(9, UL) + +#define HGATP32_MODE_SHIFT 31 +#define HGATP32_VMID_SHIFT 22 +#define HGATP32_VMID_MASK _AC(0x1FC00000, UL) +#define HGATP32_PPN _AC(0x003FFFFF, UL) + +#define HGATP64_MODE_SHIFT 60 +#define HGATP64_VMID_SHIFT 44 +#define HGATP64_VMID_MASK _AC(0x03FFF00000000000, UL) +#define HGATP64_PPN _AC(0x00000FFFFFFFFFFF, UL) + +#ifdef CONFIG_64BIT +#define HGATP_PPN HGATP64_PPN +#define HGATP_VMID_SHIFT HGATP64_VMID_SHIFT +#define HGATP_VMID_MASK HGATP64_VMID_MASK +#define HGATP_MODE (HGATP_MODE_SV39X4 << HGATP64_MODE_SHIFT) +#else +#define HGATP_PPN HGATP32_PPN +#define HGATP_VMID_SHIFT HGATP32_VMID_SHIFT +#define HGATP_VMID_MASK HGATP32_VMID_MASK +#define HGATP_MODE (HGATP_MODE_SV32X4 << HGATP32_MODE_SHIFT) +#endif + #define CSR_CYCLE 0xc00 #define CSR_TIME 0xc01 #define CSR_INSTRET 0xc02 @@ -85,6 +127,22 @@ #define CSR_STVAL 0x143 #define CSR_SIP 0x144 #define CSR_SATP 0x180 + +#define CSR_VSSTATUS 0x200 +#define CSR_VSIE 0x204 +#define CSR_VSTVEC 0x205 +#define CSR_VSSCRATCH 0x240 +#define CSR_VSEPC 0x241 +#define CSR_VSCAUSE 0x242 +#define CSR_VSTVAL 0x243 +#define CSR_VSIP 0x244 +#define CSR_VSATP 0x280 + +#define CSR_HSTATUS 0x600 +#define CSR_HEDELEG 0x602 +#define CSR_HIDELEG 0x603 +#define CSR_HGATP 0x680 + #define CSR_CYCLEH 0xc80 #define CSR_TIMEH 0xc81 #define CSR_INSTRETH 0xc82 --=20 2.17.1