From patchwork Wed Sep 18 14:56:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 11150587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEBB414E5 for ; Wed, 18 Sep 2019 15:40:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF96521848 for ; Wed, 18 Sep 2019 15:40:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF96521848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAc4N-0001j5-87 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Sep 2019 11:40:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49057) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAbrv-0006Ka-K2 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 11:27:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAbru-0006Rw-E2 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 11:27:47 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iAbru-0006RY-86 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 11:27:46 -0400 Received: by mail-pg1-f195.google.com with SMTP id z12so32757pgp.9 for ; Wed, 18 Sep 2019 08:27:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=92TyKMJVZqYJ1sG0e0fGsni//VQCxIEBuXE2vZnuLSU=; b=MAZttauUwv3jIV6LgsFFrNndqt9WsrV97ou6nKEF19UXLOX0n3FTudgwdwEEZx0KNQ xniKAq+6BRBodlyoT/GRE1mRt8rixVVVOR5GyV301YE/II0G8bYFjEFdC0NniPmTktnw zjfPYazV7EPTo8eCYqYF0IokWigOvTMU9Kj4vT9Y8NxNMe3UHqd0v8t1ITdI4NUPL6NK Xt/C9sfSh14AhUmebjzXhHVr7WED4eWX8aGKIVNwbBNrZ19sfnBq+2bsifRJCi1fNiPA FaJpMiGQuCBxf7HL/sJKXHjU4emJTPDN/VOA+KH9qPbNWIukrAZ6xE+lA32nzH//UQsd aKrw== X-Gm-Message-State: APjAAAV9LLYa0jf+BukkH5nGUFuOMOCfXnJxCFgXEPl3oM+IyROhoBBA t/En5LQBQ8qui0an5c3batFbgA== X-Google-Smtp-Source: APXvYqxub/yFjTWkkwdEvm+mpAeLAU47O928RVVr8MEf5Jt8emDQ6c9G3aj/uRnlnTkhNad7G7c/EA== X-Received: by 2002:a17:90a:fe04:: with SMTP id ck4mr4494761pjb.74.1568820465007; Wed, 18 Sep 2019 08:27:45 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i74sm9222296pfe.28.2019.09.18.08.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 08:27:44 -0700 (PDT) Date: Wed, 18 Sep 2019 07:56:00 -0700 Message-Id: <20190918145640.17349-9-palmer@sifive.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918145640.17349-1-palmer@sifive.com> References: <20190918145640.17349-1-palmer@sifive.com> MIME-Version: 1.0 From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.195 Subject: [Qemu-devel] [PULL 08/48] target/riscv: Update the Hypervisor CSRs to v0.4 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , Palmer Dabbelt , qemu-riscv@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alistair Francis Update the Hypervisor CSR addresses to match the v0.4 spec. Signed-off-by: Alistair Francis Reviewed-by: Palmer Dabbelt Signed-off-by: Palmer Dabbelt --- target/riscv/cpu_bits.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index 11f971ad5d..e99834856c 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -173,6 +173,24 @@ #define CSR_SPTBR 0x180 #define CSR_SATP 0x180 +/* Hpervisor CSRs */ +#define CSR_HSTATUS 0x600 +#define CSR_HEDELEG 0x602 +#define CSR_HIDELEG 0x603 +#define CSR_HCOUNTERNEN 0x606 +#define CSR_HGATP 0x680 + +#if defined(TARGET_RISCV32) +#define HGATP_MODE SATP32_MODE +#define HGATP_VMID SATP32_ASID +#define HGATP_PPN SATP32_PPN +#endif +#if defined(TARGET_RISCV64) +#define HGATP_MODE SATP64_MODE +#define HGATP_VMID SATP64_ASID +#define HGATP_PPN SATP64_PPN +#endif + /* Physical Memory Protection */ #define CSR_PMPCFG0 0x3a0 #define CSR_PMPCFG1 0x3a1 @@ -206,23 +224,6 @@ #define CSR_DPC 0x7b1 #define CSR_DSCRATCH 0x7b2 -/* Hpervisor CSRs */ -#define CSR_HSTATUS 0xa00 -#define CSR_HEDELEG 0xa02 -#define CSR_HIDELEG 0xa03 -#define CSR_HGATP 0xa80 - -#if defined(TARGET_RISCV32) -#define HGATP_MODE SATP32_MODE -#define HGATP_ASID SATP32_ASID -#define HGATP_PPN SATP32_PPN -#endif -#if defined(TARGET_RISCV64) -#define HGATP_MODE SATP64_MODE -#define HGATP_ASID SATP64_ASID -#define HGATP_PPN SATP64_PPN -#endif - /* Performance Counters */ #define CSR_MHPMCOUNTER3 0xb03 #define CSR_MHPMCOUNTER4 0xb04