Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5097335rwd; Sun, 11 Jun 2023 23:06:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HlxOiF0mjpgDHOMOIMqUZBuUVMPlTStwFOg8upLdhRaR7gBvARQOOOBa2W8aH5Tj0dE+8 X-Received: by 2002:a17:903:1208:b0:1af:aafb:64c8 with SMTP id l8-20020a170903120800b001afaafb64c8mr6868602plh.21.1686549989531; Sun, 11 Jun 2023 23:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686549989; cv=none; d=google.com; s=arc-20160816; b=nq5rh8tYE/7k/B8h8YTYhHPWbH/W1JDVIvhWPkbrAZBKEOuuAktpu948gFrCRrFeJp xJNs7Klidy76vIyEV4E2IMhYYcxC21eQzRLM3fBVsvQxgzHUKb4IQ/nH+mkLRBsNlkG9 rPYs/v6RhF86K2WrNTbEsvuMdkE8ZtsySWFM82hOxareaEErpf7R40PJ3O8GyXChSrcR Ykl5219/NNC0DsQ3dlejXC7+MsxFrJu9AOjheFjOXQh1EoOvmPtrrxA6jrxuoxFTI+MH 3simqHuje5CL25PAOX1CqgoEPTRxP6fHcGkHjxTGjrwI11Gsng4kB/X+6m6zT4Hr7Scz 3T/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=WSs+s3K7JH+/Ixf8VsP8YGXDWFbZuQ0ZXSKaUQscxVKsQhv3MO8Jl+Mu6XGTA5FSJ+ kqgG51WhiWXoXIYQ1keS0tGaPBcrlfjK/9Q37yi1EUmCcfXGsEDVzKcAyo/04KqqLGnK 3SPEVe0VaihsQtpneruqOjJNp7gnId0rRQKeFuobFCUY6a7gnw8ZtPvlXCipHGsb8VhN 3ZWgn/YtWxfqA6Pn7ZGmb9DPpJnsG05rQmbxw5Es2IuAoYMkW2DifIHUePbWoLG3EGAx F0y8hBCQX6yrEudpckKWJ5bKWEIdEkwLP6vr/0sv3mvpOKCLQZjS/nzJDQOjHSfrfFJG Itsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ZyfxYqMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a170903011100b001b2468a8435si3292400plc.220.2023.06.11.23.06.17; Sun, 11 Jun 2023 23:06:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ZyfxYqMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236295AbjFLFkq (ORCPT + 99 others); Mon, 12 Jun 2023 01:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235963AbjFLFkF (ORCPT ); Mon, 12 Jun 2023 01:40:05 -0400 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DAFF10E0 for ; Sun, 11 Jun 2023 22:39:59 -0700 (PDT) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1a1fa977667so2481822fac.1 for ; Sun, 11 Jun 2023 22:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1686548398; x=1689140398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=ZyfxYqMM0W3OMxKPrxCUyAqJqZUedm09S/hgWYlTNUjmk1lt/PAZaWYOl3RBSjc3P9 fLE+te6gevh1tGcgCGwh9pomh5vVqWVYR3SNK2c9a0Jdrmjqu7U/DicwzwaIHUDPa28R fT6PmcP7ePMJzzNJ7aMJOTayJNr/QVRovWdVgI7Auw9we1utiIUWQ85Dj7azGba8Hfu9 eaqOZAJsYaDPjr6V/5iIcAeZ/sbTUvbB3XzUTicbdtSix0e+hbEZ9eF4vwXrac+eURtM GGjvFB6wf12a9Ioal/9mRjwRH/ONVGnlZssqpD5jsRfnhuLoTuXZ9efsPSJMqJoYudBE MBJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686548398; x=1689140398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=E4hvYlyyKiItDMjKtC0ThYol6ku4+uugQsXNBIF8x5L2kE2YF09sMNct8wIhroYoDA 2UcTh8uHNKcOhjNUpWxLajsQBuKnjPStx8fiFv4WgtG+R/bhc0qCJJ2sUh9ksGsWcL1k WgQhOHjJGB+sXJI5loNg8KXqVuO2Ecm4HNIPTN1S7jYTPbIl67EGJnQkjC+4j2fdoviP ngk0G/Bb3RL2egCX7JS2w32kYB9QDXgwdqmypmdbCiO/eE5KcPRKdC61Ho2bGiBIyoKt XvDaL1e0ljtcZrnoHv8WMI14n1UtAZMbNjCBq4Mo8JNCeUYlIXcKGz+G7GQdkOGErXxd Wldw== X-Gm-Message-State: AC+VfDyZX2/jD3YsfLDKd9VqyO+jTu98HD4nk9Vp5qBjBljV5MSevAga TvxhjZ2bYAceu9hViqob+2znmw== X-Received: by 2002:a05:6870:8544:b0:19f:7917:fe5a with SMTP id w4-20020a056870854400b0019f7917fe5amr4409038oaj.46.1686548397700; Sun, 11 Jun 2023 22:39:57 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id lv19-20020a056871439300b001a30d846520sm5534869oab.7.2023.06.11.22.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jun 2023 22:39:57 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel , Atish Patra Subject: [PATCH v2 03/10] RISC-V: KVM: Add APLIC related defines Date: Mon, 12 Jun 2023 11:09:25 +0530 Message-Id: <20230612053932.58604-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612053932.58604-1-apatel@ventanamicro.com> References: <20230612053932.58604-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We add APLIC related defines in a separate header so that different parts of KVM code can share it. Once AIA drivers are merged will have a common APLIC header shared by both KVM and IRQCHIP driver. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/include/asm/kvm_aia_aplic.h | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 arch/riscv/include/asm/kvm_aia_aplic.h diff --git a/arch/riscv/include/asm/kvm_aia_aplic.h b/arch/riscv/include/asm/kvm_aia_aplic.h new file mode 100644 index 000000000000..6dd1a4809ec1 --- /dev/null +++ b/arch/riscv/include/asm/kvm_aia_aplic.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2021 Western Digital Corporation or its affiliates. + * Copyright (C) 2022 Ventana Micro Systems Inc. + */ +#ifndef __KVM_RISCV_AIA_IMSIC_H +#define __KVM_RISCV_AIA_IMSIC_H + +#include + +#define APLIC_MAX_IDC BIT(14) +#define APLIC_MAX_SOURCE 1024 + +#define APLIC_DOMAINCFG 0x0000 +#define APLIC_DOMAINCFG_RDONLY 0x80000000 +#define APLIC_DOMAINCFG_IE BIT(8) +#define APLIC_DOMAINCFG_DM BIT(2) +#define APLIC_DOMAINCFG_BE BIT(0) + +#define APLIC_SOURCECFG_BASE 0x0004 +#define APLIC_SOURCECFG_D BIT(10) +#define APLIC_SOURCECFG_CHILDIDX_MASK 0x000003ff +#define APLIC_SOURCECFG_SM_MASK 0x00000007 +#define APLIC_SOURCECFG_SM_INACTIVE 0x0 +#define APLIC_SOURCECFG_SM_DETACH 0x1 +#define APLIC_SOURCECFG_SM_EDGE_RISE 0x4 +#define APLIC_SOURCECFG_SM_EDGE_FALL 0x5 +#define APLIC_SOURCECFG_SM_LEVEL_HIGH 0x6 +#define APLIC_SOURCECFG_SM_LEVEL_LOW 0x7 + +#define APLIC_IRQBITS_PER_REG 32 + +#define APLIC_SETIP_BASE 0x1c00 +#define APLIC_SETIPNUM 0x1cdc + +#define APLIC_CLRIP_BASE 0x1d00 +#define APLIC_CLRIPNUM 0x1ddc + +#define APLIC_SETIE_BASE 0x1e00 +#define APLIC_SETIENUM 0x1edc + +#define APLIC_CLRIE_BASE 0x1f00 +#define APLIC_CLRIENUM 0x1fdc + +#define APLIC_SETIPNUM_LE 0x2000 +#define APLIC_SETIPNUM_BE 0x2004 + +#define APLIC_GENMSI 0x3000 + +#define APLIC_TARGET_BASE 0x3004 +#define APLIC_TARGET_HART_IDX_SHIFT 18 +#define APLIC_TARGET_HART_IDX_MASK 0x3fff +#define APLIC_TARGET_GUEST_IDX_SHIFT 12 +#define APLIC_TARGET_GUEST_IDX_MASK 0x3f +#define APLIC_TARGET_IPRIO_MASK 0xff +#define APLIC_TARGET_EIID_MASK 0x7ff + +#endif -- 2.34.1