Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp710248pxf; Thu, 1 Apr 2021 11:28:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx05H82CZfq/tmvNbzsXsLjNgeaEF3Ie0e7OowzlwihBjicCCMLiP+aYbpwzCW4kld4Ggr1 X-Received: by 2002:a92:b05:: with SMTP id b5mr8067712ilf.240.1617301714184; Thu, 01 Apr 2021 11:28:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617301714; cv=pass; d=google.com; s=arc-20160816; b=Yt1HjVv7y6ybJjwjreFozu+3btgjnUPvG00e2+vOPcRpNN/Cnc5Z9b5HoOJwETo/WP O4I6KtP/FptXhoNg1BfvsnnfLX38/u3co3fx/UDdIcQGYFGTwDnVDiXS0tPPP7t/cy18 Y0sEYuBkGh3ctiUI/num0LBymXYop9eg0gBvi9M/RmPwViA54X/08bInf4DYMpZDnKJB eggxVNqQPtlA7C+Al9eSVMSAKfU1YC1PFmaraQWtNk/vasnlN+OUKVa2CLiJTNnmffBT wjLwM5InpHra63wiAc7m1ezaFgWJLl2S7vEj8O2haMyfTS0AkPx1bfk8mY6yKj5qWdmB 82Iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:wdcipoutbound:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:ironport-sdr:dkim-signature; bh=WMFbBdH20e9gmuUIgGAsu8DFOU20JzHlhs9rWAYeIQk=; b=hwA7HVfFmi/V59/KgNg7JoMUppw4SsD9geYeB/XFoH6UxRdijByVS3Mtuef+r7sEHT 6MgYknEgJmC6cn6CuEkn4JLhGqrCZSi4ohs6z2UOxUVjkC08SOKu6c2FqoBTmAwO72IP luxld2psKhOg8geQLa21sie1Hare79ecx/Su/k3ZsADwfZP9l57SleYn1spJgFDFe7gH oedSZzLzaTIhrbXX/Z9g1Go2ws4rjh9kh2aG6NQaQvQYjk2MgKVONqveAmRY2MtT+jpq puRDHKxl5ygBwOW+2HuibC8f5Ocd5miY5+WUPyFbSSo3Ikmbun6u/oCri61HkIb27Y0c w6kA== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=NwUcZTj8; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=nZdXft0J; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n14si6016245jaj.25.2021.04.01.11.28.21; Thu, 01 Apr 2021 11:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=NwUcZTj8; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=nZdXft0J; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237540AbhDAS1x (ORCPT + 99 others); Thu, 1 Apr 2021 14:27:53 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:59599 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237414AbhDAR76 (ORCPT ); Thu, 1 Apr 2021 13:59:58 -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=1617299999; x=1648835999; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=vumkxA54k8bzMPc+ScIMUROu21oDKZ744XYCE6mvFR8=; b=NwUcZTj8rKNFSqO6pK5/stidhO1S/RfY42NWkRk3vDhXq8DKwD91o7LS VJclrZiciQVUzcu5Vq3pxgr1n0/QyV690evJW40veB29FxbSDU04OaWq8 N2rysOIBkiVSxjY4SnU5UzgmylOE9YILb9+AybFJp5Elamm09IOX7+lBX qcMC4RdNhgUfW+i7ikiVUvmCfJAjTgLshcjvP5t42xJNabc61wRXFyuH5 uEw9CMBLXEz6/TKaEF5+yR+GjE1IHxoDsUfHmZbpTTzrdamqtkxGr2kMa YNm6OS7xGAks4jLQB5YKiI3IvrL9yz4733mMtkwWqNtPf91yNh7uWQhHg Q==; IronPort-SDR: OY7+8wGJdmn/qYaD3iA8PKPDYr0YBDzAUvvcl6gxHAyRFmmxWFUPvcvdHhW1Kf2NP9pZa6G4vJ YWzS0KeZ9bC3rzaguNNUqidivWwHQv5Es476/uuDxgnw6lVVJ3zwdHNUttlEz9JdYHbwNaeDdE Ksi5PB6uYpZDKnXnA+5UC9uKLp3NCarRMR340o6ZlSVlo9VoH5iUe5tnaNqsEPmJAQjjMTb4WE jN+UWjdqjGvMPTWXO+F3Q5YWGLD3rZdtAa1RTr3AaSHQuUziiW+xZXu7Neic7gG5PUD1FKeKNB 9fE= X-IronPort-AV: E=Sophos;i="5.81,296,1610380800"; d="scan'208";a="163447197" Received: from mail-dm3nam07lp2045.outbound.protection.outlook.com (HELO NAM02-DM3-obe.outbound.protection.outlook.com) ([104.47.56.45]) by ob1.hgst.iphmx.com with ESMTP; 01 Apr 2021 21:35:39 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZMg8HQV48oOfntnWdwIsPYgy5cVTn1ljQWOAur9bzgdDuAwYAp6/cuUHIzHRrdt/oM8Pn26CHum6CS6kjoLqTaJ7P8gwgiGwzyAwyy1/PKE39Nz4Bjpi2BsUyErFyL03i1zC/pXSq6eYaQaS5uETiPmZLhZi/D9+oIaDETq/buisvDTT4VsZ21ikbpaQAXBHSS6tymhRYmumRYOqSdZaPn6oNVh2xxNTtS8Vtt3Wp8/e7g6IaCJcJle6HhQSCWlX6WycZAxRkpaIVQQ/kaWTuAQPcbXbPUPENsDMjj5prehP0XR0FW0QDNS7lbi5LaB1AmMLu7lB7nDFzcApx0fpA== 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=WMFbBdH20e9gmuUIgGAsu8DFOU20JzHlhs9rWAYeIQk=; b=kimfkAhw1sLSbdBQTgX/sIO7QJUwSKS4IQynEhFSBl6FsEj33IjP+rPtfA7sZTWvOy+L0GS8GEOAxodydUanq8ReW7gjvT9m/tsju+hxAboTmVie9OoRF2oJbBh5wjOomE38WG9GaDtFLqKqxJXEXsl2c8HT5B6eVv/Rqe96+qN0h9mKZ6Xhx056I3LKCuEYpVPqEaFjenul6N+m2UMImHoGLwOhPDI4N2fEuwCZ5400A2nQN9IV7y1MdiEzxM5R4lGdy+Fw4zoCAvTrDUiuhRIrViC/PtkXYdcA4thRU7SMD68ncl39hR0kNVSdSZ2dow6lOM6VVcjWdTsO1PXZVA== 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=WMFbBdH20e9gmuUIgGAsu8DFOU20JzHlhs9rWAYeIQk=; b=nZdXft0JCtEKBChIcDgxqR4V7d0p9IfNpG1sPpWreCAG8UbDeKJsj/fufMof6QknVnKJN1ZwIoYkPEBFEs2gyu6FrHruQq/ghIPLsThpopydg93H63VlJ0bRuQPt68uLK3NeRA2qVanlAOMLgOgXYEYzkUacSheQGsLHDRd427Y= Authentication-Results: dabbelt.com; dkim=none (message not signed) header.d=none;dabbelt.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB3865.namprd04.prod.outlook.com (2603:10b6:5:ac::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Thu, 1 Apr 2021 13:35:33 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::38c0:cc46:192b:1868%7]) with mapi id 15.20.3977.033; Thu, 1 Apr 2021 13:35:33 +0000 From: Anup Patel To: Palmer Dabbelt , Palmer Dabbelt , Paul Walmsley , Albert Ou , Paolo Bonzini Cc: Alexander Graf , Atish Patra , Alistair Francis , Damien Le Moal , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v17 01/17] RISC-V: Add hypervisor extension related CSR defines Date: Thu, 1 Apr 2021 19:04:19 +0530 Message-Id: <20210401133435.383959-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210401133435.383959-1-anup.patel@wdc.com> References: <20210401133435.383959-1-anup.patel@wdc.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [122.179.112.210] X-ClientProxiedBy: MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.179.112.210) by MA1PR01CA0104.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Thu, 1 Apr 2021 13:35:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62b32f04-dece-4653-de90-08d8f5130637 X-MS-TrafficTypeDiagnostic: DM6PR04MB3865: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:11; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Eb+TD7uiuH6SZKkgTa/TFh4SFX9jkwqya7PR0Lpm97R2V2P06XQiQt21dbkhgsupkE7+ogsVsNyCErtpaJnN84GSy9uo0HidMa7Ce2U+ekz3PphnvS+aIJXbi+GJj3h6Z1bypbtD14NBp7mhFxGISjn6AgEw5w9YLIHiHWVBJH/UmGhM6lQXeIlCe7frVszm+7ZEeYED53ypIUczmR+NHC0Sq/hGPut4+cfhMgeBFGs7uiG+f5aUh2IRs1KS3YXuQMEtf/nJVwkqQqFzDuTaqHND2cP8jSoDXLwwddHnpHcRIxrMG+36J/mfYfsjmfCnWZfRMseHanSJ3sbS0P/4Ksna4rnRb7+gIoXKglAyMnfic3E6zUpXnP4tsmmWlDovmMxrT/ccvqZeQMFgIGUs5iUlTdfjgvJHo+lsxRCAPFZs2Jm+cILTWYTzL2tUfCbkbXDgGazk3AAJr9naLNkfJTY9S0uvOiAc0sqJTYrW0BCrx3yiGeHDlMbbDZo/AgQnN2vMy5UVNQIIcNMMQ18kVNizp/IubnFD0WHnRZ834Q+Urjj4mDym82PH+1DkxV2D2cinju22RCcSlq93uKnjrtxvKFJWqerNC02RXHMijV8pSy2LdA6D8x882RrCRdj1GI53HN8WPZUWacZfHj2d6GNi1ZbRkrxHo6GeSphpQCo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR04MB6201.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(136003)(376002)(366004)(39860400002)(36756003)(55016002)(26005)(2906002)(83380400001)(66556008)(66476007)(5660300002)(66946007)(7416002)(186003)(16526019)(7696005)(956004)(2616005)(8886007)(38100700001)(8936002)(52116002)(44832011)(54906003)(110136005)(8676002)(316002)(86362001)(4326008)(1076003)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?jgLO8nSWkrsDLfY1c4luFAMI1aEo27QJTaKcE9QCvHi6H7UuOcCNuVXkNcqN?= =?us-ascii?Q?SEXu2DdWzJaVTGkPGUJHbgDZPJ3gKmFHmpph6ghX3jOWrTAXVabSNqnz25ho?= =?us-ascii?Q?JC3pPSlQM6fQGCjqBJB+9agXDUDGjVGrDFwNO6aeMYOinJnV89BkLELBz9KV?= =?us-ascii?Q?SDgYbP7Sar4LEJy+9oinfOfae6mffTPKh/RXMSmSySk19/O3c55SNI3L3YBy?= =?us-ascii?Q?0t7L0kDOJh3YCWKenrtX7gZX7UgrycO3EZOw9NEwEhxxpILMdzAh+t5h1z+O?= =?us-ascii?Q?F39irwSAyRSc/iLN26MFdoxfEFHWX3bKpVsymjZUcbFINEDELq5Q7JvGfaCo?= =?us-ascii?Q?6s0/iy+GRnfugPWadpXz0Za1SmxYUJw9GBNvzShQd+UuONWO3AkHksz8edYx?= =?us-ascii?Q?NCkk45pAIXEXwTFgh5l/ycKmuNY5QufklU8HzG7KdU5FL+bDc4IoUFpkKois?= =?us-ascii?Q?s6ZKoUnjvKEbY7kJWGiW3o6PDbu/BMVzlLHhc7DhtTBsOu08ji12+YX90BXT?= =?us-ascii?Q?70rH2jCzvMgHAaftdlTGLngg9qAGl04iflP2z+yha3Ek91AElDigrExzT1lp?= =?us-ascii?Q?T4RLRsxWStOUDiIEkB2kGFjX5dRgAJmxbYE0v7MbihA4R1Fas9theVD4twCP?= =?us-ascii?Q?IOWvH/Yaa/G06KloMln3SL2yruSuCyB9w8/01W/cDe1j0UXPP03Z97SKxiMs?= =?us-ascii?Q?KlrFFA7QYB5L4ns3Qvr8FoNM6+WWuxEYhYGcHsctrOZp+uRfiy7Dsv0UdxMm?= =?us-ascii?Q?sZLxUDVqJ5M6wBwy4fCSNcevsIDylwVtgxIYz5WzyGIKI2Fo97pqWZy4M1c3?= =?us-ascii?Q?bHtEB+Ja4HfJ4/wNbcj/JZ1WmgDBtz1PeHRT31ETU2Z25jTbKTzfimth1XSe?= =?us-ascii?Q?vStLZGjkj2NMCCq4afIFGGvYEcBqM9/UMBNj98aR79hP5yVcxsujJMTikh7k?= =?us-ascii?Q?Mh9W2qTnWGZYBSoY79i187i6QUJgrqd62o90FtP6V6jSpABJEqFoyeMmL4mr?= =?us-ascii?Q?9Ok6YuIuSJg0De6/RO6Qk1CVAQWmqBYpT8bMm1NnaPaCzNdO7EZaAtbkF9nl?= =?us-ascii?Q?DBVScThDI6FX0tRpQdyWicNxrsAzvSJ6biEnABdtQb/6E0Ba/UFUXkQvwrnd?= =?us-ascii?Q?nadQqvnLmk6/c7eNd16kli5/vsJ92Gq1Z0Bx9CYxoGQR1DIz/PcfMLQM8ouZ?= =?us-ascii?Q?fe/bS7pgA2KUuHpzQO7ccwHT5QFsR/5Bh9xkSYUx/rL7RjZe6gCgl5p3qAZS?= =?us-ascii?Q?VaexOjpI7UvhrR9X6H+p3yy8M/UE6ooBGuxQKcVbII42QVCAUicgsHZOG2Kj?= =?us-ascii?Q?1eaBBRmB1ua5/10NKiTwG0vsnhTgAnDX5kZXEWjZwqSJPw=3D=3D?= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62b32f04-dece-4653-de90-08d8f5130637 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 13:35:33.5680 (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: +pQZpyP8hzdlu9jKQv3sNKgT9px2kRNJ+Pf974YvDiT10CJjTNcY/GWkXB4o6kig8xkpoCT3HWWYUEYxbzjYcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB3865 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 Acked-by: Paolo Bonzini Reviewed-by: Paolo Bonzini Reviewed-by: Alexander Graf --- arch/riscv/include/asm/csr.h | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index caadfc1d7487..bdf00bd558e4 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -30,6 +30,8 @@ #define SR_XS_CLEAN _AC(0x00010000, UL) #define SR_XS_DIRTY _AC(0x00018000, UL) +#define SR_MXR _AC(0x00080000, UL) + #ifndef CONFIG_64BIT #define SR_SD _AC(0x80000000, UL) /* FS/XS dirty */ #else @@ -58,22 +60,32 @@ /* Interrupt causes (minus the high bit) */ #define IRQ_S_SOFT 1 +#define IRQ_VS_SOFT 2 #define IRQ_M_SOFT 3 #define IRQ_S_TIMER 5 +#define IRQ_VS_TIMER 6 #define IRQ_M_TIMER 7 #define IRQ_S_EXT 9 +#define IRQ_VS_EXT 10 #define IRQ_M_EXT 11 /* Exception causes */ #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 +#define EXC_INST_GUEST_PAGE_FAULT 20 +#define EXC_LOAD_GUEST_PAGE_FAULT 21 +#define EXC_VIRTUAL_INST_FAULT 22 +#define EXC_STORE_GUEST_PAGE_FAULT 23 /* PMP configuration */ #define PMP_R 0x01 @@ -85,6 +97,58 @@ #define PMP_A_NAPOT 0x18 #define PMP_L 0x80 +/* HSTATUS flags */ +#ifdef CONFIG_64BIT +#define HSTATUS_VSXL _AC(0x300000000, UL) +#define HSTATUS_VSXL_SHIFT 32 +#endif +#define HSTATUS_VTSR _AC(0x00400000, UL) +#define HSTATUS_VTW _AC(0x00200000, UL) +#define HSTATUS_VTVM _AC(0x00100000, UL) +#define HSTATUS_VGEIN _AC(0x0003f000, UL) +#define HSTATUS_VGEIN_SHIFT 12 +#define HSTATUS_HU _AC(0x00000200, UL) +#define HSTATUS_SPVP _AC(0x00000100, UL) +#define HSTATUS_SPV _AC(0x00000080, UL) +#define HSTATUS_GVA _AC(0x00000040, UL) +#define HSTATUS_VSBE _AC(0x00000020, 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) + +#define HGATP_PAGE_SHIFT 12 + +#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_SHIFT 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_SHIFT HGATP32_MODE_SHIFT +#endif + +/* VSIP & HVIP relation */ +#define VSIP_TO_HVIP_SHIFT (IRQ_VS_SOFT - IRQ_S_SOFT) +#define VSIP_VALID_MASK ((_AC(1, UL) << IRQ_S_SOFT) | \ + (_AC(1, UL) << IRQ_S_TIMER) | \ + (_AC(1, UL) << IRQ_S_EXT)) + /* symbolic CSR names: */ #define CSR_CYCLE 0xc00 #define CSR_TIME 0xc01 @@ -104,6 +168,31 @@ #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_HIE 0x604 +#define CSR_HTIMEDELTA 0x605 +#define CSR_HCOUNTEREN 0x606 +#define CSR_HGEIE 0x607 +#define CSR_HTIMEDELTAH 0x615 +#define CSR_HTVAL 0x643 +#define CSR_HIP 0x644 +#define CSR_HVIP 0x645 +#define CSR_HTINST 0x64a +#define CSR_HGATP 0x680 +#define CSR_HGEIP 0xe12 + #define CSR_MSTATUS 0x300 #define CSR_MISA 0x301 #define CSR_MIE 0x304 -- 2.25.1